Skip to content

Instantly share code, notes, and snippets.

@kevrom
Created May 5, 2015 21:35
Show Gist options
  • Save kevrom/f239c303ec961fb7b929 to your computer and use it in GitHub Desktop.
Save kevrom/f239c303ec961fb7b929 to your computer and use it in GitHub Desktop.
Botspam in IRC
#!/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