|
34 | 34 | from lib.settings import ( |
35 | 35 | validate_ip_addr, |
36 | 36 | check_services, |
| 37 | + cmdline, |
37 | 38 | load_api_keys, |
38 | 39 | PLATFORM_PROMPT, |
39 | 40 | AUTOSPLOIT_PROMPT, |
40 | | - AUTOSPLOIT_TERM_OPTS |
| 41 | + AUTOSPLOIT_TERM_OPTS, |
| 42 | + USAGE_AND_LEGAL_PATH |
41 | 43 | ) |
42 | 44 | from lib.output import ( |
43 | 45 | info, |
|
55 | 57 | local_host = "" |
56 | 58 | configured = False |
57 | 59 | toolbar_width = 60 |
58 | | -usage_and_legal_path = "{}/etc/general".format(os.getcwd()) |
59 | 60 | loaded_exploits = load_exploits("{}/etc/json".format(os.getcwd())) |
60 | 61 | stop_animation = False |
61 | 62 |
|
@@ -91,32 +92,12 @@ def animation(text): |
91 | 92 |
|
92 | 93 | def usage(): |
93 | 94 | """Usage & Legal.""" |
94 | | - global usage_and_legal_path |
95 | 95 | print("\033[H\033[J") # Clear terminal |
96 | 96 | logo() |
97 | | - with open(usage_and_legal_path) as info: |
| 97 | + with open(USAGE_AND_LEGAL_PATH) as info: |
98 | 98 | print(info.read()) |
99 | 99 |
|
100 | 100 |
|
101 | | -def cmdline(command): |
102 | | - """ |
103 | | - Function that allows us to store system command output in a variable. |
104 | | - We'll change this later in order to solve the potential security |
105 | | - risk that arises when passing untrusted input to the shell. |
106 | | -
|
107 | | - I intend to have the issue resolved by Version 1.5.0. |
108 | | - """ |
109 | | - |
110 | | - command = shlex.split(command) |
111 | | - |
112 | | - process = subprocess.Popen( |
113 | | - args=command, |
114 | | - stdout=subprocess.PIPE, |
115 | | - shell=True |
116 | | - ) |
117 | | - return process.communicate()[0] |
118 | | - |
119 | | - |
120 | 101 | def exploit(query=None, single=None): |
121 | 102 | """Exploit component""" |
122 | 103 |
|
@@ -557,63 +538,6 @@ def try_shodan(): |
557 | 538 |
|
558 | 539 | if __name__ == "__main__": |
559 | 540 |
|
560 | | - '''from api_calls import ( |
561 | | - shodan, |
562 | | - censys, |
563 | | - zoomeye |
564 | | - ) |
565 | | - from lib.settings import ( |
566 | | - load_api_keys, |
567 | | - API_URLS, |
568 | | - AUTOSPLOIT_PROMPT |
569 | | - ) |
570 | | -
|
571 | | - from lib.output import ( |
572 | | - prompt, |
573 | | - info, |
574 | | - warning |
575 | | - ) |
576 | | -
|
577 | | - tokens = load_api_keys() |
578 | | -
|
579 | | - possible_apis = API_URLS.keys() |
580 | | -
|
581 | | - def get_query(): |
582 | | - query = prompt("enter your search query") |
583 | | - return query |
584 | | -
|
585 | | - selected = False |
586 | | - info_msg = "searching {} API with query '{}'" |
587 | | - info("pick a search engine") |
588 | | - for i, api in enumerate(sorted(possible_apis), start=1): |
589 | | - print("{}. {}".format(i, api)) |
590 | | -
|
591 | | - while not selected: |
592 | | - choice = raw_input(AUTOSPLOIT_PROMPT) |
593 | | - try: |
594 | | - choice = int(choice) |
595 | | - if choice == 1: |
596 | | - selected = True |
597 | | - query = get_query() |
598 | | - info(info_msg.format("Shodan", query)) |
599 | | - censys.CensysAPIHook(tokens["censys"][1], tokens["censys"][0], query).censys() |
600 | | - elif choice == 2: |
601 | | - selected = True |
602 | | - query = get_query() |
603 | | - info(info_msg.format("Censys", query)) |
604 | | - shodan.ShodanAPIHook(tokens["shodan"][0], query).shodan() |
605 | | - elif choice == 3: |
606 | | - query = get_query() |
607 | | - selected = True |
608 | | - info("ZoomEye token will be loaded automatically") |
609 | | - info(info_msg.format("Zoomeye", query)) |
610 | | - zoomeye.ZoomEyeAPIHook(query).zoomeye() |
611 | | - else: |
612 | | - warning("choice must be between 1-{}".format(len(API_URLS.keys()))) |
613 | | - except: |
614 | | - warning("choice must be integer not string")''' |
615 | | - |
616 | | - |
617 | 541 | logo() |
618 | 542 |
|
619 | 543 | if len(sys.argv) > 1: |
|
0 commit comments