Fix some wget error handling

git-svn-id: https://kippo.googlecode.com/svn/trunk@148 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
desaster
2010-06-29 19:14:26 +00:00
parent 59eba484a5
commit aee8bc4d20

View File

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