|
34 | 34 | from lib.settings import ( |
35 | 35 | validate_ip_addr, |
36 | 36 | check_services, |
| 37 | + load_api_keys, |
37 | 38 | PLATFORM_PROMPT, |
38 | 39 | AUTOSPLOIT_PROMPT, |
39 | 40 | AUTOSPLOIT_TERM_OPTS |
@@ -556,6 +557,63 @@ def try_shodan(): |
556 | 557 |
|
557 | 558 | if __name__ == "__main__": |
558 | 559 |
|
| 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 | + |
559 | 617 | logo() |
560 | 618 |
|
561 | 619 | if len(sys.argv) > 1: |
@@ -605,20 +663,17 @@ def start_apache(): |
605 | 663 | start_ap = prompt("Start Apache Service? [Y]es/[N]o") |
606 | 664 | if start_ap == 'y': |
607 | 665 | start_apache() |
608 | | - time.sleep(1.5) |
609 | | - |
610 | 666 | elif start_ap == 'n': |
611 | 667 | error("AutoSploit's MSF related operations require this service to be active.") |
612 | 668 | error("Aborted.") |
613 | | - time.sleep(1.5) |
614 | 669 | sys.exit(0) |
615 | 670 | else: |
616 | 671 | warning("Unhandled Option. Defaulting to starting the service.") |
617 | 672 | start_apache() |
618 | | - time.sleep(1.5) |
619 | 673 |
|
620 | 674 | # We will check if the shodan api key has been saved before, if not we are going to prompt |
621 | 675 | # for it and save it to a file |
| 676 | + # load_api_keys() |
622 | 677 | if not os.path.isfile("api.p"): |
623 | 678 | info("Please provide your Shodan.io API key.") |
624 | 679 |
|
|
0 commit comments