0

I've been doing some work on port scanning. I'm trying to do a SYN scan (send SYN and and cut the cord if I get an SYN-ACK), and the operation worked perfect on single thread.

When trying to run it using eventlet (on a Celery threaded worker), I get the following exception when running it:

Child died unexpectedly. Packets may have not been sent

The following is my code that raises the issue:

    def pscan(dest_ip, dest_port):
        packet = IP(dst=dest_ip) / TCP(dport=int(dest_port), flags='S')
        res = sr1(packet, verbose=False, timeout=1)

        if res and res.haslayer(TCP):
            if res[TCP].flags == 18: # SYN-ACK flag
                return True

        return False

Any thoughts?

The Real Bill
  • 14,884
  • 8
  • 37
  • 39
Den1al
  • 617
  • 1
  • 10
  • 16
  • Try to get some information out of dying child. Was it killed by kernel? Is it possible to get coredump? Most likely, it left Python traceback. – temoto Jul 15 '17 at 04:53
  • How do I get a coredump/traceback information? – Den1al Jul 15 '17 at 12:36
  • Use Google or your favourite search engine to find information on debugging Python programs. – temoto Jul 15 '17 at 13:13
  • Now I get what you've ment regarding traceback. I get only that message. Regarding coredump, WDYM? – Den1al Jul 15 '17 at 17:37
  • I mean use search. You have to do work before you get real error details. scapy child calls some function and it either raises exception or OS kills process. In first case scapy hides useful traceback. If OS kills process, it is possible to configure it to leave coredump. Assuming UNIX-like OS. – temoto Jul 16 '17 at 19:06
  • I really mean web search https://www.google.com/search?q=coredump https://stackoverflow.com/search?q=coredump+python – temoto Jul 18 '17 at 09:03

0 Answers0