Exemplo n.º 1
0
def callback_detect_event_before_end_scan(line):
    ended_scan = callback_detect_end_scan(line)
    if ended_scan is None:
        event = callback_detect_event(line)
        assert event is None, 'Event detected before end scan'
        return None
    else:
        return True
Exemplo n.º 2
0
 def wait_agent_initial_scan(time_out=60):
     truncate_agent_log()
     start_time = datetime.now()
     while datetime.now() < start_time + timedelta(seconds=time_out):
         ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command("sudo cat /var/ossec/logs/ossec.log")
         for line in ssh_stdout.read().decode('ascii').splitlines():
             if callback_detect_end_scan(line):
                 return
     pytest.fail("No 'File integrity monitoring scan ended.' was found on ossec.log.")