diff --git a/src/cowrie/commands/curl.py b/src/cowrie/commands/curl.py index 8aefd845..8d04ae41 100644 --- a/src/cowrie/commands/curl.py +++ b/src/cowrie/commands/curl.py @@ -268,10 +268,13 @@ class Command_curl(HoneyPotCommand): self.exit() return None - # TODO: need to do full name resolution. - if ipaddress.ip_address(host).is_private: - self.errorWrite("curl: (6) Could not resolve host: {}\n".format(host)) - return None + # TODO: need to do full name resolution in case someon passes DNS name pointing to local address + try: + if ipaddress.ip_address(host).is_private: + self.errorWrite("curl: (6) Could not resolve host: {}\n".format(host)) + return None + except ValueError: + pass factory = HTTPProgressDownloader( self, fakeoutfile, url, outputfile, *args, **kwargs diff --git a/src/cowrie/commands/wget.py b/src/cowrie/commands/wget.py index 95b49fc5..e4cdb694 100644 --- a/src/cowrie/commands/wget.py +++ b/src/cowrie/commands/wget.py @@ -154,14 +154,17 @@ class Command_wget(HoneyPotCommand): self.errorWrite("HTTP request sent, awaiting response... ") # TODO: need to do full name resolution. - if ipaddress.ip_address(host).is_private: - self.errorWrite( - "Resolving {} ({})... failed: nodename nor servname provided, or not known.\n".format( - host, host + try: + if ipaddress.ip_address(host).is_private: + self.errorWrite( + "Resolving {} ({})... failed: nodename nor servname provided, or not known.\n".format( + host, host + ) ) - ) self.errorWrite("wget: unable to resolve host address ‘{}’\n".format(host)) return None + except ValueError: + pass # File in host's fs that will hold content of the downloaded file # HTTPDownloader will close() the file object so need to preserve the name