File: test_prads.py

package info (click to toggle)
prads 0.3.3-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,636 kB
  • sloc: ansic: 10,215; perl: 1,689; sql: 204; makefile: 152; sh: 144; python: 20
file content (25 lines) | stat: -rw-r--r-- 831 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import re

PCAP="fixtures/test.pcap"
LOG="fixtures/test.asset.log"

def test_package(host):
    prads = host.package('prads')
    assert prads.is_installed

def test_service(host):
    prads = host.service('prads')
    assert prads.is_running
    assert prads.is_enabled

def test_run_prads(host):
    cmd = host.run("prads -r %s -l %s" % (PCAP, LOG))
    assert cmd.rc == 0
    assert re.search(r"Total packets received from libpcap\s+:\s+18$", cmd.stdout, flags=re.MULTILINE)
    assert re.search(r"Total TCP OS fingerprints detected\s+:\s+4$", cmd.stdout, flags=re.MULTILINE)

def test_run_prads_asset_report(host):
    cmd = host.run("prads-asset-report -n -r %s", LOG)
    assert cmd.rc == 0
    assert re.search(r"80\s+CLIENT\s+Debian\sAPT", cmd.stdout)
    assert re.search(r"53\s+SERVER\s+DNS\sSQR\sNo\sError", cmd.stdout)