Write a Python program named aIP.py which will read data from a file named wireShark.txt and extract all the pairs of source and destination ip addresses and output them in pairs to another file called IPAddresses.txt , one per line, listing source and destination.
Example of output:
Source Destination
192.168.1.180 239.255.255.250
Detailed Requirements:
Key point: if your program splits each line of input it reads and places the resulting tokens in a list, which elements -- 0, 1, 2, 3 or 4 -- contain the text Source and Destination? Once you have identified this particular line, you will know that the following line has the IP addresses for source and destination. When your program splits the next line of input, shown below, and places the resulting tokens in a list, which elements contain the IP addresses?
1 0.000000 192.168.1.180 239.255.255.250 SSDP 372 NOTIFY * HTTP/1.1
wireShark.txt:
Source:
192.168.1.180
Destination: 239.255.255.250
No. Time Source Destination Protocol Length Info
2 0.307821 192.168.1.180 239.255.255.250 SSDP 422 NOTIFY *
HTTP/1.1
Source:
192.168.1.180
Destination: 239.255.255.250
No. Time Source Destination Protocol Length Info
3 0.325254 192.168.1.51 146.20.112.65 TCP 55 51333 → 443 [ACK]
Seq=1 Ack=1 Win=258 Len=1 [TCP segment of a reassembled PDU]
Source:
192.168.1.51
Destination: 146.20.112.65
No. Time Source
Destination Protocol Length Info
4 0.340841 192.168.1.51 146.20.112.65 TCP 55 51349 → 443 [ACK]
Seq=1 Ack=1 Win=255 Len=1 [TCP segment of a reassembled PDU]
Source:
192.168.1.51
Destination: 146.20.112.65
No. Time Source
Destination Protocol Length Info
5 0.359448 192.168.1.51 146.20.112.65 TCP 55 51335 → 443 [ACK]
Seq=1 Ack=1 Win=253 Len=1 [TCP segment of a reassembled PDU]
Source: 192.168.1.51
Destination: 146.20.112.65
No. Time Source
Destination Protocol Length Info
6 0.406275 146.20.112.65 192.168.1.51 TCP 66 443 → 51333 [ACK]
Seq=1 Ack=2 Win=356 Len=0 SLE=1 SRE=2
Source:
146.20.112.65
Destination: 192.168.1.51
No. Time Source
Destination Protocol Length Info
7 0.416052 146.20.112.65 192.168.1.51 TCP 66 443 → 51349 [ACK]
Seq=1 Ack=2 Win=356 Len=0 SLE=1 SRE=2
Source: 146.20.112.65
Destination: 192.168.1.51
No. Time Source Destination Protocol Length Info
8 0.433884 146.20.112.65 192.168.1.51 TCP 66 443 → 51335 [ACK]
Seq=1 Ack=2 Win=356 Len=0 SLE=1 SRE=2
#open output file
with open("ipaddress.txt","w") as out:
#open input file
with open("wireshark.txt", "r") as inp:
#readline from input file
for line in inp:
#split the line
using ' '
obj =
line.split(' ')
if 'Source' in
obj and 'Destination' in obj:
temp = inp.readline().split()
out.write("source \t destination\n")
out.write(temp[2] + "\t" + temp[3] + "\n")
Write a Python program named aIP.py which will read data from a file named wireShark.txt and...
In python I need to extract the below data from a file called wireshark.txt I made the element i'm trying to extract Bold in the 1st frame section. Frame 1, Src:00:14:ee:08:dd:b1, Des:01:00:5e:7f:ff:fa, Type:0x0800 Frame 2, Src:00:14:ee:08:dd:b1, Des:01:00:5e:7f:ff:fa, Type:0x0800 Frame 3, Src:cc:2f:71:3e:ca:a1, Des:14:91:82:36:7a:8d, Type:0x0800 Frame 4, Src:cc:2f:71:3e:ca:a1, Des:14:91:82:36:7a:8d, Type:0x0800 The wireshark.txt file contents: Frame 1: 372 bytes on wire (2976 bits), 372 bytes captured (2976 bits) on interface 0 Ethernet II, Src: WesternD_08:dd:b1 (00:14:ee:08:dd:b1), Dst: IPv4mcast_7f:ff:fa (01:00:5e:7f:ff:fa) Destination: IPv4mcast_7f:ff:fa (01:00:5e:7f:ff:fa)...
In the Wireshark Capture. In frame 126, follow the TCP stream. What is the request that is made to the server? What response does the server give back? Based on these messages and others you can see in the packet capture, what would you say is going on? Is this an attack? If so, what type of attack might it be? No. Time source Destination Protocol Length Info 74 52148 80 SYN] Seq-0 win 29200 Len-0 Mss 1460 SACK PERM...
1. a. In Wireshark, for packet 92, what information in the IP header indicates that the datagram has been fragmented? b. What information in the IP header indicates whether this is the first fragment versus a latter fragment? How long is this IP datagram? 2. a. For packet 93, what information in the IP header indicates that this is not the first data fragment? Are there more fragments? If so, how can you tell? - 0 X IP_traceFile File Edit...
Question 13 5 pts Based on the provided Wireshark Capture File and information contained in Frame # 12: What is the IPv4 address for the destination of the Layer 3 datagram (based on the particular Layer 3 datagram mentioned in instructions of this quiz)? 10.129.61.67 216.58.216.238 134.124.1.234 107.23.244.231 Question 14 5 pts Based on the provided Wireshark Capture File and information contained in Frame # 12: What is the IPv4 address of the source of the Layer 3 datagram (based...
I cant get this python program to read all the unique words in a file. It can only read the number of the unique words in a line. import re import string from collections import Counter # opens user inputted filename ".txt" and (w+) makes new and writes def main(): textname = input("Enter the file to search: ") fh = open(textname, 'r', encoding='utf-8' ) linecount = 0 wordcount = 0 count = {} print("Sumary of the", fh) for line in...
PYTHON write a program that will open a file named data.txt and read each line of the file one at a time. Each line should be printed to the screen along with a line number
6. Write a program to read a text file and produce another text file in which all lines are less than some given length. Make sure and break lines in sensible places; for example, avoid breaking words or putting isolated punctuation marks at the beginning of a line. Please finish the question in C language programming, thank you!
166 Chapter 8: TCP/IP Applications Getting Down to Business The way network communication all those ls and Os) goes in and out of a machine physically is through the NIC (network interface card). The way network communication goes in and out of a machine logically though, is through a program or service. A service is a program that runs in the background, independent of a logon, that provides functionalities to a system. Windows client machines, for instance, have a Workstation...
Write a Python program to read lines of text from a file. For each word (i.e, a group of characters separated by one or more whitespace characters), keep track of how many times that word appears in the file. In the end, print out the top twenty counts and the corresponding words for each count. Print each value and the corresponding words, in alphabetical order, on one line. Print this in reverse sorted order by word count. You can assume...
c++ program8. Array/File Functions Write a function named arrayToFile. The function should accept three arguments: the name of a file, a pointer to an int array, and the size of the array. The function should open the specified file in binary mode, write the contents of the array to the file, and then close the file. Write another function named fileToArray. This function should accept three argu- ments: the name of a file, a pointer to an int array, and the size...