ffpddlZddlmZddlmZddlmZddlmZddl m Z m Z m Z dZ dZd Zd Zd ZdS) N)AES)SHA512) _bcrypt_hash)strxor)tostrbchrbordct|dkrtdtjd|ddd}||ddfS)NzInsufficient data>Ir)len ValueErrorstructunpack)datavalues {/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/PublicKey/_openssh.py read_int4r(sP 4yy1}},--- M$RaR ) )! ,E $qrr(?ct|\}}t||krtd|d|||dfS)NzInsufficient data (V))rr r)rsizes r read_bytesr/sL4JD$ 4yy40111 ;TUU ##rcHt|\}}t||fS)N)rr)rsds r read_stringr6s# d  DAq 88Q;rct|D]-\}}t||dzdzkrtd.dS)NzIncorrect padding) enumerater r)padvxs r check_paddingr$;sR#221 77A~ & &011 1 '22rc |dstd|dd}t|\}}t|\}}t|\}}t |\}}|dkrtdt|\}}t|\}}|rtdt |dzdkrtd |d kr|}nA||fd krtd |d |t|\} }t |\} }t | dkrtd|rtdt j|} g} d} tddD]$}t j| tj d|z}t| d|| d}tj dgtj d|R}t|}td| D]p}t| dt j|| d}tj dgtj d|R}t|||q| |dd&ddt%| D}t'j|ddt&jd|dd}||}t |\}}t |\}}||krtdt|\}}||fS) Nsopenssh-key-v1zIncorrect magic valuerzWe only handle 1 key at a timez Too much datarzIncorrect payload lengthnone)z aes256-ctrbcryptzUnsupported encryption scheme /zIncorrect salt lengthzToo much data in kdfoptionss OxychromaticBlowfishSwatDynamiter Fz IIIIIIII)outputrcRg|]$\}}t|t|z%S)r).0abs r z2import_openssh_private_generic..ys,GGGv1477477?GGGr 0)nonce initial_valuezIncorrect checksum) startswithrrrrr rnewdigestrangerpackrr bytearrayrappendjoinziprMODE_CTRdecrypt)rpassword ciphernamekdfname kdfoptionsnumber_of_keys_ encrypted decryptedsalt iterations pwd_sha512stripesconstantcount salt_sha512out_leoutaccresultcipher checkint1 checkint2ssh_names rimport_openssh_private_genericr\As ??0 1 120111 9D"4((J%%MGT!$''J$T??ND9:::$GAt &&OIt *))) 9~~Q3444V  $< < <*jjjRYRYZ[[ [%j11j!*:!6!6 J t99??455 5  <:;; ;Z))0022 61a[[ % %E *TFKe,D,D%DEELLNNK!*ahNNF+kOFM+v,N,NOOOCC..C1j)) - -%j!VZ__5K5K5M5MxY^__k+S k60R0RSSSsC,,,,, NN3ss8 $ $ $ $GGgGGGHH"'-bh'7999NN9-- $Y//Iy$Y//IyI-...%i00Hi Y r)r Crypto.Cipherr Crypto.HashrCrypto.Protocol.KDFrCrypto.Util.strxorrCrypto.Util.py3compatrrr rrrr$r\r1rrrbs> ,,,,,,%%%%%%3333333333$$$ 222 FFFFFr