trx_toolkit/trx_sniff.py: support additional capture filter
Change-Id: I761debb2e1c411f2c6d489eac0adf32060966a4c
This commit is contained in:
parent
710503bc4c
commit
fe981d65da
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue