Created
December 2, 2015 10:40
-
-
Save alan-mushi/188639febbfab479dd06 to your computer and use it in GitHub Desktop.
SRI TP scapy TCP connect dumb scanner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
ip_dst = "104.16.34.249" | |
for i in range(1, 65536): | |
ans,uns = sr(IP(dst=ip_dst) / TCP(dport=i, flags="S"), timeout=1, retry=-2, verbose=False) | |
try: | |
if ans[0][1].getlayer(TCP).flags & 0x12 == 0x12: | |
print str(i) + " is open" | |
ans.summary() | |
# On ferme la communication | |
sr(IP(dst=ip_dst) / TCP(dport=i, flags="AR"), timeout=10, verbose=False) | |
except AttributeError: | |
print str(i) + " is closed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment