Skip to content

Commit 894a2de

Browse files
author
Stefan Lekov
committed
started implementation of remote file validation (see [issue#2](#2) )
1 parent 306b4d5 commit 894a2de

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

remoteShark.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,14 @@ def addHostKeyCache(self):
509509
return True
510510
else:
511511
return False
512-
512+
513+
def validateRemotePcapFile(self):
514+
""" Connects to the remote host and validates the if the remote file exists and if it correct type """
515+
if self.cfg.debug >= 2:
516+
printf("Validating if '%s' exist and is supported\n", cfg.remotePcapFile)
517+
# TODO - actual implementation
518+
return True
519+
513520
def runWireshark(self):
514521
""" Connect to the remote host and start local Wireshark for live capturing of traffic """
515522
global cfg
@@ -531,6 +538,9 @@ def runWireshark(self):
531538
if cfg.remotePcapFile == None:
532539
tcpdumpCMD = sprintf('%s -U -ni "%s" -s 0 -q -w - "%s" 2>/dev/null', tcpdumpCMD, cfg.interface, cfg.dumpFilter)
533540
else:
541+
if not self.validateRemotePcapFile():
542+
printf("Invalid file or file format of remote pcap file\n")
543+
self.__exit(1)
534544
if (cfg.remotePcapFile.endswith('.gz')):
535545
tcpdumpCMD = sprintf('zcat %s | %s -U -n -r - -s 0 -q -w - "%s" 2>/dev/null', cfg.remotePcapFile, tcpdumpCMD, cfg.dumpFilter)
536546
elif (cfg.remotePcapFile.endswith('.bz2')):

0 commit comments

Comments
 (0)