Ejemplo n.º 1
0
def execute_jafar_and_return_validated_test_keys(ooni_exe, outfile,
                                                 experiment_args, tag, args):
    """ Executes jafar and returns the validated parsed test keys, or throws
        an AssertionError if the result is not valid. """
    tk = common.execute_jafar_and_miniooni(ooni_exe, outfile, experiment_args,
                                           tag, args)
    return tk
Ejemplo n.º 2
0
def execute_jafar_and_return_validated_test_keys(ooni_exe, outfile, tag, args):
    """ Executes jafar and returns the validated parsed test keys, or throws
        an AssertionError if the result is not valid. """
    tk = common.execute_jafar_and_miniooni(ooni_exe, outfile,
                                           "http_header_field_manipulation",
                                           tag, args)
    # TODO(bassosimone): what checks to put here?
    return tk
Ejemplo n.º 3
0
def execute_jafar_and_return_validated_test_keys(ooni_exe, outfile, tag, args):
    """ Executes jafar and returns the validated parsed test keys, or throws
        an AssertionError if the result is not valid. """
    tk = common.execute_jafar_and_miniooni(
        ooni_exe, outfile, "facebook_messenger", tag, args
    )
    assert tk["requests"] is None
    if tk["tcp_connect"] is not None:
        assert isinstance(tk["tcp_connect"], list)
        assert len(tk["tcp_connect"]) > 0
        for entry in tk["tcp_connect"]:
            assert isinstance(entry, dict)
            assert isinstance(entry["ip"], str)
            assert isinstance(entry["port"], int)
            assert isinstance(entry["status"], dict)
            failure = entry["status"]["failure"]
            success = entry["status"]["success"]
            assert isinstance(failure, str) or failure is None
            assert isinstance(success, bool)
    return tk
Ejemplo n.º 4
0
def execute_jafar_and_return_validated_test_keys(ooni_exe, outfile, tag, args):
    """ Executes jafar and returns the validated parsed test keys, or throws
        an AssertionError if the result is not valid. """
    tk = common.execute_jafar_and_miniooni(ooni_exe, outfile, "whatsapp", tag,
                                           args)
    assert isinstance(tk["requests"], list)
    assert len(tk["requests"]) > 0
    for entry in tk["requests"]:
        assert isinstance(entry, dict)
        failure = entry["failure"]
        assert isinstance(failure, str) or failure is None
        assert isinstance(entry["request"], dict)
        req = entry["request"]
        common.check_maybe_binary_value(req["body"])
        assert isinstance(req["headers"], dict)
        for key, value in req["headers"].items():
            assert isinstance(key, str)
            common.check_maybe_binary_value(value)
        assert isinstance(req["method"], str)
        assert isinstance(entry["response"], dict)
        resp = entry["response"]
        common.check_maybe_binary_value(resp["body"])
        assert isinstance(resp["code"], int)
        if resp["headers"] is not None:
            for key, value in resp["headers"].items():
                assert isinstance(key, str)
                common.check_maybe_binary_value(value)
    assert isinstance(tk["tcp_connect"], list)
    assert len(tk["tcp_connect"]) > 0
    for entry in tk["tcp_connect"]:
        assert isinstance(entry, dict)
        assert isinstance(entry["ip"], str)
        assert isinstance(entry["port"], int)
        assert isinstance(entry["status"], dict)
        failure = entry["status"]["failure"]
        success = entry["status"]["success"]
        assert isinstance(failure, str) or failure is None
        assert isinstance(success, bool)
    return tk