Qf&[ ddlZddlZddlZddlmZddlZejeddgZ dZ dZ e dgZ e dgZe d gZe d gZe d gZe dgZe d gZe d gZe dgZe dgZe dgZe dgZe dgZe dgZe dgZe dgZe dgZe dgZe dgZe dgZ e dgZ!e dgZ"e dgZ#e dgZ$e dgZ%e dgZ&e dgZ'e d gZ(e d!gZ)e d"gZ*e d#gZ+e d$gZ,e d%gZ-e d&gZ.e d'gZ/e d(gZ0e d)gZ1e d*gZ2e d+gZ3e d,gZ4e dgZ5e d-gZ6e d.gZ7e d/gZ8e d0gZ9e d1gZ:e d2gZ;e d3gZ<e d4gZ=e d5gZ>e d6gZ?e d7gZ@e d8gZAe d9gZBe d:gZCe d;gZDe dgZGe d?gZHe d@gZIe dAgZJe dBgZKe dCgZLe dDgZMe dEgZNe dFgZOe dGgZPe dHgZQe dIgZRe dgZSe dgZTeUedJr ejZWn ejZWGdKdZYdLZZedMk(reZyy)NN) monotonic) )removeTelnetr r !"#$%&'()*+,-./01 PollSelectorceZdZ dZddej fdZdej fdZdZdZ dZ dZ d Z d Z d Zdd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZddZdZ dZ!y) rNrc t|_||_||_||_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ ||j|||yy)Nr) DEBUGLEVEL debuglevelhostporttimeoutsockrawqirawqcookedqeofiacseqsbsbdataqoption_callbackopenselfrPrQrRs 0/opt/alt/python312/lib64/python3.12/telnetlib.py__init__zTelnet.__init__s %         #   IIdD' * rMc d|_|st}||_||_||_t j d|||tj||f||_ y)Nrztelnetlib.Telnet.open) rW TELNET_PORTrPrQrRsysauditsocketcreate_connectionrSr]s r_r\z Telnet.opensX D    )4t<,,dD\7C rMc& |jyNcloser^s r___del__zTelnet.__del__s1 rMc |jdkDrEtd|jd|jdd|rt||zyt|yy)NrzTelnet(,z): )end)rOprintrPrQ)r^msgargss r_rrz Telnet.msgsG ??Q  dii; EcDj!c rMc ||_yrh)rO)r^rOs r_set_debuglevelzTelnet.set_debuglevels %rMc| |j}d|_d|_d|_d|_|r|j yy)NTrMr)rSrWrXrYrj)r^rSs r_rjz Telnet.close s;#yy    JJL rMc |jSrh)rSrks r_ get_socketzTelnet.get_sockets7yyrMc8 |jjSrh)rSfilenorks r_rzz Telnet.filenosGyy!!rMc t|vr!|jtttz}tjd|||j d||j j |y)Nztelnetlib.Telnet.writezsend %r)IACreplacercrdrrrSsendall)r^buffers r_writez Telnet.writesU &=^^CS1F *D&9 F# &!rMcR t|}|j|jj|}|dk\r*||z}|jd|}|j|d|_|S| t |z}t 5}|j |tj|js|j|rtdt|j|z }|j|j|jj||}|dk\r3||z}|jd|}|j|d|_|cdddS|t z }|dkrn |jsddd|jS#1swY|jSxYwNr)len process_rawqrVfind_time_TelnetSelectorregister selectors EVENT_READrWselectmax fill_rawqread_very_lazy)r^matchrRnibufdeadlineselectors r_ read_untilzTelnet.read_until*s  J  LL  e $ 6!A,,r"C<<+DLJ  w(H  (   dI$8$8 9hh??7+As4<<023ANN$%%' ))%3AAvaC"ll2A.'+||AB'7 "  &&0G{hh"""$$#"""$$sC F!FF&c |j|js-|j|j|js-|j}d|_|SNrM)rrWrrVr^rs r_read_allzTelnet.read_allOsNE (( NN     ((ll  rMc |j|jsE|js9|j|j|js |js9|j}d|_|Sr)rrVrWrrs r_ read_somezTelnet.read_someYs^ ,,txx NN     ,,txxll  rMc |j|jsM|jr=|j|j|js|jr=|j Srh)rrW sock_availrrrks r_read_very_eagerzTelnet.read_very_eagerhs^  ((t0 NN     ((t0""$$rMc& |j|jse|jsY|jrI|j |j|js|js|jrI|j Srh)rrVrWrrrrks r_ read_eagerzTelnet.read_eagervsj  ,,txxDOO4E NN     ,,txxDOO4E""$$rMcD |j|jSrh)rrrks r_ read_lazyzTelnet.read_lazys$  ""$$rMcx |j}d|_|s#|jr|js td|S)NrMztelnet connection closed)rVrWrTEOFErrorrs r_rzTelnet.read_very_lazys9 ll txx 56 6 rMc. |j}d|_|Sr)rZrs r_ read_sb_datazTelnet.read_sb_datas ll  rMc ||_yrh)r[)r^callbacks r_set_option_negotiation_callbackz&Telnet.set_option_negotiation_callbacks W'rMcZ ddg} |jr|j}|jsP|tk(r3|dk(r9|tk7r ||j |z||j <b|xj|z c_nSt |jdk(r|ttttfvr|xj|z c_d|_|tk(r!||j |z||j <n|tk(rd|_d|_ n,|tk(r#d|_|j|dz|_ d|d<|jr#|j|j|t ni|j#dt%|znJt |jdk(r1|jdd}d|_|}|ttfvr|j#d|tk(xrdxsd t%||jr|j|j||n|jj'ttz|zn|ttfvr~|j#d|tk(xrd xsd t%||jr|j|j||n)|jj'ttz|z|jr|j*|dz|_|j|dz|_ y#t($rd|_d|_YHwxYw) NrMrrzIAC %d not recognizedrz IAC %s %dDODONTWILLWONT)rT rawq_getcharrXtheNULLr|rYrrrrrSBrZSEr[rSNOOPTrrordr~rrV)r^rccmdopts r_rzTelnet.process_rawqs Cj; ))%%'{{G| G| Cx'*477|a'7DGG   q( %*RtT22 q(  "%DKCx'*477|a'7DGG 7&'DG+.DL"W&'DG+/<<#a&+@DL%(CF//!00AuE !HH%?t ,4K2F?o))v||c!f, ||c!f,  DKDG sKLL*)L*c8 |js"|j|jrt|j|j|jdz}|jdz|_|jt |jk\rd|_d|_|S)NrrMr)rTrrWrrUr)r^rs r_rzTelnet.rawq_getcharsx yy NN xx IIdjjA .ZZ!^ ::TYY 'DIDJrMc |jt|jk\rd|_d|_|jj d}|j d|| |_|j|z|_y)NrMr2zrecv %r)rUrrTrSrecvrrrWrs r_rzTelnet.fill_rawqse ::TYY 'DIDJiinnR  C GIIO rMc t5}|j|tjt |j dcdddS#1swYyxYwr)rrrrboolr)r^rs r_rzTelnet.sock_availsE;  (   dI$8$8 9*+ , ,  s :AAc< tjdk(r|jyt5}|j |t j |j tjt j  |jD]\}}|j|ura |j}|s(tjj|jdtjj!u|jtjustjj#j%d}|s dddy|j|#t$rtdYdddywxYw#1swYyxYw)Nwin32(*** Connection closed by remote host ***ascii)rcplatform mt_interactrrrrstdinrfileobjrrrqstdoutrdecodeflushreadlineencode)r^rkeyeventstextlines r_interactzTelnet.interacts=G <<7 "       (   dI$8$8 9   cii)=)= >#+??#4KC{{d*##'??#4D JJ,,T[[-ABJJ,,. 1"yy113::7C#"% ) )& 4($5 (#!"LM" ) )# sCA4F%E/5F8A)F"0FF/FFFFFc ddl}|j|jd tjj }|sy|j |jdB)Nrr)_threadstart_new_threadlistenerrcrrrr)r^rrs r_rzTelnet.mt_interact6sQ2  399%%'D JJt{{7+ , rMc |j}|r/tjj |j dntjja#t$rtdYywxYw)Nrr)rrrqrcrrrr)r^datas r_rzTelnet.listener@skL (   W!56   " @A sA$$A;:A;c( d}|dd}tt|}|D]/}t||dr|sddl}|j ||||<1| t |z}t 5}|j|tj|js|j|D]e}||j|j}|s$|j} |jd| } |j| d|_ ||| fccdddS|'|j|} t z }| s|dkrn|j!|jsddd|j#} | s|jrt$dd| fS#1swY2xYw)Nsearchr)rangerhasattrrecompilerrrrrrWrrrVrprrrr) r^listrRrindicesrrrmerreadys r_expectz Telnet.expectMs *AwD "A47H-9**T!W-Q  w(H  (   dI$8$8 9hh!!# AQt||4AEEG#||BQ/'+||AB'7 !1d|+ ! !!&$OOG4E&0G "Q;!$ #hh(""$ND$/ s*A"F 9FAFFc|Srhrrks r_ __enter__zTelnet.__enter__s rMc$|jyrhri)r^typevalue tracebacks r___exit__zTelnet.__exit__s  rMrh)"__name__ __module__ __qualname__rSre_GLOBAL_DEFAULT_TIMEOUTr`r\rlrrrurjrxrzrrrrrrrrrrrrrrrrrrrrrrMr_rrs3h D q77+0 )G)GD" %" "#%J  % % %  (E-N$$", )4- #6 prMc d}tjddrVtjddk(r@|dz}tjd=tjddrtjddk(r@d}tjddrtjd}d}tjddrtjd} t|}t 5}|j||j||d|jdddy#t$rt j |d}YjwxYw#1swYyxYw) Nrrz-d localhostrtcpg?)rR) rcargvint ValueErrorre getservbynamerrur\r)rOrPrQportstrtns r_testrs J ((12,388A;$.\ HHQK ((12,388A;$. D xx|xx{ D xx|((1+ 8w D6D7D43D47E__main__)[rcrertimerrwarnings _deprecatedr__all__rNrbbytesr|rrrrrrNOPDMBRKIPAOAYTECELGArBINARYECHORCPSGANAMSSTATUSTMRCTENAOLNAOPNAOCRDNAOHTSNAOHTDNAOFFDNAOVTSNAOVTDNAOLFDXASCIILOGOUTBMDETSUPDUP SUPDUPOUTPUTSNDLOCTTYPEEORTUIDOUTMRKTTYLOC VT3270REGIMEX3PADNAWSTSPEEDLFLOWLINEMODEXDISPLOC OLD_ENVIRONAUTHENTICATIONENCRYPT NEW_ENVIRONTN3270EXAUTHCHARSETRSPCOM_PORT_OPTIONSUPPRESS_LOCAL_ECHOTLSKERMITSEND_URL FORWARD_X PRAGMA_LOGON SSPI_LOGONPRAGMA_HEARTBEATEXOPLrrrJrSelectSelectorrrrrMr_r@sF #Xg. *   cU| cU| cU| cU| cU| * SEl SEl SEl SEl SEl SEl SEl SEl SEl SEl SEl s aSz QCj QCj aSz s A3Z aSz aSz aSz t t t t t t t t t B4[ RDk tbT{ t rd  RDk bT{ t tbT{  rd  bT{ t rd  "; ";RDk t +RDk + rd  + RDk+RDk RDk t "; 2$K cU| C5\ #< se  qc   9n%,,O..Oyyx6 zFrM