Created
September 16, 2019 15:39
-
-
Save duongphuhiep/729e3508bddcf99de010f307f91ae125 to your computer and use it in GitHub Desktop.
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
#!/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