r/pythonhelp • u/Appropriate-Help7622 • Dec 20 '22
Stealth Port Scanner with Scapy and Python
I am doing a college assignment right now and am writing code in python to build a "Stealth Port Scanner with Scapy and Python". This is quite difficult for me so I am hoping for help. I did 11/41 subsections, but I think I messed up somewhere. What should I do differently? Below I send the code and a link of tasks: https://ibb.co/1dYk970
target = input("Adres IP: ")Registered_Ports = range(1023)
open_ports = []
def scanport(port):port = RandShort()conf.verb = 0SYNACKpkt = sr1(IP(dst=target) / TCP(sport=srcport, dport=port, flags="S", timeout=0.5))flags = SYNACKpkt.getlayer(TCP).flagsif flags == SYNACKpkt:return Trueelse:return FalseSynPkt1 = IP() / TCP()SynPkt1.haslayer(TCP)1SynPkt2 = IP() / UDP()SynPkt2.haslayer(TCP)0