Пример #1
0
        ssl_context.check_hostname = False

        subnet_filters = SCANNER.get("subnets", None)

        scanner = RouterOsScanner(INTERVAL, SCANNER['address'],
                                  SCANNER["username"], SCANNER["password"],
                                  ssl_context, subnet_filters)
    else:
        raise ValueError(
            "Unknown scanner type. Should be one of ['arping', 'routeros_api']"
        )

    scanner.set_new_device_alert(new_device_alert)

    bot = TelegramBot(TOKEN, BotMainState)
    bot.allow_chat(ADMIN_CHAT)

    print("Starting bot...")
    bot.start()
    print("Bot started")

    print("Starting scanner...")
    scanner.start()
    print("Scanner started")

    try:
        while True:
            sleep(300)
    except KeyboardInterrupt as e:
        print("Interrupted")
        print("Stop bot")