diff --git a/src/cowrie/commands/tftp.py b/src/cowrie/commands/tftp.py index ff34cfc9..0b064312 100644 --- a/src/cowrie/commands/tftp.py +++ b/src/cowrie/commands/tftp.py @@ -88,37 +88,32 @@ class command_tftp(HoneyPotCommand): parser.add_argument("-p") parser.add_argument("-r") - try: - args = parser.parse_args(self.args) - if args.c: - if len(args.c) > 1: - self.file_to_get = args.c[1] - if args.hostname is None: - self.exit() - self.hostname = args.hostname + args = parser.parse_args(self.args) + if args.c: + if len(args.c) > 1: + self.file_to_get = args.c[1] + if args.hostname is None: + self.exit() + return + self.hostname = args.hostname + elif args.r: + self.file_to_get = args.r + self.hostname = args.g + else: + self.write('usage: tftp [-h] [-c C C] [-l L] [-g G] [-p P] [-r R] [hostname]\n') + self.exit() + return - elif args.r: - self.file_to_get = args.r - self.hostname = args.g - else: - self.write('usage: tftp [-h] [-c C C] [-l L] [-g G] [-p P] [-r R] [hostname]\n') - self.exit() - return + if self.hostname is None: + self.exit() + return - if self.hostname is None: - self.exit() - return - - if self.hostname.find(':') != -1: - host, port = self.hostname.split(':') - self.hostname = host - self.port = int(port) - - self.makeTftpRetrieval() - - except Exception as err: - log.err(str(err)) + if self.hostname.find(':') != -1: + host, port = self.hostname.split(':') + self.hostname = host + self.port = int(port) + self.makeTftpRetrieval() self.exit() diff --git a/src/cowrie/output/mysql.py b/src/cowrie/output/mysql.py index 1ac188b2..46760dd9 100644 --- a/src/cowrie/output/mysql.py +++ b/src/cowrie/output/mysql.py @@ -33,8 +33,8 @@ class ReconnectingConnectionPool(adbapi.ConnectionPool): self, interaction, *args, **kw) except MySQLdb.OperationalError as e: if e[0] not in (2003, 2006, 2013): - log.msg("RCP: got error {0}, retrying operation".format(e)) raise e + log.msg("RCP: got error {0}, retrying operation".format(e)) conn = self.connections.get(self.threadID()) self.disconnect(conn) # Try the interaction again diff --git a/src/cowrie/shell/protocol.py b/src/cowrie/shell/protocol.py index 22094828..adc94559 100644 --- a/src/cowrie/shell/protocol.py +++ b/src/cowrie/shell/protocol.py @@ -167,7 +167,7 @@ class HoneyPotBaseProtocol(insults.TerminalProtocol, TimeoutMixin): if path in self.commands: return self.commands[path] - log.msg("Can't find command {}".format(path)) + log.msg("Can't find command {}".format(cmd)) return None def lineReceived(self, line):