Files
ServerSync/lib/paramiko/__pycache__/hostkeys.cpython-314.pyc

132 lines
17 KiB
Plaintext
Raw Normal View History

2026-02-12 02:28:23 +02:00
+
u<10>iX3<00><00><><00>^RIHtHt^RIt^RIt^RIt^RIHt^RIH t ^RI
H t ^RI H t Ht^RIHtHtHtHt^RIHt!R R
]4t!R R ]4t!R R4tR#)<0F>)<02> encodebytes<65> decodebytesN)<01>MutableMapping)<01>sha1)<01>HMAC)<02>PKey<65>UnknownKeyType)<04>
get_logger<EFBFBD>constant_time_bytes_eq<65>b<>u)<01> SSHExceptionc<00><>a<00>]tRt^#toRtRRltRtRtRtRt Rt
R t R
t R t R tR tRtRtRtRt]RRl4tRtVtR#)<15>HostKeysa>
Representation of an OpenSSH-style "known hosts" file. Host keys can be
read from one or more files, and then individual hosts can be looked up to
verify server keys during SSH negotiation.
A `.HostKeys` object can be treated like a dict; any dict lookup is
equivalent to calling `lookup`.
.. versionadded:: 1.5.3
Nc <0C>B<00>.VnVeVPV4R#R#)z<>
Create a new HostKeys object, optionally loading keys from an OpenSSH
style host-key file.
:param str filename: filename to load host keys from, or ``None``
N)<02>_entries<65>load)<02>self<6C>filenames&&<26>8/tmp/pip-target-zhdecbcm/lib/python/paramiko/hostkeys.py<70>__init__<5F>HostKeys.__init__/s"<00><00><1B><04> <0A> <13> <1F> <10>I<EFBFBD>I<EFBFBD>h<EFBFBD> <1F> <20>c <0C><><00>VPF=pWP9gKVPP4V8XgK6W4nR# VPP \ V.V44R#)z<>
Add a host key entry to the table. Any existing entry for a
``(hostname, keytype)`` pair will be replaced.
:param str hostname: the hostname (or IP) to add
:param str keytype: key type (in ``"ssh-<type>"`` format)
:param .PKey key: the key to add
N)r<00> hostnames<65>key<65>get_name<6D>append<6E> HostKeyEntry)r<00>hostname<6D>keytyper<00>es&&&& r<00>add<64> HostKeys.add;sS<00><00><16><1D><1D>A<EFBFBD><18>K<EFBFBD>K<EFBFBD>'<27>a<EFBFBD>e<EFBFBD>e<EFBFBD>n<EFBFBD>n<EFBFBD>.><3E>'<27>.I<><1B><05><16><1F> <0A> <0A> <0A><1C><1C>\<5C>8<EFBFBD>*<2A>c<EFBFBD>:<3A>;rc <0C>d<00>\VR4;_uu_4p\V^4F<>wr4VP4p\V4^8XgV^,R8XdK5\P WC4pTfKQTPpTFApTPYuP4'gK&TPPT4KC \TP4'gK<>TPPT4K<> RRR4R# \ dK<>i;i +'giR#;i)a 
Read a file of known SSH host keys, in the format used by OpenSSH.
This type of file unfortunately doesn't exist on Windows, but on
posix, it will usually be stored in
``os.path.expanduser("~/.ssh/known_hosts")``.
If this method is called multiple times, the host keys are merged,
not cleared. So multiple calls to `load` will just call `add`,
replacing any existing entries and adding new ones.
:param str filename: name of the file to read host keys from
:raises: ``IOError`` -- if there was an error reading the file
<EFBFBD>r<>#N) <0A>open<65> enumerate<74>strip<69>lenr<00> from_linerr<00>checkr<00>removerr)rr<00>f<>lineno<6E>line<6E>entry<72>
_hostnames<EFBFBD>hs&& rr<00> HostKeys.loadJs<><00><00><12>(<28>C<EFBFBD> <20> <20>A<EFBFBD> )<29>!<21>Q<EFBFBD><0F> <0C><06><1B>z<EFBFBD>z<EFBFBD>|<7C><04><17><04>I<EFBFBD><11>N<EFBFBD><04>Q<EFBFBD><07>3<EFBFBD><0E><1C><1D>(<28>2<>2<>4<EFBFBD>@<40>E<EFBFBD><19>$<24>!&<26><1F><1F>J<EFBFBD>'<27><01><1F>:<3A>:<3A>a<EFBFBD><19><19>3<>3<>!<21>O<EFBFBD>O<EFBFBD>2<>2<>1<EFBFBD>5<>(<28><1B>5<EFBFBD>?<3F>?<3F>+<2B>+<2B><1C> <0A> <0A>,<2C>,<2C>U<EFBFBD>3<>!0<>!<21> <20><>$<24><1D><1C><1D><>!<21> <20> <20>sB<00>AD<05>D <06>-D<05>3/D<05>'7D<05>#D<05> D <09>D<05>D <09>D<05> D/ c <0C><><00>\VR4;_uu_4pVPF.pVP4pV'gKVPV4K0 RRR4R# +'giR#;i)a<>
Save host keys into a file, in the format used by OpenSSH. The order
of keys in the file will be preserved when possible (if these keys were
loaded from a file originally). The single exception is that combined
lines will be split into individual key lines, which is arguably a bug.
:param str filename: name of the file to write
:raises: ``IOError`` -- if there was an error writing the file
.. versionadded:: 1.6.1
<EFBFBD>wN)r(r<00>to_line<6E>write)rrr/r"r1s&& r<00>save<76> HostKeys.savejsK<00><00><12>(<28>C<EFBFBD> <20> <20>A<EFBFBD><19>]<5D>]<5D><01><18>y<EFBFBD>y<EFBFBD>{<7B><04><17>4<EFBFBD><15>G<EFBFBD>G<EFBFBD>D<EFBFBD>M<EFBFBD>#<23>!<21> <20> <20> <20>s<00>%A<05>A<05> A/ c <0C><>a<01>!V3RlR\4p.pVPF.pVPSV4'gKVPV4K0 \ V4^8XdR#V!SW04#)a
Find a hostkey entry for a given hostname or IP. If no entry is found,
``None`` is returned. Otherwise a dictionary of keytype to key is
returned.
:param str hostname: the hostname (or IP) to lookup
:return: dict of `str` -> `.PKey` keys associated with this host
(or ``None``)
c<00>R<a<00>]tRt^<5E>toRtRtRtRtRtV3Rlt Rt
Rt Vt R #)
<EFBFBD> HostKeys.lookup.<locals>.SubDictc<08>*<00>WnW nW0nR#<00>N)<03> _hostnamer<00> _hostkeys)rr <00>entries<65>hostkeyss&&&&rr<00>)HostKeys.lookup.<locals>.SubDict.__init__<5F>s<00><00>!)<29><0E> '<27> <0A>!)<29>rc3<08>D"<00>VP4FpVx<00>K R#5ir@<00><01>keys<79>r<00>ks& r<00>__iter__<5F>)HostKeys.lookup.<locals>.SubDict.__iter__<5F>s<00><00><00><1D><19><19><1B>A<EFBFBD><1B>G<EFBFBD>%<25><><00> c<08>4<00>\VP44#r@<00>r+rH<00>rs&r<00>__len__<5F>(HostKeys.lookup.<locals>.SubDict.__len__<5F>s<00><00><1A>4<EFBFBD>9<EFBFBD>9<EFBFBD>;<3B>'<27>'rc<08><><00>\VP4F@pVPP4V8XgK$VPP V4R# \ V4hr@)<06>listrrrr.<00>KeyError<6F>rrr"s&& r<00> __delitem__<5F>,HostKeys.lookup.<locals>.SubDict.__delitem__<5F>sI<00><00><1D>d<EFBFBD>m<EFBFBD>m<EFBFBD>,<2C>A<EFBFBD><18>u<EFBFBD>u<EFBFBD>~<7E>~<7E>'<27>3<EFBFBD>.<2E><1C> <0A> <0A>,<2C>,<2C>Q<EFBFBD>/<2F><1D>-<2D>
#<23>3<EFBFBD>-<2D>'rc<08><><00>VPF0pVPP4V8XgK$VPu# \V4hr@)rrrrUrVs&& r<00> __getitem__<5F>,HostKeys.lookup.<locals>.SubDict.__getitem__<5F>s8<00><00><1D><1D><1D>A<EFBFBD><18>u<EFBFBD>u<EFBFBD>~<7E>~<7E>'<27>3<EFBFBD>.<2E> <20>u<EFBFBD>u<EFBFBD> <0C>'<27><1F>s<EFBFBD>m<EFBFBD>#rc<08>8<<01>VPF;pVPfKVPP4V8XgK4W#nR# \S.V4pVPP V4VP
PP V4R#r@)rrrrrrB)rr<00>valr"r s&&& <20>r<00> __setitem__<5F>,HostKeys.lookup.<locals>.SubDict.__setitem__<5F>sr<00><><00><1D><1D><1D>A<EFBFBD><18>u<EFBFBD>u<EFBFBD>}<7D> <20><18>u<EFBFBD>u<EFBFBD>~<7E>~<7E>'<27>3<EFBFBD>.<2E> #<23><05><1D> '<27>%<25>h<EFBFBD>Z<EFBFBD><13>5<>A<EFBFBD><18>M<EFBFBD>M<EFBFBD>(<28>(<28><11>+<2B><18>N<EFBFBD>N<EFBFBD>+<2B>+<2B>2<>2<>1<EFBFBD>5rc<08><><00>VPUu.uF-pVPfKVPP4NK/ up#uupir@)rrr)rr"s& rrH<00>%HostKeys.lookup.<locals>.SubDict.keys<79>sA<00><00>"<22>]<5D>]<5D><12>*<2A><01><18>u<EFBFBD>u<EFBFBD>%<25>A<EFBFBD>E<EFBFBD>E<EFBFBD>N<EFBFBD>N<EFBFBD>$<24>*<2A><12><12><>s
<00>A<04>A)rrBrAN) <0A>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__firstlineno__rrKrQrWrZr^rH<00>__static_attributes__<5F>__classdictcell__)<02> __classdict__r s@<40>r<00>SubDictr><00>s-<00><><00><00> *<2A>
 <1C> (<28> (<28> $<24> 6<> <12> rriN)rr<00>_hostname_matchesrr+)rr rirCr"s&f r<00>lookup<75>HostKeys.lookup}sb<00><><00>. <12>n<EFBFBD>. <12>`<15><07><15><1D><1D>A<EFBFBD><13>%<25>%<25>h<EFBFBD><01>2<>2<><17><0E><0E>q<EFBFBD>!<21><1F> <0F>w<EFBFBD><<3C>1<EFBFBD> <1C><17><16>x<EFBFBD><17>/<2F>/rc <0C><><00>VPF_pW18XgVVPR4'gK"VPR4'dK;\VPW4V4'gK^R# R#)zT
