-
-
Notifications
You must be signed in to change notification settings - Fork 144
/
ransomwatch.py
executable file
·337 lines (322 loc) · 10.5 KB
/
ransomwatch.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
🧅 👀 🦅 👹
ransomwatch
does what it says on the tin
'''
import os
import sys
import json
import argparse
from datetime import datetime
import parsers
import geckodrive
from markdown import main as markdown
from sharedutils import striptld
from sharedutils import openjson
from sharedutils import checktcp
from sharedutils import siteschema
from sharedutils import socksfetcher
from sharedutils import getsitetitle
from sharedutils import getonionversion
from sharedutils import checkgeckodriver
from sharedutils import sockshost, socksport
from sharedutils import stdlog, dbglog, errlog, honk
if len(sys.argv) == 1:
print(
'''
_______________ |*\_/*|________
| ___________ | ||_/-\_|______ |
| | | | | | | |
| | 0 0 | | | | 0 0 | |
| | - | | | | - | |
| | \___/ | | | | \___/ | |
| |___ ___| | | |___________| |
|_____|\_/|_____| |_______________|
_|__|/ \|_|_.............💔.............._|________|_
/ ********** \ / ********** \
/ ************ \ ransomwhat? / ************ \
-------------------- --------------------
'''
)
parser = argparse.ArgumentParser(description='👀 🦅 ransomwatch')
parser.add_argument("--name", help='provider name')
parser.add_argument("--location", help='target web location (full URI)')
parser.add_argument(
"mode",
help='operation to execute',
choices=['add', 'scrape', 'parse', 'markdown']
)
args = parser.parse_args()
if args.mode == ('add') and (args.name is None or args.location is None):
parser.error("operation requires --name and --location")
if args.location:
if args.location.endswith('.onion'):
siteinfo = getonionversion(args.location)
if siteinfo[0] is None:
parser.error("location does not appear to be a v2 or v3 onionsite")
else:
errlog("location does not appear to be an onionsite, assuming clearnet")
def creategroup(name, location):
'''
create a new group for a new provider - added to groups.json
'''
location = siteschema(location)
insertdata = {
'name': name,
'captcha': bool(),
'parser': bool(),
'javascript_render': bool(),
'meta': None,
'locations': [
location
],
'profile': list()
}
return insertdata
def checkexisting(provider):
'''
check if group already exists within groups.json
'''
groups = openjson("groups.json")
for group in groups:
if group['name'] == provider:
return True
return False
def scraper():
'''main scraping function'''
groups = openjson("groups.json")
# iterate each provider
for group in groups:
stdlog('ransomwatch: ' + 'working on ' + group['name'])
# iterate each location/mirror/relay
for host in group['locations']:
stdlog('ransomwatch: ' + 'scraping ' + host['slug'])
host['available'] = bool()
'''
only scrape onion v3 unless using headless browser, not long before this will not be possible
https://support.torproject.org/onionservices/v2-deprecation/
'''
if host['enabled'] is False:
stdlog('ransomwatch: ' + 'skipping, this host has been flagged as disabled')
continue
if host['version'] == 3 or host['version'] == 0:
if group['javascript_render'] is True:
stdlog('ransomwatch: ' + 'using javascript_render (geckodriver)')
response = geckodrive.main(host['slug'])
else:
stdlog('ransomwatch: ' + 'using standard socksfetcher')
response = socksfetcher(host['slug'])
if response is not None:
stdlog('ransomwatch: ' + 'scraping ' + host['slug'] + ' successful')
filename = group['name'] + '-' + striptld(host['slug']) + '.html'
name = os.path.join(os.getcwd(), 'source', filename)
stdlog('ransomwatch: ' + 'saving ' + name)
with open(name, 'w', encoding='utf-8') as sitesource:
sitesource.write(response)
sitesource.close()
dbglog('ransomwatch: ' + 'saving ' + name + ' successful')
host['available'] = True
host['title'] = getsitetitle(name)
host['lastscrape'] = str(datetime.today())
host['updated'] = str(datetime.today())
dbglog('ransomwatch: ' + 'scrape successful')
with open('groups.json', 'w', encoding='utf-8') as groupsfile:
json.dump(groups, groupsfile, ensure_ascii=False, indent=4)
groupsfile.close()
dbglog('ransomwatch: ' + 'groups.json updated')
else:
errlog('ransomwatch: ' + 'task on ' + group['name'] + ' failed to return a response')
else:
errlog('ransomwatch: ' + 'scrape failed - ' + host['slug'] + ' is not a v3 onionsite')
def adder(name, location):
'''
handles the addition of new providers to groups.json
'''
if checkexisting(name):
stdlog('ransomwatch: ' + 'records for ' + name + ' already exist, appending to avoid duplication')
appender(args.name, args.location)
else:
groups = openjson("groups.json")
newrec = creategroup(name, location)
groups.append(dict(newrec))
with open('groups.json', 'w', encoding='utf-8') as groupsfile:
json.dump(groups, groupsfile, ensure_ascii=False, indent=4)
stdlog('ransomwatch: ' + 'record for ' + name + ' added to groups.json')
def appender(name, location):
'''
handles the addition of new mirrors and relays for the same site
to an existing group within groups.json
'''
groups = openjson("groups.json")
success = bool()
for group in groups:
if group['name'] == name:
group['locations'].append(siteschema(location))
success = True
if success:
with open('groups.json', 'w', encoding='utf-8') as groupsfile:
json.dump(groups, groupsfile, ensure_ascii=False, indent=4)
else:
honk('cannot append to non-existing provider')
if args.mode == 'scrape':
stdlog('ransomwatch: ' + 'starting scrape job on all active group locations')
if not checktcp(sockshost, socksport):
honk("socks proxy unavailable and required to fetch onionsites!")
if checkgeckodriver() is False:
honk('ransomwatch: ' + 'geckodriver not found in $PATH and required for scraping')
scraper()
stdlog('ransomwatch: ' + 'scrape run complete')
if args.mode == 'add':
adder(args.name, args.location)
if args.mode == 'markdown':
markdown()
stdlog('ransomwatch: ' + 'markdown run complete')
if args.mode == 'parse':
parsers.suncrypt()
parsers.blackbyte()
parsers.spook()
parsers.karma()
parsers.suncrypt()
parsers.lorenz()
parsers.lockbit2()
parsers.arvinclub()
parsers.avaddon()
parsers.xinglocker()
parsers.clop()
parsers.revil()
parsers.everest()
parsers.conti()
parsers.pysa()
parsers.nefilim()
parsers.mountlocker()
parsers.babuk()
parsers.ransomexx()
parsers.cuba()
parsers.pay2key()
parsers.azroteam()
parsers.lockdata()
parsers.blacktor()
parsers.darkleakmarket()
parsers.blackmatter()
parsers.payloadbin()
parsers.groove()
parsers.quantum()
parsers.atomsilo()
parsers.lv()
parsers.snatch()
parsers.midas()
parsers.rook()
parsers.cryp70n1c0d3()
parsers.mosesstaff()
parsers.alphv()
parsers.nightsky()
parsers.vicesociety()
parsers.pandora()
parsers.stormous()
parsers.leaktheanalyst()
parsers.blackbasta()
parsers.onyx()
parsers.mindware()
parsers.ransomhouse()
parsers.cheers()
parsers.lockbit3()
parsers.yanluowang()
parsers.omega()
parsers.bianlian()
parsers.redalert()
parsers.daixin()
parsers.icefire()
parsers.donutleaks()
parsers.sparta()
parsers.qilin()
parsers.shaoleaks()
parsers.mallox()
parsers.royal()
parsers.projectrelic()
parsers.medusa()
parsers.nokoyawa()
parsers.dataleak()
parsers.monti()
parsers.play()
parsers.karakurt()
parsers.unsafeleak()
parsers.freecivilian()
parsers.vendetta()
parsers.ransomblog_noname()
parsers.abyss()
parsers.moneymessage()
parsers.dunghill_leak()
parsers.trigona()
parsers.crosslock()
parsers.akira()
parsers.cryptnet()
parsers.ragroup()
parsers.eightbase()
parsers.malas()
parsers.blacksuit()
parsers.rancoz()
parsers.darkrace()
parsers.rhysida()
parsers.noescape()
parsers.cactus()
parsers.knight()
parsers.incransom()
parsers.metaencryptor()
parsers.cloak()
parsers.ransomedvc()
parsers.ciphbit()
parsers.threeam()
parsers.cryptbb()
parsers.losttrust()
parsers.hunters()
parsers.meow()
parsers.dragonforce()
parsers.werewolves()
parsers.malekteam()
parsers.insane()
parsers.slug()
parsers.ransomblog_noname2()
parsers.alphalocker()
parsers.ransomhub()
parsers.lockbit3fs()
#parsers.mogilevich()
parsers.blackout()
parsers.donex()
parsers.killsecurity()
parsers.redransomware()
parsers.darkvault()
parsers.hellogookie()
parsers.apt73()
parsers.qiulong()
parsers.embargo()
parsers.dAn0n()
parsers.underground()
parsers.spacebears()
parsers.flocker()
parsers.arcusmedia()
parsers.trinity()
parsers.sensayq()
parsers.cicada3301()
parsers.pryx()
parsers.braincipher()
parsers.FOG()
parsers.handala()
parsers.eldorado()
parsers.vanirgroup()
parsers.ransomcortex()
parsers.madliberator()
parsers.dispossessor()
parsers.nullbulge()
parsers.lynx()
parsers.helldown()
parsers.orca()
parsers.nitrogen()
parsers.sarcoma()
parsers.interlock()
parsers.hellcat()
parsers.termite()
parsers.kairos()
parsers.bashe()
stdlog('ransomwatch: ' + 'parse run complete')