Esempio n. 1
0
     sys.exit(1)
 # Elements that should initialized regardless of the functionality being used
 db_wrapper, db_pool_manager = DbFactory.get_wrapper(args)
 try:
     instance_id = db_wrapper.get_instance_id()
 except Exception:
     instance_id = None
 data_manager = DataManager(db_wrapper, instance_id)
 MADPatcher(args, data_manager)
 data_manager.clear_on_boot()
 data_manager.fix_routecalc_on_boot()
 event = Event(args, db_wrapper)
 event.start_event_checker()
 # Do not remove this sleep unless you have solved the race condition on boot with the logger
 time.sleep(.1)
 MappingManagerManager.register('MappingManager', MappingManager)
 mapping_manager_manager = MappingManagerManager()
 mapping_manager_manager.start()
 mapping_manager: MappingManager = mapping_manager_manager.MappingManager(
     db_wrapper, args, data_manager, configmode=args.config_mode)
 if args.only_routes:
     logger.info(
         'Running in route recalculation mode. MAD will exit once complete')
     recalc_in_progress = True
     while recalc_in_progress:
         time.sleep(5)
         sql = "SELECT COUNT(*) > 0 FROM `settings_routecalc` WHERE `recalc_status` = 1"
         recalc_in_progress = db_wrapper.autofetch_value(sql)
     logger.info("Done calculating routes!")
     # TODO: shutdown managers properly...
     sys.exit(0)
Esempio n. 2
0
File: start.py Progetto: Terrycy/MAD
        sys.exit(1)

    mitm_receiver_process = None
    mitm_mapper_manager = None

    mapping_manager_manager = None
    mapping_manager: Optional[MappingManager] = None
    pogoWindowManager = None
    ws_server = None
    t_ws = None
    t_file_watcher = None
    t_whw = None
    device_Updater = None

    if args.only_scan or args.only_routes:
        MappingManagerManager.register('MappingManager', MappingManager)
        mapping_manager_manager = MappingManagerManager()
        mapping_manager_manager.start()
        mapping_manager: MappingManager = mapping_manager_manager.MappingManager(
            db_wrapper, args, data_manager, False)
        filename = args.mappings
        if args.only_routes:
            recalc_in_progress = True
            while recalc_in_progress:
                time.sleep(5)
                sql = "SELECT COUNT(*) > 0 FROM `settings_routecalc` WHERE `recalc_status` = 1"
                recalc_in_progress = db_wrapper.autofetch_value(sql)
            logger.info("Done calculating routes!")
            # TODO: shutdown managers properly...
            sys.exit(0)
Esempio n. 3
0
            'config.ini file not found. Check configs folder and copy example config'
        )
        sys.exit(1)

    create_folder(args.file_path)
    create_folder(args.upload_path)

    db_wrapper, db_pool_manager = DbFactory.get_wrapper(args)

    instance_id = db_wrapper.get_instance_id()
    data_manager = DataManager(db_wrapper, instance_id)
    data_manager.clear_on_boot()
    version = MADVersion(args, data_manager)
    version.get_version()

    MappingManagerManager.register('MappingManager', MappingManager)
    mapping_manager_manager = MappingManagerManager()
    mapping_manager_manager.start()
    mapping_manager_stop_event = mapping_manager_manager.Event()
    mapping_manager: MappingManager = MappingManager(db_wrapper, args,
                                                     data_manager, True)

    ws_server = WebsocketServer(args,
                                None,
                                db_wrapper,
                                mapping_manager,
                                None,
                                data_manager,
                                configmode=True)
    t_ws = Thread(name='scanner', target=ws_server.start_server)
    t_ws.daemon = False