telnet 傳輸文件

用python創建個臨時服務器,發送文件供telnet訪問

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()

  

依次執行下面命令

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

  

上面的ip地址是個例子瞎寫的。記得換成你自己的。

原理說明

只有telnet能與外界通信,那麼可以把文件轉成文本形式輸出到telnet端,再寫入文件 最後反解回二進制。 二進制轉文本用base64大家應該都知道就不多說了。

 

https://my.oschina.net/u/218540/blog/761380

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章