transfer files with telnet

transfer files with telnet

Solve the loss of libcrypto.so.1.0.1e and cause ssh to fail to connect

libcrypto.so.1.0.1e is lost, ssh cannot be connected, and commands such as wget, yum, scp, etc. cannot be used. What should I do at this time? Telnet can be used for file transfer. In the following two steps

1. Create a temporary server with python and send files for telnet access

import socket
import base64
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()

Second, execute the following commands in sequence

telnet 102.200.200.202 10005 |tee > temp.txt
tail -n +4 temp.txt > temp2.txt
base64 -d < temp2.txt |tee >libcrypto.so.1.0.1e.so

The ip address above is just an example. Remember to replace it with your own.

Principle description

Only telnet can communicate with the outside world, then the file can be converted into text and output to the telnet side, and then written to the file and finally decoded back to binary. Everyone should know that base64 is used to convert binary to text, so I won't say more.

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324132922&siteId=291194637