Skip to content

Instantly share code, notes, and snippets.

@truekonrads
Last active December 25, 2015 18:39
Show Gist options
  • Save truekonrads/bb4c6e0a179cbbd4ba40 to your computer and use it in GitHub Desktop.
Save truekonrads/bb4c6e0a179cbbd4ba40 to your computer and use it in GitHub Desktop.
fake a syn scan
6.7.8.9
2.2.2.2
#!/usr/bin/env python
# usage spoofsynscan.py srcmacpairs.txt dests.txt
# adjust gwmac to the mac of your gw and ports to the ports you want to "scan"
import sys
from scapy.all import *
import random
pairs=[]
gwmac="00:50:56:ff:d1:d1"
ports=[1521,5900,1527]
with file(sys.argv[1],"rb") as f:
for l in f.xreadlines():
ip,srcmac=l.strip().split(" ")
pairs.append([ip,srcmac])
dests=[]
with file(sys.argv[2],"rb") as f:
for l in f.xreadlines():
dests.append(l.strip())
for srcip,srcmac in pairs:
for p in ports:
sendp(Ether(src=srcmac,dst=gwmac)/IP(dst=random.choice(dests),src=srcip)/TCP(dport=p,flags="S"))
1.2.3.4 ff:ff:ff:00:00:00
1.2.2.2 aa:bb:cc:dd:ee:ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment