* Fix #1567
This commit is contained in:
Michel Oosterhof 2021-05-29 13:50:45 +08:00 committed by GitHub
parent 9af813994e
commit b8be378586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

View File

@ -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

View File

@ -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