Exemplo n.º 1
0
def get(args):
    if len(args) != 4:
        verdict(CHECKER_ERROR, "Wrong args count",
                "Wrong args count for get()")
    host, flag_id, flag_data, vuln = args
    trace("get(%s, %s, %s, %s)" % (host, flag_id, flag_data, vuln))

    mqtt_client = MqttClient(host)
    sys.exit(mqtt_client.check_connect(username=flag_id, password=flag_data))
Exemplo n.º 2
0
def check(args):
    if len(args) != 1:
        verdict(CHECKER_ERROR, "Wrong args count",
                "Wrong args count for check()")
    host = args[0]
    trace("check(%s)" % host)

    module_client = ThermometerModule(host)
    result = module_client.check_index()
    if result != OK:
        sys.exit(result)

    mqtt_client = MqttClient(host)
    sys.exit(mqtt_client.check_connect())