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]
4 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]4 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
Ms. Myers commented that _____ she slept in at the hotel was better than _____ she slept in at home.
nirvana33 [79]
The bed/ the bed is the answer
6 0
3 years ago
A binary floating-poi Select 3 true statements about Python primitive types.
IRISSAK [1]

The true statements about Python primitive types.

  • 32-bit integer type (a.k.a. int32) can represent integer value from -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)
  • A binary floating-point method is used to represent fractions in binary numbers.
  • The decimal number 0.1 cannot be expressed without error in binary floating-point format.

<h3>What are  Python primitive types?</h3>

The  Python primitive types is known to be made up of four primitive data types which are:

  • Integer.
  • Float.
  • String.
  • Boolean.

Note that The true statements about Python primitive types.

  • 32-bit integer type (a.k.a. int32) can represent integer value from -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)
  • A binary floating-point method is used to represent fractions in binary numbers.
  • The decimal number 0.1 cannot be expressed without error in binary floating-point format.

Learn more about Python from

brainly.com/question/26497128

#SPJ1

7 0
2 years ago
Define the term editing​
Harrizon [31]

Answer:

editing is a word file mean making changes in the text contain is a file. or a word file is one of the most basic ms office word operation.

8 0
3 years ago
Which of the following is used by a seller to deceive a buyer? a. bait and switch b. contest c. display d. introductory offer
notka56 [123]
The answer to this question is A. bait and switch.
4 0
4 years ago
Read 2 more answers
Every javafx main class __________. group of answer choices implements javafx.application.applicatio extends javafx.application.
sergiy2304 [10]

Two concepts central to JavaFX are a stage and a scene.

5 0
2 years ago
Other questions:
  • Which statement describes borders and shading?
    11·2 answers
  • Suppose a computer has 16-bit instructions. The instruction set consists of 32 different operations. All instructions have an op
    7·1 answer
  • Joe sends a scathing e-mail to his boss regarding increased work hours. Joe tries to deny sending the e-mail, but is unable to d
    9·1 answer
  • Do you need internet to play xbox one
    14·1 answer
  • Peter wants to protect a confidential document by using a password. He wants to use an asterisk and an ampersand symbol in his p
    10·1 answer
  • End-user computer refers to a group of end users working together to manage their interactions with a computer.
    10·1 answer
  • Analyze the following recursive method and indicate which of the following will be true.
    7·1 answer
  • What is one purpose of an essay’s conclusion paragraph?
    13·1 answer
  • What is the final step when creating an appointment to ensure that the content of the appointment is stored in Outlook?
    13·1 answer
  • Backup software creates backups and prevents you from losing all your data, so would backup software be considered an applicatio
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!