improve display of wget

This commit is contained in:
Michel Oosterhof
2016-09-29 15:08:17 +04:00
parent f522e29889
commit f5ba33ca7a

View File

@@ -161,7 +161,7 @@ class command_wget(HoneyPotCommand):
if scheme == 'https':
contextFactory = ssl.ClientContextFactory()
contextFactory.method = SSL.SSLv23_METHOD
reactor.connectSSL(host, port, factory, contextFactory)
self.connection = reactor.connectSSL(host, port, factory, contextFactory)
else: # Can only be http, since we raised an error above for unknown schemes
self.connection = reactor.connectTCP(
host, port, factory, bindAddress=out_addr)
@@ -311,7 +311,7 @@ class HTTPProgressDownloader(client.HTTPDownloader):
if (time.time() - self.lastupdate) < 0.5:
return client.HTTPDownloader.pagePart(self, data)
if self.totallength:
percent = (self.currentlength/self.totallength)*100
percent = int(self.currentlength/self.totallength*100)
spercent = "{}%".format(percent)
else:
spercent = '%dK' % (self.currentlength/1000)