MCPcopy Create free account
hub / github.com/EASY233/Finger / initoptions

Class initoptions

lib/options.py:10–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class initoptions:
11 def __init__(self, args):
12 self.key = ["\"","","","\\","'"]
13 Urls.url = []
14 Ips.ip = []
15 self._url = args.url
16 self._file = args.file
17 self._ip = args.ip
18 self._ipfile = args.ipfile
19 self.format = args.output
20 # 查询顺序非常重要不能随便移动位置
21 self.api_data(args)
22 self.target()
23 self.output()
24 self.get_ip()
25
26 def api_data(self, args):
27 if args.fofa:
28 run = Fofa()
29 elif args.quake:
30 run = Quake()
31
32 def target(self):
33 if self._url:
34 self.check(self._url)
35 elif self._file:
36 if os.path.exists(self._file):
37 with open(self._file, 'r') as f:
38 for i in f:
39 self.check(i.strip())
40 else:
41 errMsg = "File {0} is not find".format(self._file)
42 logging.error(errMsg)
43 exit(0)
44
45 def check(self, url):
46 for key in self.key:
47 if key in url:
48 url = url.replace(key,"")
49 if not url.startswith('http') and url:
50 # 若没有http头默认同时添加上http与https到目标上
51 Urls.url.append("http://" + str(url))
52 Urls.url.append("https://" + str(url))
53 elif url:
54 Urls.url.append(url)
55
56 def output(self):
57 if self.format not in ["json", "xlsx"]:
58 errMsg = "Ouput args is error,eg(json,xlsx default:xlsx)"
59 logging.error(errMsg)
60 exit(0)
61 Save.format = self.format
62
63 def get_ip(self):
64 try:
65 if self._ip:
66 if "-" in self._ip:
67 start, end = [self.ip_num(x) for x in self._ip.split('-')]

Callers 1

Finger.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected