forked from jorhelp/Ingram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_ingram.py
executable file
·70 lines (57 loc) · 2.44 KB
/
run_ingram.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
#! /usr/bin/env -S python3 -Bu
# coding: utf-8
# @Auth: Jor<jorhelp@qq.com>
# @Date: Wed Apr 20 00:17:30 HKT 2022
# @Desc: Ingram
import argparse
import warnings
warnings.filterwarnings("ignore")
from scan import scanner
from utils.base import printf
from utils.wechat import send_msg
def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--in_file', type=str, required=True, help='the targets will be scan')
parser.add_argument('--out_path', type=str, default='results', help='the path where results saved')
parser.add_argument('--send_msg', action='store_true', help='send finished msg to you (by wechat or email)')
parser.add_argument('--all', action='store_true', help='scan all the modules of [hik_weak, dahua_weak, cve_...]')
parser.add_argument('--hik_weak', action='store_true')
parser.add_argument('--dahua_weak', action='store_true')
parser.add_argument('--cctv_weak', action='store_true')
parser.add_argument('--hb_weak', action='store_true')
parser.add_argument('--cve_2021_36260', action='store_true')
parser.add_argument('--cve_2021_33044', action='store_true')
parser.add_argument('--cve_2017_7921', action='store_true')
parser.add_argument('--cve_2020_25078', action='store_true')
parser.add_argument('--th_num', type=int, default=80, help='the processes num')
parser.add_argument('--masscan', action='store_true', help='run massscan sanner')
parser.add_argument('--port', type=str, default=80, help='same as masscan port')
parser.add_argument('--rate', type=int, default=5000, help='same as masscan rate')
args = parser.parse_args()
return args
def run(args):
# readme
flag, count = False, 0
colors = ['red', 'cyan', 'green', 'blue', 'pink', 'white']
with open('README.md', 'r') as f:
for line in f:
if line.startswith('#'): break
if line.startswith('```'):
if flag:
print()
count += 1
flag = not flag
elif flag: printf(line.rstrip(), color=colors[count % len(colors)], bold=True)
# scan
if args.masscan:
scn = scanner.MasScaner(args.in_file, args.out_path)
scn(args)
else:
scn = scanner.CameraScanner(args.in_file, args.out_path)
scn(args)
# finished
if args.send_msg:
send_msg(f"{scn.scanner_name} finished!")
if __name__ == '__main__':
args = get_parser()
run(args)