Niv Sardi commited on
Commit
0acb617
1 Parent(s): 6120e5b

add openfish

Browse files
Files changed (1) hide show
  1. python/openfish.py +58 -0
python/openfish.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ import requests
3
+
4
+ import concurrent.futures
5
+ from progress.bar import ChargingBar
6
+
7
+ from common import defaults,mkdir
8
+
9
+ PARALLEL = 20
10
+
11
+ def get(json):
12
+ return requests.post('http://puppet:8000/screenshot',
13
+ json=json)
14
+
15
+ def download_all(feed, n_workers=PARALLEL, dest=defaults.FISH_PATH):
16
+ mkdir.make_dirs([dest])
17
+ res = requests.get(feed)
18
+ with concurrent.futures.ThreadPoolExecutor(max_workers = n_workers) as executor:
19
+ futures = {executor.submit(get, {
20
+ 'url': u,
21
+ 'path': f'''{dest}/{u
22
+ .replace('http://', '')
23
+ .replace('https://', '')
24
+ .replace('/', '_')
25
+ .replace('&', '_')
26
+ .replace('=', '_')
27
+ .replace('?', '_')
28
+ }.png'''
29
+ }): u for u in res.text.split('\n')}
30
+ print(f'will get {len(futures)} domains')
31
+ bar = ChargingBar('Processing', max=len(futures), suffix='%(index)d/%(max)d')
32
+ for f in concurrent.futures.as_completed(futures):
33
+ url = futures[f]
34
+ try:
35
+ ret = f.result()
36
+ except:
37
+ print(f'{url} generated an exception')
38
+ else:
39
+ print(ret)
40
+ bar.next()
41
+ bar.finish()
42
+
43
+ if __name__ == '__main__':
44
+ import argparse
45
+
46
+ parser = argparse.ArgumentParser(description='screenshot openfish open list')
47
+ parser.add_argument('--parallel', metavar='parallel', type=int,
48
+ default=PARALLEL,
49
+ help='number of concurrent jobs')
50
+ parser.add_argument('--feed', metavar='feed', type=str,
51
+ default='https://raw.githubusercontent.com/mitchellkrogza/Phishing.Database/master/phishing-links-ACTIVE-TODAY.txt',
52
+ help='''
53
+ fishing feed to use we recomend
54
+ - https://github.com/mitchellkrogza/Phishing.Database/blob/master/phishing-links-ACTIVE-TODAY.txt
55
+ - https://openphish.com/feed.txt
56
+ ''')
57
+ args = parser.parse_args()
58
+ download_all(args.feed, n_workers=args.parallel)