Skip to content

Instantly share code, notes, and snippets.

@duongphuhiep
Created September 16, 2019 15:39
Show Gist options
  • Save duongphuhiep/729e3508bddcf99de010f307f91ae125 to your computer and use it in GitHub Desktop.
Save duongphuhiep/729e3508bddcf99de010f307f91ae125 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from scapy.all import *
from random import randint
if __name__ == '__main__':
ports = [21,22,23,25,80,443,8080]
results = []
for port in ports:
(ans, unans) = sr(IP(dst="172.16.42.12", src="172.16.42.45")/TCP(dport=port, sport=randint(1024,65530)))
if ans[0][1][TCP].flags == 18:
results += [port]
print results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment