From 660922c10fb1342be035fc447b047dbd9c52218a Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Mon, 5 Dec 2016 14:41:41 +0400 Subject: [PATCH] only log tftp download when successful --- cowrie/commands/tftp.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cowrie/commands/tftp.py b/cowrie/commands/tftp.py index 7ab32db..6ab6954 100644 --- a/cowrie/commands/tftp.py +++ b/cowrie/commands/tftp.py @@ -55,16 +55,6 @@ class command_tftp(HoneyPotCommand): time.strftime('%Y%m%d%H%M%S'), re.sub('[^A-Za-z0-9]', '_', self.file_to_get)) - self.protocol.logDispatch(eventid='cowrie.session.file_download', - format='Downloaded tftpFile to %(outfile)s', - outfile=self.safeoutfile - ) - - log.msg(eventid='cowrie.session.file_download', - format='Downloaded tftpFile to %(outfile)s', - outfile=self.safeoutfile - ) - try: tclient.download(self.file_to_get, self.safeoutfile, progresshook) self.file_to_get = self.fs.resolve_path(self.file_to_get, self.protocol.cwd) @@ -73,6 +63,16 @@ class command_tftp(HoneyPotCommand): f = self.fs.getfile(self.file_to_get) f[A_REALFILE] = self.safeoutfile + self.protocol.logDispatch(eventid='cowrie.session.file_download', + format='Downloaded tftpFile to %(outfile)s', + outfile=self.safeoutfile + ) + + log.msg(eventid='cowrie.session.file_download', + format='Downloaded tftpFile to %(outfile)s', + outfile=self.safeoutfile + ) + except tftpy.TftpException, err: return