-
Notifications
You must be signed in to change notification settings - Fork 80
/
darkscrape.py
executable file
·83 lines (69 loc) · 2.39 KB
/
darkscrape.py
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python3
import subprocess as subp
import requests
from modules.file import choose_file
from modules.url import parse_url
R = '\033[31m' # red
G = '\033[32m' # green
C = '\033[36m' # cyan
W = '\033[0m' # white
VERSION = '1.6'
def banner():
banner = r'''
______ _ _____
| _ \ | | / ___|
| | | |__ _ _ __| | _\ `--. ___ _ __ __ _ _ __ ___
| | | / _` | '__| |/ /`--. \/ __| '__/ _` | '_ \ / _ \
| |/ / (_| | | | </\__/ / (__| | | (_| | |_) | __/
|___/ \__,_|_| |_|\_\____/ \___|_| \__,_| .__/ \___|
| |
|_|'''
print(G + banner + W)
print(R + "Created By :- " + G + "Hacker Destination" +W)
print(R + "Version :- " + G + VERSION + W + '\n')
session = requests.session()
session.proxies = {}
session.proxies['http'] = 'socks5h://localhost:9050'
session.proxies['https'] = 'socks5h://localhost:9050'
def service():
"""
Ensures Tor service is running before proceeding
"""
print('\n' + C + "[>] Checking for tor service..." + W + '\n')
cmd = 'systemctl is-active tor.service'
co = subp.Popen(cmd, shell=True,stdout=subp.PIPE).communicate()[0]
if 'inactive' in str(co):
print(R + '[!] Tor Service Not Running..' + W + '\n')
print(R + '[>] Tor Service is Required for this Script...')
exit()
else:
print(C + "[>] Tor Service is Running..." + W + '\n')
def scrap():
r = session.get("http://icanhazip.com").text
print(R + '[+]' + G + ' Connected to Tor...')
print(R + '[+]' + G + ' Your Tor IP -> {}'.format(r))
def main():
"""
Presents options for scraping from single URL or file type
"""
choice = '0'
while choice == '0':
print(R + '[+] ' + G + 'Choose the File Format:-' + W)
print(R + '[1] ' + G + 'Scrape From File' + W)
print(R + '[2] ' + G + 'Scrape From Single URL' + W + '\n')
choice = input(G + '[+]' + C + " Enter Option No. -> " + W)
if choice == "1":
choose_file()
elif choice == "2":
parse_url()
else:
print('\n' + R + "[!] I don't understand your choice." + W + '\n')
return main()
try:
banner()
service()
scrap()
main()
except KeyboardInterrupt:
print('\n' + R + '[!]' + R + ' Keyboard Interrupt.' + W)
exit()