1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ugo [173]
3 years ago
8

Statement: There are two files. One file, "badIP_list.txt" has a listing of known bad IP addresses. These addresses were extract

ed from Talos Threat Hunting listings for 26 Jul 2018. The second file, "server_logs.txt", is a listing of IP addresses pulled off of your firewall logs, representing computers which have attempted entry into your network through network services, such as http, ssh and ftp. You will find which bad actors have attempted to enter your network for the purpose of tuning your firewalls and IDS's. Challenge: Write a program which reads in both files and checks the IP addresses from your server logs against the know bad IP's. If there is a match, write the bad IP address to a file titled "filter_list.txt". List unique IP's, do not list duplicates. Also, at the end of the "filter_list.txt" there should be a total of "Known bad IP's detected", and the percentage of IP addresses from your logs which are bad. (Divide the number of bad IP's by the number of total IP's)
Computers and Technology
1 answer:
lapo4ka [179]3 years ago
5 0

Answer:

See explaination

Explanation:

SOURCE CODE IN PYTHON:

inp=open('badIP_list.txt', 'r') #opening file for input

badIPs=[i.rstrip('\n') for i in inp.readlines()] #reading bad IPs

inp.close() #closing file

inp=open('server_logs.txt', 'r') #opening file for input

IPs=[i.rstrip('\n') for i in inp.readlines()] #reading all IPs from log

inp.close() #closing file

uniqueBadIPs=[] #to store unique bad IPs

countBadIPs=0 #to store count of bad IPs

countIPs=0 #to store count of all IPs

for IP in IPs: #iterating through the log of IPs

if IP in badIPs: #checking if IP is bad

countBadIPs+=1

if IP not in uniqueBadIPs: #checking if bad IP is unique

uniqueBadIPs.append(IP)

countIPs+=1

out=open('filter_list.txt', 'w') #opening file for output

out.write('_________________________________________________________\n')

out.write('Date : 26/07/2018\nName : Last, First\nMajor: CS\n\n')

out.write('Server logs contained these known bad IP addresses:\n')

for IP in uniqueBadIPs: #output the unique bad IPs

out.write(IP+'\n')

out.write('\n')

out.write('Total unique known bad IP\'s detected:\n'+str(len(uniqueBadIPs))+'\n\n')

out.write('Percentage of bad IP addresses in server logs:\n{:.2f}%\n'.format(countBadIPs*100/countIPs))

out.write('_________________________________________________________')

out.close() #closing file

You might be interested in
which of the following is a component of a rope-rewind starter system? a. a recoil spring c. an air vane governor b. a wrist pin
Zinaida [17]
"Recoil spring" is the one among the following choices given in the question that is <span>a component of a rope-rewind starter system. The correct option among all the options that are given in the question is the first option or option "a". I hope that this is the answer that has come to your desired help.</span>
3 0
3 years ago
What type of code do computers typically use to operate? A. CSS B. HTML 5 C. HTML D. Binary
Rufina [12.5K]

Answer:

Pretty Sure its Binary

Explanation:

HTML is used for websites.

4 0
3 years ago
Read 2 more answers
What is generation of computer ?​
mestny [16]

I HOPE THIS INFORMATION WILL HELP YOU A LOT......

3 0
3 years ago
Read 2 more answers
What is the maximum number of communication paths for a team of twenty people?
MAVERICK [17]
Each of the 20 people has 19 other people to communicate to. If you add that all up you get 20*19 paths, but then each path is counted twice (back and forth), so we divide this by 2. 20*19/2 = 190.

The general forumula is n(n-1)/2
6 0
3 years ago
( Game Design) The companies who get video games out to consumers are called:
Bad White [126]

Answer:

They are called video game publishers

Explanation:

A video game publisher is responsible for financing a video game’s development, marketing, and release of the game to the consumers. Basically, they are the ones who manage the business end of the gaming field. If the video game company is well established, the publishers of that company will be the ones to distribute while some smaller companies will hire distribution companies to distribute the games for them

3 0
3 years ago
Other questions:
  • Which computer is the best for video cutting?
    11·2 answers
  • When was unicode invented?
    13·1 answer
  • The code below is supposed to display the name and score for the student with the highest score one time before the program ends
    12·1 answer
  • What formula would you enter to add the values in cells b4, b5, and b6?
    10·1 answer
  • Grace is performing a penetration test against a client's network and would like to use a tool to assist in automatically execut
    13·2 answers
  • What is one pass of a coding sequence called?​
    13·2 answers
  • You're working in a table that has three columns and five rows. Since the first row will be a header row, you want it to span al
    6·1 answer
  • In science class, Patricia is giving a presentation on the different types of flowers in her community. As part of her presentat
    5·1 answer
  • Shira’s Shoes sold 875,000 pairs of sandals in June, which was 70% of the total number of shoes sold. How many shoes did the com
    14·2 answers
  • assume there are K sorted lists, each of n/k elements. We want to merge them into a single sorted list of n elements. Give an op
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!