-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpastebin_scraper.py
More file actions
69 lines (60 loc) · 2.05 KB
/
pastebin_scraper.py
File metadata and controls
69 lines (60 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
###############################################################################################################
# Original Author: Jordan Wright
# Modified by: Moez @ CriticalStart
# Version: 1.0
# Usage Example: python pastebin_scraper.py
# Description: This tool monitors Pastebin in real time for data leakage
###############################################################################################################
from lib.Pastebin import Pastebin, PastebinPaste
from time import sleep
from settings import log_file, PRINT_LOG
import threading
import logging
import sys
def monitor():
'''
monitor() - Main function... creates and starts threads
'''
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbose", help="more verbose", action="store_true")
args = parser.parse_args()
level = logging.INFO
if args.verbose:
level = logging.DEBUG
#logging to both stdout and file
file_handler = logging.FileHandler(log_file)
handlers = [file_handler]
if PRINT_LOG:
stdout_handler = logging.StreamHandler(sys.stdout)
handlers.append(stdout_handler)
logging.basicConfig(
level=level,
format='%(asctime)s [%(levelname)s] %(message)s',
handlers=handlers
)
logging.info('Monitoring...')
paste_lock = threading.Lock()
pastebin_thread = threading.Thread(target=Pastebin().monitor, args=[paste_lock])
# changed threading to not be in a for loop
# we're only monitoring one site now - Moe
pastebin_thread.daemon = True
pastebin_thread.start()
# Let threads run
try:
while(1):
sleep(5)
except KeyboardInterrupt:
logging.warning('Stopped.')
if __name__ == "__main__":
# banner
print("""
===================================
PasteBin Scraper
Originally created by Jordan Wright
Modified by Moez @ Critical Start
Version 1.0
===================================
""")
sleep(5)
monitor()