Begin Main()
(logger=None)
| 689 | |
| 690 | |
| 691 | def main(logger=None): |
| 692 | """ |
| 693 | Begin Main() |
| 694 | """ |
| 695 | if logger is None: |
| 696 | logger = LoggingUtil.create_log(__name__) |
| 697 | |
| 698 | now = datetime.now() |
| 699 | print("Starting: " + str(now)) |
| 700 | logger.info("Starting...") |
| 701 | |
| 702 | mongo_connector = MongoConnector.MongoConnector() |
| 703 | mongo_ct = mongo_connector.get_certificate_transparency_connection() |
| 704 | cert_graphs_collection = mongo_connector.get_cert_graphs_connection() |
| 705 | jobs_manager = JobsManager.JobsManager(mongo_connector, "create_cert_graphs") |
| 706 | jobs_manager.record_job_start() |
| 707 | |
| 708 | zones = ZoneManager.get_distinct_zones(mongo_connector) |
| 709 | |
| 710 | parser = argparse.ArgumentParser( |
| 711 | description="Creates and stores certificate graphs in the database based on one or more sources." |
| 712 | ) |
| 713 | parser.add_argument( |
| 714 | "--check_censys", |
| 715 | action="store_true", |
| 716 | default=False, |
| 717 | required=False, |
| 718 | help="Whether to check the Censys collection in the database", |
| 719 | ) |
| 720 | parser.add_argument( |
| 721 | "--check_443_scans", |
| 722 | action="store_true", |
| 723 | default=False, |
| 724 | required=False, |
| 725 | help="Whether to check the zgrab collection in the database", |
| 726 | ) |
| 727 | parser.add_argument( |
| 728 | "--check_ct_scans", |
| 729 | action="store_true", |
| 730 | default=False, |
| 731 | required=False, |
| 732 | help="Whether to check the CT collection in the database", |
| 733 | ) |
| 734 | parser.add_argument( |
| 735 | "--zgrab_version", |
| 736 | default=2, |
| 737 | type=int, |
| 738 | choices=[1, 2], |
| 739 | metavar="version", |
| 740 | help="The version of ZGrab used to collect data", |
| 741 | ) |
| 742 | args = parser.parse_args() |
| 743 | |
| 744 | if args.check_censys is True: |
| 745 | censys_collection = mongo_connector.get_censys_connection() |
| 746 | |
| 747 | if args.check_443_scans is True: |
| 748 | zgrab_collection = mongo_connector.get_zgrab_443_data_connection() |
no test coverage detected