From aee8bc4d20e6b8e499b0507ca0dd3f97976ba431 Mon Sep 17 00:00:00 2001 From: desaster Date: Tue, 29 Jun 2010 19:14:26 +0000 Subject: [PATCH] Fix some wget error handling git-svn-id: https://kippo.googlecode.com/svn/trunk@148 951d7100-d841-11de-b865-b3884708a8e2 --- kippo/commands/wget.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/kippo/commands/wget.py b/kippo/commands/wget.py index a6fba28..50cb746 100644 --- a/kippo/commands/wget.py +++ b/kippo/commands/wget.py @@ -5,7 +5,7 @@ from kippo.core.honeypot import HoneyPotCommand from kippo.core.fs import * from twisted.web import client from twisted.internet import reactor -import stat, time, urlparse, random, re +import stat, time, urlparse, random, re, exceptions commands = {} @@ -52,7 +52,7 @@ class command_wget(HoneyPotCommand): self.exit() return - if url and not url.startswith('http://'): + if '://' not in url: url = 'http://%s' % url urldata = urlparse.urlparse(url) @@ -72,9 +72,17 @@ class command_wget(HoneyPotCommand): self.deferred.addErrback(self.error, url) def download(self, url, fakeoutfile, outputfile, *args, **kwargs): - scheme, host, port, path = client._parse(url) - if scheme == 'https': - self.writeln('Sorry, SSL not supported in this release') + try: + scheme, host, port, path = client._parse(url) + if scheme == 'https': + self.writeln('Sorry, SSL not supported in this release') + self.exit() + return None + elif scheme != 'http': + raise exceptions.NotImplementedError + except: + self.writeln('%s: Unsupported scheme.' % (url,)) + self.exit() return None self.writeln('--%s-- %s' % (time.strftime('%Y-%m-%d %H:%M:%S'), url))