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
Assume the availability of a function named oneMore. This function receives an integer and returns one more than its parameter.
jek_recluse [69]

Answer:

oneMore(oneMore(oneMore(oneMore(oneMore(0)))))

Explanation:

  • As a function has been explained which when given an integer results as a next integer. oneMore(given-integer)= next integer
  • As we are restricted to use 0 only and can't use operators like + - * /.
  • We have to obtain a value 5
  • So doing step-by-step:

             (oneMore(0))=1

             (oneMore(oneMore(0)))=2

             (oneMore(oneMore(oneMore(0))))=3

             (oneMore(oneMore(oneMore(oneMore(0)))))=4

             oneMore(oneMore(oneMore(oneMore(oneMore(0)))))=5

7 0
2 years ago
Which of the following tasks would a database administrator perform ? A identify computer security photos, B. Make sure protocol
sattari [20]
B.) Make sure protocols are in place and are being followed. 


Good luck, hope this helps! (:
6 0
3 years ago
What is the benefit of the load balancing logic to end-user?
Alborosie

Answer:

<em>It can minimize response time, and minimize the costs for the end user.</em>

Explanation

Load balancing is a form of workload distribution across several computers or resources. It allows each segment of the system to process a smaller task, minimizing respond time, helping to avoid overload, and contributing to optimize resource use.

6 0
3 years ago
What are the names of first generation computers?
KengaRu [80]
EDSAC is the first computer ever
8 0
3 years ago
How can you skillfully use the internet for research
elena-s [515]

By looking up your research on websites that have (.org) or wikipedia for answers u might have to find information

6 0
3 years ago
Other questions:
  • Which of the following statements is true?
    14·1 answer
  • How many buttons does a gamecube controller have?
    7·1 answer
  • If you wanted to search for emails containing the word advanced and prevent emails containing the word new from appearing in the
    14·1 answer
  • You are the CISO of a company and you need to create logging policies. Please review NIST SP800-92, specifically sections 4–3 th
    12·1 answer
  • For what purpose is keylogging software used? a. To automatically translate input to another language as the user enters data b.
    10·1 answer
  • Write an algorithm that accepts two numbers,
    7·1 answer
  • What is a device driver​
    13·2 answers
  • How can I master networking my home/business computer(s) - Tv's - iot devices and make the whole system as secure as possible?
    12·1 answer
  • can i get an access code for free online? if yes, what website is it so i can get a free access code?​
    15·1 answer
  • What is computer viras? Loist 2 preventive measures against it​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!