summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-07-24 04:12:01 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2019-07-24 05:44:19 +0700
commitfe981d65da24e62573acd91e9d86e7b37ef12bb7 (patch)
treeac997f3b002daa32f207872261e37243073a9ffe /src
parent710503bc4c83b6b8562ffac0ba7ee6113167b586 (diff)
trx_toolkit/trx_sniff.py: support additional capture filter
Diffstat (limited to 'src')
-rwxr-xr-xsrc/target/trx_toolkit/trx_sniff.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/target/trx_toolkit/trx_sniff.py b/src/target/trx_toolkit/trx_sniff.py
index 7eea04c..0323e85 100755
--- a/src/target/trx_toolkit/trx_sniff.py
+++ b/src/target/trx_toolkit/trx_sniff.py
@@ -75,6 +75,10 @@ class Application(ApplicationBase):
log.info("Listening on interface '%s'..." % self.argv.sniff_if)
sniff_args["iface"] = self.argv.sniff_if
+ if self.argv.cap_filter is not None:
+ log.info("Using additional capture filter '%s'" % self.argv.cap_filter)
+ sniff_args["filter"] += " and (%s)" % self.argv.cap_filter
+
# Start sniffing...
scapy.all.sniff(**sniff_args)
@@ -224,6 +228,10 @@ class Application(ApplicationBase):
dest = "cap_file", type = str, metavar = "FILE",
help = "Read packets from a PCAP file")
+ trx_group.add_argument("-f", "--capture-filter",
+ dest = "cap_filter", type = str, metavar = "FILTER",
+ help = "Set additional capture filter (e.g. 'host 192.168.1.2')")
+
cnt_group = parser.add_argument_group("Count limitations (optional)")
cnt_group.add_argument("--frame-count", metavar = "N",
dest = "frame_count", type = int,