Ejemplo n.º 1
0
def no_snmp_connections(monkeypatch):
    close_all_connections()

    def no_snmp(self):
        raise TransportConnectionError(None, None)

    monkeypatch.setattr('modules.transports.SNMPTransport.connect', no_snmp)
Ejemplo n.º 2
0
#!/usr/bin/env python3

from modules.audit import audit
from modules.database import init_scanning, set_finish_time
from modules.reporting import generate_report
from modules.testing import run_tests
from modules.transports import close_all_connections

if __name__ == '__main__':
    init_scanning()
    audit()
    run_tests()
    close_all_connections()
    set_finish_time()
    generate_report('sample_report.pdf')
Ejemplo n.º 3
0
def test_000_file_exist_4(run_docker, no_transports):
    close_all_connections()
    assert test.main()[0] == Status.ERROR and test.main()[1]
Ejemplo n.º 4
0
def test_000_file_exist_3(run_docker, no_ssh_connections):
    close_all_connections()
    assert test.main()[0] == Status.NOT_APPLICABLE
Ejemplo n.º 5
0
def test_002_permissions_4(run_docker, no_transports):
    close_all_connections()
    assert test.main()[0] == Status.ERROR and test.main()[1]
Ejemplo n.º 6
0
def test_002_permissions_3(run_docker, no_ssh_connections):
    close_all_connections()
    assert test.main()[0] == Status.NOT_APPLICABLE
Ejemplo n.º 7
0
def no_transports(monkeypatch):
    close_all_connections()
    monkeypatch.delattr('modules.transports._TRANSPORTS')
Ejemplo n.º 8
0
def no_mysql_connections(monkeypatch):
    close_all_connections()
    monkeypatch.delattr('pymysql.connect')
Ejemplo n.º 9
0
def no_ssh_connections(monkeypatch):
    close_all_connections()
    monkeypatch.delattr('paramiko.SSHClient.connect')
Ejemplo n.º 10
0
def pytest_sessionfinish(session, exitstatus):
    close_all_connections()
Ejemplo n.º 11
0
 def stop_container():
     close_all_connections()
     containers = docker.from_env().containers.list()
     for container in containers:
         if container.name in started_containers:
             container.stop()