telnet file transfer

Sample python2.7 written into the code:

Socket Import 
Import Base64 
## Port and filename may be modified according to the actual situation for you 
Port = 10005 
filename = 'libcrypto.so.1.0.1e' 

our sock = socket.socket (socket.AF_INET, socket.SOCK_STREAM) 
sock.bind ( ( '0.0.0.0', Port)) 
sock.listen (. 5) 
the while True: 
    Connection, sock.accept address = () 
    the try: 
        Content = 'Hello' 
        F = File (filename) 
        Content = base64.b64encode (reached, f.read ()) 
        connection.sendall (content.strip ()) 
        Connection.close () 
    the except socket.timeout: 
        Print 'Time OUT' 
    Connection.close ()

 

 

telent Output Code Sample:

telnet 102.200.200.202 10005 |tee > temp.txt
base64 -d < temp.txt |tee >out.ovpn

  

Guess you like

Origin www.cnblogs.com/bai2018/p/12156825.html