Tests whether ``hostname`` string matches given SubDict ``entry``.
:returns bool:
<EFBFBD>|1|TF)r<00>
startswithr <00> hash_host)rr r2r4s&&& rrj<00>HostKeys._hostname_matches<65>sU<00><00> <17><1F><1F>A<EFBFBD><11> <0A><14><<3C><<3C><05>&<26>&<26> <20>+<2B>+<2B>E<EFBFBD>2<>2<>*<2A>4<EFBFBD>><3E>><3E>(<28>+F<><01>J<>J<><1B>!<21>rc <0C><><00>VPV4pVfR#VPVP4R4pVfR#VP4VP48H#)a
Return True if the given key is associated with the given hostname
in this dictionary.
:param str hostname: hostname (or IP) of the SSH server
:param .PKey key: the key to check
:return:
``True`` if the key is associated with the hostname; else ``False``
NF)rk<00>getr<00>asbytes)rr rrJ<00>host_keys&&& rr-<00>HostKeys.check<63>sS<00><00> <11>K<EFBFBD>K<EFBFBD><08> !<21><01> <0C>9<EFBFBD><18><14>5<EFBFBD>5<EFBFBD><13><1C><1C><1E><14>.<2E><08> <13> <1B><18><17><1F><1F>!<21>S<EFBFBD>[<5B>[<5B>]<5D>2<>2rc <0C><00>.VnR#)z+
Remove all host keys from the dictionary.
N<EFBFBD>rrPs&r<00>clear<61>HostKeys.clear<61>s <00><00><1B><04> rc#<08>D"<00>VP4FpVx<00>K R#5ir@rGrIs& rrK<00>HostKeys.__iter__<5F>s<00><00><00><15><19><19><1B>A<EFBFBD><13>G<EFBFBD><1D>rMc<08>4<00>\VP44#r@rOrPs&rrQ<00>HostKeys.__len__<5F>s<00><00><12>4<EFBFBD>9<EFBFBD>9<EFBFBD>;<3B><1F>rc<08>F<00>VPV4pVf \V4hV#r@)rkrU)rr<00>rets&& rrZ<00>HostKeys.__getitem__<5F>s$<00><00><12>k<EFBFBD>k<EFBFBD>#<23><1E><03> <0E>;<3B><1A>3<EFBFBD>-<2D> <1F><12>
rc<08><><00>Rp\VP4F wr4VPW4'gKTpM Vf \V4hVPP V4R#r@)r)rrjrU<00>pop)rr<00>index<65>ir2s&& rrW<00>HostKeys.__delitem__<5F>sX<00><00><14><05>!<21>$<24>-<2D>-<2D>0<>H<EFBFBD>A<EFBFBD><13>%<25>%<25>c<EFBFBD>1<>1<><19><05><15>1<> <11>=<3D><1A>3<EFBFBD>-<2D> <1F> <0C> <0A> <0A><19><19>%<25> rc<08><><00>\V4^8Xd)VPP\V.R44R#VP 4F<>pRpVPFEpWP
9gKVP P4V8XgK6W#,VnRpKG V'dKdVPP\V.W#,44K<> R#)rNFT)r+rrrrHrrr)rr r2<00>key_type<70>foundr"s&&& rr^<00>HostKeys.__setitem__<5F>s<><00><00> <0E>u<EFBFBD>:<3A><11>?<3F> <10>M<EFBFBD>M<EFBFBD> <20> <20><1C>x<EFBFBD>j<EFBFBD>$<24>!?<3F> @<40> <12><1D>
<EFBFBD>
<EFBFBD> <0C>H<EFBFBD><19>E<EFBFBD><19>]<5D>]<5D><01><1C> <0B> <0B>+<2B><11><15><15><1E><1E>1A<31>X<EFBFBD>1M<31>!<21>O<EFBFBD>A<EFBFBD>E<EFBFBD> <20>E<EFBFBD> #<23>
<19>5<EFBFBD><14> <0A> <0A>$<24>$<24>\<5C>8<EFBFBD>*<2A>e<EFBFBD>o<EFBFBD>%N<>O<>%rc<08><><00>.pVPF/pVPFpW19gK VPV4K K1 V#r@)rrr)rr<>r"r4s& rrH<00> HostKeys.keyss:<00><00><10><03><15><1D><1D>A<EFBFBD><16>[<5B>[<5B><01><14><<3C><17>J<EFBFBD>J<EFBFBD>q<EFBFBD>M<EFBFBD>!<21><1F><13>
rc<08>x<00>.pVP4F#pVPVPV44K% V#r@)rHrrk)rr<>rJs& r<00>values<65>HostKeys.valuess0<00><00><10><03><15><19><19><1B>A<EFBFBD> <0F>J<EFBFBD>J<EFBFBD>t<EFBFBD>{<7B>{<7B>1<EFBFBD>~<7E> &<26><1D><12>
rc <0C>
<00>Vf*\P!\4P4pMCVP R4'dVP R4^,p\ \V44p\V4\4P8XgQh\V\V4\4P4pRP\\V44\\V444pVPRR4#)a
Return a "hashed" form of the hostname, as used by OpenSSH when storing
hashed hostnames in the known_hosts file.
:param str hostname: the hostname to hash
:param str salt: optional salt to use when hashing
(must be 20 bytes long)
:return: the hashed hostname as a `str`
rn<00>|z|1|{}|{}<7D>
<EFBFBD>)<0F>os<6F>urandomr<00> digest_sizero<00>splitrr r+r<00>digest<73>formatr r<00>replace)r <00>salt<6C>hmac<61>hostkeys&& rrp<00>HostKeys.hash_hosts<><00><00> <10><<3C><15>:<3A>:<3A>d<EFBFBD>f<EFBFBD>0<>0<>1<>D<EFBFBD><13><EFBFBD><EFBFBD>u<EFBFBD>%<25>%<25><1B>z<EFBFBD>z<EFBFBD>#<23><EFBFBD>q<EFBFBD>)<29><04><1E>q<EFBFBD><14>w<EFBFBD>'<27>D<EFBFBD><12>4<EFBFBD>y<EFBFBD>D<EFBFBD>F<EFBFBD>.<2E>.<2E>.<2E>.<2E>.<2E><13>D<EFBFBD>!<21>H<EFBFBD>+<2B>t<EFBFBD>,<2C>3<>3<>5<><04><1C>#<23>#<23>A<EFBFBD>k<EFBFBD>$<24>&7<>$8<>!<21>K<EFBFBD><04><M<>:N<>O<><07><16><EFBFBD><EFBFBD>t<EFBFBD>R<EFBFBD>(<28>(rrxr@)rbrcrdre<00>__doc__rr#rr:rkrjr-ryrKrQrZrWr^rHr<><00> staticmethodrprfrg<00>rhs@rrr#sm<00><><00><00> <08>
 <20> <<3C>4<>@"<22>&A0<>F<15> 3<>$<1B> <14> <20><13> !<21> P<01><13><13> <12>)<29><12>)rrc<00>&a<00>]tRtRtoRtRtVtR#)<05>InvalidHostKeyi3c<08>.<00>WnW nW3VnR#r@)r1<00>exc<78>args)rr1r<>s&&&rr<00>InvalidHostKey.__init__4s<00><00><18> <09><16><08><19>K<EFBFBD><04> r)r<>r<>r1N)rbrcrdrerrfrgr<>s@rr<>r<>3s<00><><00><00> <20> rr<>c<00>Na<00>]tRtRtoRtR Rlt]R
