kippo
kippo copied to clipboard
Limit traffic/bandwidth usage
From soczol on February 08, 2011 23:39:49
Could there please be some way to limit the amount of traffic these attackers can make? I have been running it for 5 minutes now and people have already downloaded various ISO files ranging from 1 to 5GB.
Might be nice to have wget fail with some error after say 100MB has been reached.
Original issue: http://code.google.com/p/kippo/issues/detail?id=35
From soczol on February 09, 2011 02:48:04
Err, sorry, this shouldn't have been a 'Defect', not sure what happened there. I'll just blame Google on this one.
From MichaelNargang on August 03, 2012 13:46:00
I had this issue as well, I ended up solving it by putting the kippo install on it's own partition (for aws reasons) but you could also just implement disk quotas as a temporary fix
From MichaelNargang on August 03, 2012 16:06:33
#here is a quick hack to wget.py that stops all downloads at 100mb #just replace pagePart() with this version of pagePart() #it's not fancy you can add errors or whatever, email me if you have questions - mike def pagePart(self, data): if self.status == '200': self.currentlength += len(data) #Quick hack to prevent excessive downloads if self.currentlength > 100000000: self.exit()
if (time.time() - self.lastupdate) < 0.5:
return client.HTTPDownloader.pagePart(self, data)
if self.totallength:
percent = (self.currentlength/self.totallength)*100
spercent = "%i%%" % percent
else:
spercent = '%dK' % (self.currentlength/1000)
percent = 0
self.speed = self.currentlength / (time.time() - self.started)
eta = (self.totallength - self.currentlength) / self.speed
s = '\r%s [%s] %s %dK/s eta %s' % \
(spercent.rjust(3),
('%s>' % (int(39.0 / 100.0 * percent) * '=')).ljust(39),
splitthousands(str(int(self.currentlength))).ljust(12),
self.speed / 1000,
tdiff(eta))
self.wget.write(s.ljust(self.proglen))
self.proglen = len(s)
self.lastupdate = time.time()
return client.HTTPDownloader.pagePart(self, data)
From desaster on January 08, 2013 11:32:48
Support for download size limit added in r227 I'll keep this bug open until I add bandwith limit too.
Labels: -Type-Defect Type-Enhancement