Reputation: 47
I have a Python script that does the following in the stated order:
It is part 4 I am struggling with. The following code works up until stage 4 which stops the rest from working:
#!/usr/bin/python
import re
import sys
import cgi
# Compare the cleaned up list of IPs against the botwatch
# list and output the results to a new file.
new_list = set()
outfile = open("final_downloads/malicious_ips", "w")
for line in open("final_downloads/ip_list_clean", "r")
if line in open("/var/www/botwatch.txt", "r")
outfile.write(line)
new_list.add(line)
outfile.close()
Any ideas as to why the last section does not work? In fact, it stops the whole thing from working.
Upvotes: 0
Views: 132
Reputation: 23595
You are missing some colons in the last section. Try this:
new_list = set()
outfile = open("final_downloads/malicious_ips", "w")
for line in open("final_downloads/ip_list_clean", "r"):
if line in open("/var/www/botwatch.txt", "r"):
outfile.write(line)
new_list.add(line)
outfile.close()
Upvotes: 1