在接口上创建PCAP或重播流量
ScapyTrafficGenerator的Python项目详细描述
scapy流量发生器的实现
这个包裹是做什么用的?
- 通过创建数据包并保存 用于进一步使用或重放给定数据包的PCAP文件 接口
如何安装
pip install ScapyTrafficGenerator
如何运行
使用-x定义协议
ScapyTrafficGenerator -X http
scapy traffic generators运行时基本参数定义为-r
-F File (can be given multiple times) -i interface to run -s src ip -S src PORT -d dst ip -D dst port -m scr mac -M dst mac -X Method(integer 1-6) (1= GET, 2 = PUT, 3 = POST, 4 = GET, 5= PUT, 6 = POST) *methods 1,2,3 are for HTTP and 4,5,6 are for FTP -E Encoding (integer 2-6) (2=CHUNKED, 3 = GZIP, 4 = CHUNKED+GZIP, 5 = MULTIPART single form, 6 = MULTIPART multi form) *encoding for http only, 2-4 is for GET only, 5-6 is for PUT/POST only. #example ScapyTrafficGenerator -X http -r '-X 1 -F /files/Malicious_DOC.doc -i eth0 -s 1.1.1.1 -S 33333 -d 2.2.2.2 -D 80 -m 12:31:25:15:a1:55 -M 12:31:25:15:a1:2b' ### not specifying a field will default to a random value (file should default to none)
其他特定于http的参数
--host <host> specify a host -u <url> specify a request url -B swap destination ip to use ipv6 -b swap source ip to use ipv6 -R <response string> set server response (HTTP/1.1 200 OK is default) -L <dir> location to transfer files (instead of just one file it will sent whole dir) -N <server name> specify server name --gretunnel encapsulate traffic as gre -A swap all default ip to use ipv6 -l http pipeline files (if one file is in request it will download it multiple times) -x <packets per second> specify packets per second to replay traffic -j <request header> add a request header -k <response header> add a response header -v <vlan tag id> specify a vlan tag id -O <offset> specify how long ago packet occured -V <Version> http version (default HTTP/1.1) -U <useragent string> specify particular user agent for windows/linux/etc (default curl/7.35.0) -T timeout >> repeat replaying traffic until time
附加的ftp特定参数
-c command source port -C command destination port -B swap destination ip to use ipv6 -b swap source ip to use ipv6 -L <dir> location to transfer files (instead of just one file it will sent whole dir) -N <server name> specify server name -A swap all default ip to use ipv6 -x <packets per second> specify packets per second to replay traffic -w specify server diretory -W specify working directory -a use active ftp -v <vlan tag id> specify a vlan tag id -u user password -z <number of segments> specify segmentation -P specify same dataport umougst multiple sessons/segments
其他TCP特定参数
-p <data_from_source:data_response_from_destination> packet data (default="HELLOSERVER:HELLOCLIENT")
其他支持的协议
-DNS -DHCP -ICMP -SMB -SMB2 -HTTPS (with fake data for encrypting files)
要保存为PCAP而不是重播environment vaitable,必须将设置为要将PCAP文件保存到的位置
export CREATE_PCAP_ONLY=\tmp\mypcap.pcap; ScapyTrafficGenerator -X http -r '-i eth1 -s 10.21.21.21 -u "/mybadurl.com"'