Skip to content

Commit 43dbb91

Browse files
committed
Instead of reading the file directly, it is piped via STDIN
Added checks for .gz and .bz2 files, in which case zcat and bzcat is used to read the compressed file Updated CHANGELOG.md
1 parent b9c27f3 commit 43dbb91

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## Alpha 4
44
* Host validation no longer accepts hosts starting with '-'
55
* Implemented experimental support for reading pcap file on the remote system
6+
* Also supports packet captures compressed with gz (if extension is .gz)
7+
* Also supports packet captures compressed with gz (if extension is .bz2)
68
* Validation methods of AppConfig are now private
79
* Implemented --port|-p argument which specifies the SSH port
810
* Implemented compression on SSH level (enabled by -c|--compression)

remoteShark.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,12 @@ def runWireshark(self):
508508
if cfg.remotePcapFile == None:
509509
tcpdumpCMD = sprintf('%s -U -ni "%s" -s 0 -q -w - %s 2>/dev/null', tcpdumpCMD, cfg.interface, cfg.dumpFilter)
510510
else:
511-
tcpdumpCMD = sprintf('%s -U -n -r %s -s 0 -q -w - %s 2>/dev/null', tcpdumpCMD, cfg.remotePcapFile, cfg.dumpFilter)
511+
if (cfg.remotePcapFile.endswith('.gz')):
512+
tcpdumpCMD = sprintf('zcat %s | %s -U -n -r - -s 0 -q -w - %s 2>/dev/null', cfg.remotePcapFile, tcpdumpCMD, cfg.dumpFilter)
513+
elif (cfg.remotePcapFile.endswith('.bz2')):
514+
tcpdumpCMD = sprintf('bzcat %s | %s -U -n -r - -s 0 -q -w - %s 2>/dev/null', cfg.remotePcapFile, tcpdumpCMD, cfg.dumpFilter)
515+
else:
516+
tcpdumpCMD = sprintf('cat %s | %s -U -n -r - -s 0 -q -w - %s 2>/dev/null', cfg.remotePcapFile, tcpdumpCMD, cfg.dumpFilter)
512517

513518
if self.cfg.debug >= 3:
514519
printf('Running command remote "%s"\n', tcpdumpCMD)

0 commit comments

Comments
 (0)