Tests: find IVRE Zeek module location

This commit is contained in:
Pierre Lalet 2021-12-09 15:57:02 +01:00
parent f010a38d17
commit 05a739bdb1

View file

@ -23,6 +23,12 @@ import sys
from time import sleep from time import sleep
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
try:
from ivre.config import guess_prefix
except ImportError:
HAS_IVRE = False
else:
HAS_IVRE = True
from scapy.config import conf from scapy.config import conf
from scapy.interfaces import resolve_iface from scapy.interfaces import resolve_iface
from scapy.layers.tuntap import TunTapInterface from scapy.layers.tuntap import TunTapInterface
@ -44,7 +50,10 @@ def setup_logs():
LOG = setup_logs() LOG = setup_logs()
IFACE = "tap0" IFACE = "tap0"
TCPDUMP = bool(os.environ.get("USE_TCPDUMP")) TCPDUMP = bool(os.environ.get("USE_TCPDUMP"))
ZEEK_PASSIVERECON = bool(os.environ.get("USE_ZEEK")) if HAS_IVRE:
ZEEK_PASSIVERECON = bool(os.environ.get("USE_ZEEK"))
else:
ZEEK_PASSIVERECON = False
conf.verb = 0 conf.verb = 0
# prepare configuration file for masscanned # prepare configuration file for masscanned
@ -75,7 +84,12 @@ if ZEEK_PASSIVERECON:
"-b", "-b",
"-i", "-i",
IFACE, IFACE,
"/usr/share/ivre/zeek/ivre/passiverecon/bare.zeek", os.path.join(
guess_prefix("zeek"),
"ivre",
"passiverecon",
"bare.zeek",
),
"-e", "-e",
"redef tcp_content_deliver_all_resp = T; " "redef tcp_content_deliver_all_resp = T; "
"redef tcp_content_deliver_all_orig = T; " "redef tcp_content_deliver_all_orig = T; "