辅导案例-CSCI-353-Assignment 2

  • May 15, 2020

CSCI-353: Programming Assignment 2 Due on Oct 20th, 11:59 p.m. ————————————————————————————————— The goal of this assignment is to give you hands-on experience developing tools for network traffic management. In this assignment, you will use RAW sockets to generate network traffic. Develop a ping tool to send periodic ping messages to the specified IP address and compute the estimated round trip time (RTT) based on the received response times. The program will need to use RAW sockets. More information about RAW sockets is located at (​http://sock-raw.org/papers/sock_raw​). ​You must develop this assignment using Python 3.5+ ——————————————————————————————————————- Command Line Input: >pinger -p “payload” -c count -d destination -l logfile Command Line Arguments: ❖ -p: the string to include in the payload. E.g. “Hello World” ❖ -c: the number of packets used to compute RTT. Should default to 10 if no count is given. ❖ -d: the destination IP of the ping message ❖ -l: the logfile to store debug information. This is an optional input When the program is run without any command line arguments, the program should print usage instructions and exit. The logfile generated will not be used to grade the assignment. Note: When you have difficulty running the program using the input format above, you may use “>sudo python (py for Windows) pinger.py ….” and please note that in your README. ——————————————————————————————————————- Example: >[[email protected]:~] sudo pinger –p “hello” –c 4 -d 206.190.36.45 >Pinging 206.190.36.45 with 5 bytes of data “hello” >Reply from 206.190.36.45: bytes=5 time=69ms TTL=47 >Reply from 206.190.36.45: bytes=5 time=70ms TTL=47 >Reply from 206.190.36.45: bytes=5 time=69ms TTL=47 >Reply from 206.190.36.45: bytes=5 time=69ms TTL=47 >Ping statistics for 206.190.36.45: Packets: Sent = 4, Received =4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 69ms, Maximum = 70ms, Average = 69ms ——————————————————————————————————————- You will need to create the echo request packet sent to the destination IP. The format is as follows, the number in parenthesis is the length in bytes: Type(8), Code(8), Checksum(16), ID(16), Sequence Number(16), Data(Variable) You may use the following links as an aid to implement checksum, as well as lecture slides: 1. http://www.binarytides.com/raw-socket-programming-in-python-linux/ 2. http://opensourceforu.com/2015/03/a-guide-to-using-raw-socket s/ To calculate RTT, you will need to time when you send and when you receive the packet. ——————————————————————————————————————- Grading: We will test your pinger against the ping command in the terminal. Example output of that is as follows: $ ping google.com PING google.com (172.217.4.174): 56 data bytes 64 bytes from 172.217.4.174: icmp_seq=0 ttl=56 time=6.966 ms 64 bytes from 172.217.4.174: icmp_seq=1 ttl=56 time=3.668 ms 64 bytes from 172.217.4.174: icmp_seq=2 ttl=56 time=3.824 ms 64 bytes from 172.217.4.174: icmp_seq=3 ttl=56 time=5.643 ms — google.com ping statistics — 4 packets transmitted, 4 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 3.668/5.025/6.966/1.363 ms (Your terminal output for ping may differ based on the operating system) Your pinger should output RTT statistics within 3ms or 10% of the terminal ping statistics, whichever is greater, over the course of 100 pings. E.g. if the average ping according to the terminal is 6ms, yours should output that the average ping is between 3ms and 9ms. You will be graded based on the number of passed test cases. ——————————————————————————————————————- Code and Collaboration Policy You can discuss the assignment and coding strategies with your classmates. However, your solution must be coded and written by yourself. Please refer to the plagiarism policy in the course syllabus. The submissions will be run through code similarity tests. Any flagged submissions will result in a failing score. Keeping your code private is your responsibility. Submission Instructions You can develop and test your code on your own machines. Create a compressed tar file that includes a README and the source code. To submit, create a folder called LASTNAME_FIRSTNAME with the above files. Tar the folder LASTNAME_FIRSTNAME. Submit the tar file on blackboard. The README must contain: your USC ID, compiling instructions, additional notes on usage if needed. You must use Python 3.5+. Make sure you add the directives to support direct execution. The directory structure should look like this: LASTNAME_FIRSTNAME ->Pinger.py ->README.txt

LATEST POSTS
MOST POPULAR

ezAce多年来为广大留学生提供定制写作、留学文书定制、语法润色以及网课代修等服务,超过200位指导老师为您提供24小时不间断地服务。