Skip to content

Commit 2e5dea3

Browse files
committed
2to3
1 parent c426e65 commit 2e5dea3

8 files changed

+34
-26
lines changed

Readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ For more overview, check out the blog post [here.](http://raidersec.blogspot.com
66

77
## Dependencies
88
[python-twitter](https://code.google.com/p/python-twitter/)
9+
$ pip install python-twitter
910
$ pip install beautifulsoup4
1011
$ pip install requests
1112

lib/Paste.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from regexes import regexes
1+
from .regexes import regexes
22
import settings
33

44

@@ -8,7 +8,7 @@ def log(text):
88
99
'''
1010
if text:
11-
print text.encode('utf-8')
11+
print(text.encode('utf-8'))
1212
with open(settings.log_file, 'a') as logfile:
1313
logfile.write(text.encode('utf-8') + '\n')
1414

lib/Pastebin.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from Site import Site
2-
from Paste import Paste
1+
from .Site import Site
2+
from .Paste import Paste
33
from bs4 import BeautifulSoup
4-
import helper
4+
from . import helper
55
from time import sleep
66
from settings import SLEEP_PASTEBIN
77
from twitter import TwitterError
@@ -25,7 +25,7 @@ def __init__(self, last_id=None):
2525

2626
def update(self):
2727
'''update(self) - Fill Queue with new Pastebin IDs'''
28-
print '[*] Retrieving Pastebin ID\'s'
28+
print('[*] Retrieving Pastebin ID\'s')
2929
results = BeautifulSoup(helper.download(self.BASE_URL + '/archive')).find_all(
3030
lambda tag: tag.name == 'td' and tag.a and '/archive/' not in tag.a['href'] and tag.a['href'][1:])
3131
new_pastes = []
@@ -38,7 +38,7 @@ def update(self):
3838
break
3939
new_pastes.append(paste)
4040
for entry in new_pastes[::-1]:
41-
print '[+] Adding URL: ' + entry.url
41+
print('[+] Adding URL: ' + entry.url)
4242
self.put(entry)
4343

4444
def monitor(self, bot, l_lock, t_lock):
@@ -53,7 +53,7 @@ def monitor(self, bot, l_lock, t_lock):
5353
with l_lock:
5454
tweet = helper.build_tweet(paste)
5555
if tweet:
56-
print tweet
56+
print(tweet)
5757
with t_lock:
5858
helper.record(tweet)
5959
try:

lib/Pastie.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from Site import Site
2-
from Paste import Paste
1+
from .Site import Site
2+
from .Paste import Paste
33
from bs4 import BeautifulSoup
4-
import helper
4+
from . import helper
55
from time import sleep
66
from settings import SLEEP_PASTIE
77
from twitter import TwitterError
@@ -25,7 +25,7 @@ def __init__(self, last_id=None):
2525

2626
def update(self):
2727
'''update(self) - Fill Queue with new Pastie IDs'''
28-
print '[*] Retrieving Pastie ID\'s'
28+
print('[*] Retrieving Pastie ID\'s')
2929
results = [tag for tag in BeautifulSoup(helper.download(
3030
self.BASE_URL + '/pastes')).find_all('p', 'link') if tag.a]
3131
new_pastes = []
@@ -39,7 +39,7 @@ def update(self):
3939
break
4040
new_pastes.append(paste)
4141
for entry in new_pastes[::-1]:
42-
print '[+] Adding URL: ' + entry.url
42+
print('[+] Adding URL: ' + entry.url)
4343
self.put(entry)
4444

4545
def monitor(self, bot, l_lock, t_lock):
@@ -56,7 +56,7 @@ def monitor(self, bot, l_lock, t_lock):
5656
with l_lock:
5757
tweet = helper.build_tweet(paste)
5858
if tweet:
59-
print tweet
59+
print(tweet)
6060
with t_lock:
6161
helper.record(tweet)
6262
try:

lib/Site.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from Queue import Queue
1+
from queue import Queue
22
import requests
33
import time
44
from requests import ConnectionError
@@ -52,4 +52,4 @@ def clear(self):
5252
self.queue = []
5353

5454
def list(self):
55-
print '\n'.join(url for url in self.queue)
55+
print('\n'.join(url for url in self.queue))

lib/Slexy.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from Site import Site
2-
from Paste import Paste
1+
from .Site import Site
2+
from .Paste import Paste
33
from bs4 import BeautifulSoup
4-
import helper
4+
from . import helper
55
from time import sleep
66
from settings import SLEEP_SLEXY
77
from twitter import TwitterError
@@ -25,7 +25,7 @@ def __init__(self, last_id=None):
2525

2626
def update(self):
2727
'''update(self) - Fill Queue with new Slexy IDs'''
28-
print '[*] Retrieving Slexy ID\'s'
28+
print('[*] Retrieving Slexy ID\'s')
2929
results = BeautifulSoup(helper.download(self.BASE_URL + '/recent')).find_all(
3030
lambda tag: tag.name == 'td' and tag.a and '/view/' in tag.a['href'])
3131
new_pastes = []
@@ -38,7 +38,7 @@ def update(self):
3838
break
3939
new_pastes.append(paste)
4040
for entry in new_pastes[::-1]:
41-
print '[+] Adding URL: ' + entry.url
41+
print('[+] Adding URL: ' + entry.url)
4242
self.put(entry)
4343

4444
def monitor(self, bot, l_lock, t_lock):
@@ -53,7 +53,7 @@ def monitor(self, bot, l_lock, t_lock):
5353
with l_lock:
5454
tweet = helper.build_tweet(paste)
5555
if tweet:
56-
print tweet
56+
print(tweet)
5757
with t_lock:
5858
helper.record(tweet)
5959
try:

lib/helper.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ def download(url, headers=None):
2020
try:
2121
response = r.get(url).text
2222
except requests.ConnectionError:
23-
print '[!] Critical Error - Cannot connect to Pastebin'
23+
print('[!] Critical Error - Cannot connect to Pastebin')
2424
sleep(5)
25-
print '[!] Retrying...'
25+
print('[!] Retrying...')
2626
response = self.download(url)
2727
return response
2828

@@ -41,7 +41,7 @@ def log(text):
4141
log(text): Logs message to both STDOUT and to .output_log file
4242
4343
'''
44-
print text
44+
print(text)
4545
with open(settings.log_file, 'a') as logfile:
4646
logfile.write(text + '\n')
4747

@@ -73,5 +73,5 @@ def build_tweet(paste):
7373
tweet += ' Dionaea Honeypot Log'
7474
tweet += ' #infoleak'
7575
if paste.num_emails > 0:
76-
print paste.emails
76+
print(paste.emails)
7777
return tweet

settings.py-example

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# settings.py
22

3+
# Twitter Settings
4+
CONSUMER_KEY = 'your_consumer_key'
5+
CONSUMER_SECRET = 'your_consumer_secret'
6+
ACCESS_TOKEN = 'your_access_token'
7+
ACCESS_TOKEN_SECRET = 'your_access_token_secret'
8+
39
# Thresholds
410
EMAIL_THRESHOLD = 20
511
HASH_THRESHOLD = 30
@@ -11,4 +17,5 @@ SLEEP_PASTEBIN = 15
1117
SLEEP_PASTIE = 30
1218

1319
# Other configuration
20+
tweet_history = "tweet.history"
1421
log_file = "output.log"

0 commit comments

Comments
 (0)