Skip to content

Commit 04576fe

Browse files
committedApr 14, 2013
Added site functionality
1 parent 068eaf2 commit 04576fe

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎lib/Paste.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from .regexes import regexes
22
import settings
33
import logging
4+
import re
45

56
class Paste(object):
67
def __init__(self):
@@ -14,6 +15,7 @@ class Paste: Generic "Paste" object to contain attributes of a standard paste
1415
self.num_hashes = 0
1516
self.text = None
1617
self.type = None
18+
self.sites = None
1719
self.db_keywords = 0.0
1820

1921
def match(self):
@@ -34,6 +36,8 @@ def match(self):
3436
self.hashes = regexes['hash32'].findall(self.text)
3537
self.num_emails = len(self.emails)
3638
self.num_hashes = len(self.hashes)
39+
if self.num_emails > 0:
40+
self.sites = list(set([re.search('@(.*)$', email).group(1).lower() for email in self.emails]))
3741
for regex in regexes['db_keywords']:
3842
if regex.search(self.text):
3943
logging.debug('\t[+] ' + regex.search(self.text).group(1))

‎lib/Site.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from Queue import Queue
22
import requests
33
import time
4+
import re
45
from pymongo import MongoClient
56
from requests import ConnectionError
67
from twitter import TwitterError
@@ -79,7 +80,7 @@ def monitor(self, bot, t_lock):
7980
logging.info(tweet)
8081
with t_lock:
8182
if USE_DB:
82-
self.db_client.save({
83+
self.db_client.save({
8384
'pid' : paste.id,
8485
'text' : paste.text,
8586
'emails' : paste.emails,

0 commit comments

Comments
 (0)
Please sign in to comment.