Exemplo n.º 1
0
def test_get_invalid_ip():
    hostname = GetHostname()

    ip = "127.0.0.127"

    hostname.execute(ip, 0)

    assert "Hostname" not in Loot.loot[ip][hostname.loot_name]
Exemplo n.º 2
0
def test_create_loot_space():
    hostname = GetHostname()

    ip = "1.1.1.1"

    hostname.create_loot_space(ip, 0)

    assert Loot.loot[ip] is not None
    assert Loot.loot[ip][hostname.loot_name] is not None
Exemplo n.º 3
0
def test_get_valid_hostname():
    hostname = GetHostname()

    ip = "127.0.0.1"

    hostname.execute(ip, 0)

    assert "Hostname" in Loot.loot[ip][hostname.loot_name]
    assert Loot.loot[ip][hostname.loot_name]["Hostname"] is not None
Exemplo n.º 4
0
def test_get_valid_hostname_no_aliases():
    hostname = GetHostname()

    ip = "1.1.1.1"

    hostname.execute(ip, 0)

    assert "Hostname" in Loot.loot[ip][hostname.loot_name]
    assert Loot.loot[ip][hostname.loot_name]["Hostname"] is not None
    assert not Loot.loot[ip][hostname.loot_name]["Aliases"]
Exemplo n.º 5
0
def test_disabled_config():
    module = GetHostname()

    if module.name not in config.config:
        config.config.add_section(module.name)
    config.config.set(module.name, "enabled", "no")

    result = module.should_execute("", 0)

    config.config.set(module.name, "enabled", "yes")

    assert result is False
Exemplo n.º 6
0
def test_should_not_execute():
    module = GetHostname()
    assert not module.should_execute("", 21)
Exemplo n.º 7
0
def test_should_execute():
    module = GetHostname()
    assert module.should_execute("", 0)
Exemplo n.º 8
0
def test_module_creation():
    hostname = GetHostname()
    assert hostname is not None