Created
May 5, 2015 21:35
-
-
Save kevrom/f239c303ec961fb7b929 to your computer and use it in GitHub Desktop.
Botspam in IRC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
allArr = [] | |
botArr = [] | |
excludes = [ | |
'<--', | |
'-->', | |
'is now known as', | |
'Mode #/r/' | |
] | |
with open("irclog.txt") as infile: | |
for line in infile: | |
line = line.split('\t') | |
if ('@timebot2' == line[1]) or (line[2].startswith('!')): | |
botArr.append(line) | |
else: | |
excludeLine = False | |
for i in excludes: | |
if line[2] in i: excludeLine = True | |
if not excludeLine: | |
allArr.append(line) | |
print(len(allArr)) | |
print(len(botArr)) | |
print("Percentage of botspam : ", len(botArr) / len(allArr)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment