telnet传输文件

python2.7写入代码样例:

import socket
import base64
##port和filename根据实际情况可以修改为适合你的
port     = 10005
filename = 'libcrypto.so.1.0.1e'

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('0.0.0.0', port))
sock.listen(5)
while True:
    connection,address = sock.accept()
    try:
        content = 'hello'
        f = file(filename)
        content = base64.b64encode(f.read())
        connection.sendall(content.strip())
        connection.close()
    except socket.timeout:
        print 'time out'
    connection.close()

 

 

telent输出代码样例:

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

  

posted @ 2020-01-06 16:05  大浪淘沙、  阅读(638)  评论(0)    收藏  举报