Question: In python. 1. Generate 1000 records with randomly generated valid IP addresses, ports and protocols. Protocols can be a random selection from a list of
In python.
1. Generate 1000 records with randomly generated valid IP addresses, ports and protocols. Protocols can be a random selection from a list of protocols of your choice. Store the records as a list of lists.
2. Scan records (loop) to get a count of each protocol. Use a dictionary to hold the counts. Print the dictionary once the count is complete.
In the dictionary, each key/value pair will be a protocol/count, for example, HTTP : 125, meaning 125 records with the HTTP protocol were found in the scan.
3. Scan records for any source IP addresses from a bad network. The bad network includes any machine on the network of the first record in the list. For example, if the source IP in the first record is 192.56.23.123, then any machine on the 192.56.23 subnet should be considered bad. Print any bad IPs found.
It must use strings, lists, dictionaries, random integers and random choice

Sample record: Source IP Address Source Port Destination IP Address Destination Port Protocol 192.56.23.123 80 112.87.34.143 12388 HTTP Python representation: The record can be represented in Python as a list containing strings. Each item in a list is separated by a comma. [192.56.23.123", "80", "112.87.34.143", "12388", "HTTP] A collection of records can be represented as a list of lists. For example, here is a list containing two lists. [ [192.56.23.123", "80", "112.87.34.143, 12388", "HTTP"] , [192.56.23.123", "80", "112.87.34.137, 12476", "HTTP] ]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
