Question: Task 2.2: Spoofing When a normal user sends out a packet, operating systems usually do not allow the user to set all the fields in

 Task 2.2: Spoofing When a normal user sends out a packet,operating systems usually do not allow the user to set all the

Task 2.2: Spoofing When a normal user sends out a packet, operating systems usually do not allow the user to set all the fields in the protocol headers (such as TCP, UDP, and IP headers). OSes will set most of the fields, while only allowing users to set a few fields, such as the destination IP address, the destination port number, etc. However, if users have the root privilege, they can set any arbitrary field in the packet headers. This is called packet spoofing, and it can be done through raw sockets. Raw sockets give programmers the absolute control over the packet construction, allowing programmers to construct any arbitrary packet, including setting the header fields and the payload. Using raw sockets is quite straightforward; it involves four steps: . (1) create a raw socket, . (2) set socket option, . (3) construct the packet, and . (4) send out the packet through the raw socket. There are many online tutorials that can teach you how to use raw sockets in C programming. You can also refer to the example from CSC231. We show a simple skeleton of such a program. int sd; struct sockaddr_in sin; char buffer [1024] ; // You can change the buffer size /* Create a raw socket with IP protocol. The IPPROTO_RAW parameter * tells the sytem that the IP header is already included; * this prevents the OS from adding another IP header. */ sd = socket (AF_INET, SOCK_RAW, IPPROTO_RAW) ; if (sd

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!