when using execCommand, ls breaks without windowSize

This commit is contained in:
Upi Tamminen 2014-08-09 15:39:47 +03:00
parent 4e8ad9c92c
commit 9bd02f780c
1 changed files with 7 additions and 1 deletions

View File

@ -58,7 +58,13 @@ class command_ls(HoneyPotCommand):
return return
count = 0 count = 0
maxlen = max([len(x) for x in l]) maxlen = max([len(x) for x in l])
perline = int(self.honeypot.user.windowSize[1] / (maxlen + 1))
try:
wincols = self.honeypot.user.windowSize[1]
except AttributeError:
wincols = 80
perline = int(wincols / (maxlen + 1))
for f in l: for f in l:
if count == perline: if count == perline:
count = 0 count = 0