In this example we understand how to use scapy and python to create a TCP syn packet. The code is named TCP Syn sender and can be used in scenarios where you need to send a TCP Syn packet programatically.
1. The first line of code imports scapy into the Python file.
2. The second line takes the destination IP address from the user as an input.
3. The third line takes the port number as the input. The port number refers to the destination port number to which the packet has to be send.
4. The fourth line creates a TCP packet.
5. The fifth line assigns the flag in the packer as ‘S’ This signifies a TCP Syn packet.
6. The sixth line assigns the destination port number with the port number recieved from the user in code line 3.
7. The seventh line creates an IP header.
8. The eighth line creates an IP header object.
9. The ninth line associates the destination IP address with the IP address recieved from the user in code line 2.
10.The tenth line associates the source address with 192.168.1.25, which is the sender PC IP address.
11. The eleventh line sends the packet on the network.
The course will teach you how to use Python with scapy to create custom network tools and scripts for various purposes like network testing, protocol testing, automation and more. The course explains with source code and examples of different types of network scripts and tools.