Skip to content

Commit 9d5cfbf

Browse files
author
Stefan Lekov
committed
implented Wireshark filter
1 parent dc1de45 commit 9d5cfbf

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

remoteShark.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class AppConfig:
5858
dumpFilter = 'not port 22'
5959
remotePcapFile = None
6060
compression = None
61+
wiresharkFilter = ''
6162

6263
debug = 0
6364
fragmentedFilter = False
@@ -168,6 +169,15 @@ def __init__(self, argv):
168169
i = i + 1
169170
continue
170171

172+
if argv[i] == '--wireshark-filter' or argv[i] == '-w':
173+
if argc <= i + 1:
174+
printf("%s requires an argument\n", argv[i])
175+
sys.exit(1)
176+
else:
177+
self.wiresharkFilter = argv[i+1]
178+
i = i + 2
179+
continue
180+
171181
if argv[i] == '--interface' or argv[i] == '-i':
172182
if argc <= i + 1:
173183
printf("%s requires an argument\n", argv[i])
@@ -531,7 +541,10 @@ def runWireshark(self):
531541
printf('Running command remote "%s"\n', tcpdumpCMD)
532542

533543
# Wireshark is run with the same arguments for all OS
534-
wireCmd = [cfg.wiresharkPath, '-k', '-i', '-']
544+
if len(self.cfg.wiresharkFilter) > 0:
545+
wireCmd = [cfg.wiresharkPath, '-k', '-i', '-', '-Y', self.cfg.wiresharkFilter]
546+
else:
547+
wireCmd = [cfg.wiresharkPath, '-k', '-i', '-']
535548

536549
self.setupSignals()
537550

0 commit comments

Comments
 (0)