Overview
* When you craft TCP packets with Scapy, the underlying OS will not recognize the initial SYN packet and will reply with a RST packet. To mitigate this you need to set the following Iptables rule:
iptables -A OUTPUT -p tcp --tcp-flags RST RST -j DROP
from scapy.all import * Imports all scapy libraries ls() List all available protocols lsc() List all scapy functions conf Show/set scapy config IP(src=RandIP()) Generate random src IPs Ether(src=RandMAC()) Generate random src MACs ip=IP(src="1.1.1.1",dst="2.2.2.2") Specify IP parameters tcp=TCP(dport="443") Specify TCP parameters data="TCP data" Specify data portion packet=ip/tcp/data Create IP()/TCP() packet packet.show() Display packet configuration send(packet,count=1) Send 1 packet @ layer 3 sendp(packet,count=2) Send 2 packets @ layer 2 sendpfast(packet) Send faster using tcpreply sr(packet) Send 1 packet & get replies srl(packet) Send only return 1st reply for i in range(0,1000): send (packet) Send (packet) 1000 times sniff(count=100,iface=eth0) Sniff 100 packets on eth0Top - Home