Changeset 471
- Timestamp:
- 03/31/10 20:08:54 (9 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/honeysnap/ircDecode.py
r461 r471 33 33 34 34 # global bot word list. 35 botprefixes = [".", "-", "!", "\`", "\\", "|"] 36 botcoms = ["die ", "esay ", "flood ", "m ", "me ", "part ", "payment ", "ping ", "s ", "say ", "server ", 37 "services ", "startflood ", "stopflood ", "x ", "antiaction ", "antibold ", "anticolour ", "antinotice ", 38 "antipub ", "antirepeat ", "antireverse ", "antiunderline ", "antiurl ", "autovoice ", "chanserv ", 39 "cycle ", "dynamicexempts ", "dynamicinvites ", "enforcetopiclimit ", "nodesynch ", "locked ", 40 "noop ", "op ", "passive ", "private ", "revenge ", "revengebot ", "secret ", "seen ", "seen ", 41 "shared ", "stats ", "strictop ", "suspended ", "topic ", "userexempts ", "userinvites ", "voice "] 35 botprefixes = ["", "?", ":", ".", "-", "!", "\`", "\\", "|"] 36 botcoms = ["die ", "esay ", "flood ", "m ", "me ", "part ", "payment ", "ping ", "pingstop ", "s ", "say ", "server ", "services ", "startflood ", 37 "stopflood ", "x ", "advscan ", "asc ", "aolspam.", "antiaction ", "antibold ", "anticolour ", "antinotice ", "antipub ", "antirepeat ", "antireverse ", 38 "antiunderline ", "antiurl ", "autovoice ", "carnivore ", "chanserv ", "clone ", "c ", "clonestop ", "cycle ", "c_raw ", "c_mode ", "c_nick ", 39 "c_join ", "c_part ", "c_privmsg ", "c_action ", "c_r ", "c_m ", "c_n ", "c_j ", "c_p ", "c_pm ", "c_a ", "cvar.", "download ", "dl ", "dynamicexempts ", 40 "dynamicinvites ", "ddos.", "enforcetopiclimit ", "email ", "execute ", "findfile ", "ff ", "findfilestopp ", "http.", "icmp ", "icmpflood ", 41 "nodesynch ", "locked ", "noop ", "op ", "passive ", "private ", "rename ", "mv ", "revenge ", "revengebot ", "scanall ", "sa ", "scandel ", "scan.", 42 "scanstop ", "scanstats ", "secret ", "seen ", "seen ", "shared ", "sniffer.", "stats ", "spam.", "syn ", "synstop ", "strictop ", "suspended ", "topic ", 43 "udp ", "udpstop ", "update ", "up ", "userexempts ", "userinvites ", "voice "] 42 44 43 45 botwords = [] … … 92 94 self.words = words 93 95 self.wordlines = [] 94 self.botlines = [] 96 self.botlines = [] 97 self.currenttopicsBotCmd = [] 98 self.currenttopicsKeyword = [] 95 99 self.privcount = 0 96 100 self.dir = "" … … 155 159 self.targets[target] += 1 156 160 #self.ipsearch(c,e) 157 if cmd in [ "privmsg", "pubmsg", "notice", "privnotice"]:161 if cmd in ['privmsg', 'mode', 'quit', 'nick', 'join', 'pubmsg', 'currenttopic', 'topicinfo', 'topic']: 158 162 self.analyzeMsg(c, e) 159 163 … … 196 200 def ipsearch(self, c, e): 197 201 cmd = e.eventtype() 198 if cmd in ['privmsg', 'mode', 'quit', 'nick', 'join', 'pubmsg' ]:202 if cmd in ['privmsg', 'mode', 'quit', 'nick', 'join', 'pubmsg', 'currenttopic', 'topicinfo', 'topic']: 199 203 #srcip = dnet.addr(c.pkt.src) 200 204 srcip = e.src … … 205 209 206 210 def botcmds(self, c, e): 207 """Find lines matching botwords""" 211 """Find lines matching botwords""" 212 if e.eventtype() == 'topicinfo': 213 self.topics(e, 'botcmds') 214 return 208 215 data = ' '.join(e.arguments()) 209 216 matches = [w for w in self.botwords if w in data] 210 217 if len(matches) > 0: 211 self.botlines.append([str(e), matches]) 218 self.botlines.append([str(e), matches]) 219 if e.eventtype() == 'currenttopic': 220 self.currenttopicsBotCmd.append(str(e)) 212 221 213 222 def keywords(self, c, e): 214 """Find lines matching word list""" 223 """Find lines matching word list""" 224 if e.eventtype() == 'topicinfo': 225 self.topics(e, 'keyword') 226 return 215 227 data = ' '.join(e.arguments()) 216 228 matches = [w for w in self.words if w in data] 217 229 if len(matches) > 0: 218 self.wordlines.append([str(e), matches]) 230 self.wordlines.append([str(e), matches]) 231 if e.eventtype() == 'currenttopic': 232 self.currenttopicsKeyword.append(str(e)) 233 234 def topics(self, e, matchtype): 235 """ 236 Find matching currenttopic and topicinfo 237 Store result in self.botlines or self.wordlines (for keyword matches) 238 """ 239 savedtopics = self.currenttopicsBotCmd 240 matchlist = self.botlines 241 if matchtype == 'keyword': 242 savedtopics = self.currenttopicsKeyword 243 matchlist = self.wordlines 244 timecmp = str(e).split(' ')[0].strip() 245 for s in savedtopics: 246 if s.split(' ')[0].strip() == timecmp: 247 matchlist.append([str(e), 'currenttopic']) 219 248 220 249 def analyzeMsg(self, c, e): … … 232 261 else: 233 262 fromuser = e.source() 234 #t = time.asctime(time.localtime(c.ts))235 263 t = e.time 236 264 cmd = e.eventtype() 237 if cmd == "pubmsg" or cmd=="notice" :265 if cmd == "pubmsg" or cmd=="notice" or cmd=="topic": 238 266 channel = e.target() 239 267 if cmd == "privmsg" or cmd=="privnotice": -
trunk/setup.py
r465 r471 23 23 install_requires = [ 24 24 "python-irclib>=0.4.6", 25 "dpkt>=1. 6",25 "dpkt>=1.7", 26 26 ], 27 27 dependency_links = [ 28 "http://dpkt.googlecode.com/files/dpkt-1. 6.tar.gz",28 "http://dpkt.googlecode.com/files/dpkt-1.7.tar.gz", 29 29 ], 30 30 entry_points = {