Search code examples
python-3.xscapy

Is it possible to send TCP packet to a specific port with scapy's send function?


I am trying to send and receive an TCP packet with data on it. My current line of code for sending is:

send(IP(src="1.1.1.1",dst="1.2.3.4")/TCP()/"Test")

How would I specify a Port


Solution

  • I have an simple idea:

    port = random.randint(48620, 49150)
    

    If you want to know what is port, go to:

    https://www.techtarget.com/searchnetworking/definition/port-number

    Thanks