Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please create with PYTHON You will be creating a program extractIP.py which will read from a file called wireShark.txt and extract all the ip addresses

Please create with PYTHON

You will be creating a program extractIP.py which will read from a file called wireShark.txt and extract all the ip addresses which can be of the format:

1,2 or 3 digits. 1, 2 or 3 digits.1, 2, or 3 digits. 1,2,3 digits Here are some examples of valid IPv4 addresses:

10.0.0.1, 12.123.123.123, 126.255.255.254, 191.255.255.254, 192.168.1.1, 239.255.255.255

And you will output them to another file called IPAddresses.txt , one per line, listing source and destination.

Example:

Source Destination

12.123.123.123 123.123.123.123

Requirements:

  • You will read from a file called wireShark.txt which will be located in the same directory as your code
  • You will write to a file called IPAddresses.txt which will be located in the same directory as your code
  • All files will be opened and closed correctly.
  • You will not use regex to parse the file. Instead, you will check the characters individually
  • Your loops will be structured correctly.
  • You will use one or more functions which will take a parameter or more, and return a value
  • You will use lists
  • You will use the split function
  • You will write a function called CheckLine(currentLine) which will check if currentline is of the format:

No. Time Source Destination Protocol Length Info

Once you have identified this particular line, you will know that the following line has the IP addresses for source and destination in the second and third elements.

1 0.000000 192.168.1.180 239.255.255.250 SSDP 372 NOTIFY * HTTP/1.1

  • Your functions and main code will be in separate sections of your program.
  • Your IP addresses will be formatted in IPv4 format, i.e. 1, 2 or 3 digits .1, 2 or 3 digits.1,2 or 3 digits. 1,2,3 digits
  • It is ok to reuse the code you wrote for past homework including homework 4.

Example:

File wireShark.txt was opened.

File IPAddress.txt was opened.

File IPAddress.txt was closed.

File wireShark.txt was closed.

wireShark.txt should contain the following IP Addresses:

Source Destination

192.168.1.180 239.255.255.250

192.168.1.51 146.20.112.65

192.168.1.51 146.20.112.65

146.20.112.65 192.168.1.51

146.20.112.65 192.168.1.51

146.20.112.65 192.168.1.51

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

How is a veto overridden?

Answered: 1 week ago

Question

What is the 1 s complement of 1 3 1 0

Answered: 1 week ago