#!/usr/local/bin/python2
from scapy.all import *
os.system("iptables -A OUTPUT -p tcp -o eth0 --sport 1:65535 --tcp-flags RST RST -j DROP")
def packet(pkt):
if pkt[TCP].flags == 2:
print('SYN packet detected port : ' + str(pkt[TCP].sport) + ' from IP Src : ' + pkt[IP].src)
send(IP(dst=pkt[IP].src, src=pkt[IP].dst)/TCP(dport=pkt[TCP].sport, sport=pkt[TCP].dport,ack=pkt[TCP].seq + 1, flags='SA'))
sniff(iface="eth0", prn=packet, filter="tcp[0xd]&18=2",count=100)
os.system("iptables -D OUTPUT -p tcp -o eth0 --sport 1:65535 --tcp-flags RST RST -j DROP")
Forked from zbetcheckin/show_all_your_ports_as_open.md
Created
June 24, 2017 18:24
-
-
Save system123/b8582b0f13543c0770d0078055066df4 to your computer and use it in GitHub Desktop.
Fun Python & Scapy script that will answer 'SYN ACK' to any TCP 'SYN' packet received on any port
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment