From 48e44a2c9d5362b05614f0e68eab283716a1ba36 Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Mon, 24 Jul 2017 12:40:04 +0400 Subject: [PATCH] convert url to bytes for Twisted HTTPDownloader --- cowrie/commands/curl.py | 3 ++- cowrie/commands/wget.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cowrie/commands/curl.py b/cowrie/commands/curl.py index 6f853491..e87309a4 100644 --- a/cowrie/commands/curl.py +++ b/cowrie/commands/curl.py @@ -84,6 +84,7 @@ class command_curl(HoneyPotCommand): self.exit() return + url=bytes(url) self.url = url self.limit_size = 0 cfg = self.protocol.cfg @@ -366,7 +367,7 @@ class HTTPProgressDownloader(client.HTTPDownloader): """ """ client.HTTPDownloader.__init__(self, url, outfile, headers=headers, - agent='curl/7.38.0') + agent=b'curl/7.38.0') self.status = None self.curl = curl self.fakeoutfile = fakeoutfile diff --git a/cowrie/commands/wget.py b/cowrie/commands/wget.py index b483ed4f..c41a2335 100644 --- a/cowrie/commands/wget.py +++ b/cowrie/commands/wget.py @@ -97,6 +97,7 @@ class command_wget(HoneyPotCommand): url = 'http://%s' % url urldata = urlparse(url) + url = bytes(url) if outfile is None: outfile = urldata.path.split('/')[-1] @@ -240,7 +241,7 @@ commands['/usr/bin/dget'] = command_wget class HTTPProgressDownloader(client.HTTPDownloader): def __init__(self, wget, fakeoutfile, url, outfile, headers=None): client.HTTPDownloader.__init__(self, url, outfile, headers=headers, - agent='Wget/1.11.4') + agent=b'Wget/1.11.4') self.status = None self.wget = wget self.fakeoutfile = fakeoutfile