Rl4tRtRt Rt
Vt R#) ri:zB
Representation of a line in an OpenSSH-style "known hosts" file.
Nc<08>H<00>VRJ;'dVRJVnWnW nR#r@)<03>validrr)rrrs&&&rr<00>HostKeyEntry.__init__?s$<00><00><1F>t<EFBFBD>+<2B>B<>B<>#<23>T<EFBFBD>/<2F><04>
<EFBFBD>"<22><0E><16>rc <0C><00>\R4p\P!RV4p\V4^8d%RpVP VP W!44R#VR,pVwrgpVPR4p\ \V44p T!T\P!Yy44# \Pdp
\Y4hRp
?
ii;i \d%TP RP T44R#i;i)a<>
Parses the given line of text to find the names for the host,
the type of key, and the key data. The line is expected to be in the
format used by the OpenSSH known_hosts file. Fields are separated by a
single space or tab.
Lines are expected to not have leading or trailing whitespace.
We don't bother to check for comments or empty lines. All of
that should be taken care of before sending the line to us.
:param str line: a line from an OpenSSH known_hosts file
zparamiko.hostkeysz | z8Not enough fields found in known_hosts in line {} ({!r})N:N<>N<>,zUnable to handle key of type {})r
<00>rer<65>r+<00>infor<6F>rr <00>binascii<69>Errorr<72>r<00>from_type_stringr ) <0B>clsr1r0<00>log<6F>fields<64>msg<73>namesr<73>r<00> key_bytesr"s &&& rr,<00>HostKeyEntry.from_lineDs<><00><00><19>,<2C>-<2D><03><13><18><18>&<26>$<24>'<27><06> <0E>v<EFBFBD>;<3B><11>?<3F>L<>C<EFBFBD> <0F>H<EFBFBD>H<EFBFBD>S<EFBFBD>Z<EFBFBD>Z<EFBFBD><06>-<2D> .<2E><17><17><02><1A><06>%<25><1C><05><13><15> <0B> <0B>C<EFBFBD> <20><05> *<2A>
$<24>A<EFBFBD>c<EFBFBD>F<EFBFBD>+<2B>I<EFBFBD> <18><16>u<EFBFBD>d<EFBFBD>3<>3<>H<EFBFBD>H<>I<> I<><49> <18>~<7E>~<7E> *<2A> <20><14>)<29> )<29><> *<2A><>
<1E> <18> <10>H<EFBFBD>H<EFBFBD>6<>=<3D>=<3D>h<EFBFBD>G<> H<><17>  <18>s*<00>7B)<00> C<00>)C<03>> C <03> C<03>+D<03>?Dc <0C><><00>VP'd]RPRPVP4VPP 4VPP 44#R#)z<>
Returns a string in OpenSSH known_hosts file format, or None if
the object is not in a valid state. A trailing newline is
included.
z {} {} {}
r<EFBFBD>N)r<>r<><00>joinrrr<00>
get_base64rPs&rr8<00>HostKeyEntry.to_lineqsU<00><00> <10>:<3A>:<3A>:<3A><1F>&<26>&<26><13><08><08><14><1E><1E>(<28><14><08><08>!<21>!<21>#<23><14><08><08>#<23>#<23>%<25><0E> <0E>
rc<08>N<00>RPVPVP4#)z<HostKeyEntry {!r}: {!r}>)r<>rrrPs&r<00>__repr__<5F>HostKeyEntry.__repr__s<00><00>*<2A>1<>1<>$<24>.<2E>.<2E>$<24>(<28>(<28>K<>Kr)rrr<>)NNr@) rbrcrdrer<>r<00> classmethodr,r8r<>rfrgr<>s@rrr:s5<00><><00><00><08><17>
<11>*<18><11>*<18>X <14>L<01>Lrr)<1A>base64rrr<>r<>r<><00>collections.abcr<00>hashlibrr<>r<00> paramiko.pkeyrr <00> paramiko.utilr
r r r <00>paramiko.ssh_exceptionrr<00> Exceptionr<6E>r<00>rr<00><module>r<>sS<00><01>(,<2C><0F> <09> <09>*<2A><18><15>/<2F>B<>B<>/<2F>M)<29>~<7E>M)<29>` <20>Y<EFBFBD> <20>FL<01>FLr