Repository navigation
Expand file tree
/
Copy pathcmdline.py
More file actions
51 lines (39 loc) · 1.59 KB
/
Copy pathcmdline.py
File metadata and controls
51 lines (39 loc) · 1.59 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
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Parse command line arguments
#
import argparse
import sys
import os
def parse_args():
parser = argparse.ArgumentParser(description='* A simple tool. *\n',
usage='infoScan.py [options]')
group_target = parser.add_argument_group('Targets')
group_target.add_argument('--file', metavar='TargetFile', type=str, default='',
help='Load new line delimited targets from TargetFile')
group_target.add_argument('--domain', metavar='DomainFile', type=str, default='',
help='Load new line delimited targets from DomainFile')
group_http = parser.add_argument_group('HTTP proxy')
group_http.add_argument('--proxy', metavar='Socks5', type=str, default=False, nargs='*',
help='Socks5 proxy. eg : 127.0.0.1:1080')
if len(sys.argv) == 1:
sys.argv.append('-h')
args = parser.parse_args()
check_args(args)
if args.file:
args.input_files = args.file
else:
args.input_files = args.domain
if args.proxy:
args.proxy = {"http": "Socks5://%s"%args.proxy[0],"https": "Socks5://%s"%args.proxy[0]}
return args
def check_args(args):
if not args.file and not args.domain:
msg = 'Args missing! One of following args should be specified \n' \
' --file TargetFile or --domian TargetFile \n'
print(msg)
exit(-1)
if args.file and not os.path.isfile(args.file):
print('[ERROR] TargetFile not found: %s' % args.file)
exit(-1)