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.oV**