mirror of https://github.com/n1nj4sec/pupy.git
cmd: fix to show exceptions if any
This commit is contained in:
parent
822bcdb013
commit
15fcd63948
|
@ -422,11 +422,20 @@ class PupyCmd(cmd.Cmd):
|
||||||
self.init_completer()
|
self.init_completer()
|
||||||
|
|
||||||
def cmdloop(self, intro=None):
|
def cmdloop(self, intro=None):
|
||||||
try:
|
closed = False
|
||||||
cmd.Cmd.cmdloop(self, intro)
|
while not closed:
|
||||||
except:
|
try:
|
||||||
self.stdout.write('\n')
|
cmd.Cmd.cmdloop(self, intro)
|
||||||
self.cmdloop(intro="")
|
closed = True
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
self.stdout.write('\n')
|
||||||
|
|
||||||
|
except:
|
||||||
|
msg = hint_to_text(Error(traceback.format_exc()))
|
||||||
|
self.redraw_line(msg)
|
||||||
|
|
||||||
|
intro = ''
|
||||||
|
|
||||||
|
|
||||||
def init_completer(self):
|
def init_completer(self):
|
||||||
readline.set_pre_input_hook(self.pre_input_hook)
|
readline.set_pre_input_hook(self.pre_input_hook)
|
||||||
|
@ -529,12 +538,7 @@ class PupyCmd(cmd.Cmd):
|
||||||
text += '\n'
|
text += '\n'
|
||||||
return self.stdout.write(text)
|
return self.stdout.write(text)
|
||||||
|
|
||||||
def display_srvinfo(self, msg):
|
def redraw_line(self, msg=''):
|
||||||
if isinstance(msg, Text):
|
|
||||||
msg = hint_to_text(msg)
|
|
||||||
else:
|
|
||||||
msg = colorize('[*] ', 'blue') + msg
|
|
||||||
|
|
||||||
buf = readline.get_line_buffer()
|
buf = readline.get_line_buffer()
|
||||||
|
|
||||||
self.stdout.write(''.join([
|
self.stdout.write(''.join([
|
||||||
|
@ -550,6 +554,14 @@ class PupyCmd(cmd.Cmd):
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def display_srvinfo(self, msg):
|
||||||
|
if isinstance(msg, Text):
|
||||||
|
msg = hint_to_text(msg)
|
||||||
|
else:
|
||||||
|
msg = colorize('[*] ', 'blue') + msg
|
||||||
|
|
||||||
|
self.redraw_line(msg)
|
||||||
|
|
||||||
def display_success(self, msg):
|
def display_success(self, msg):
|
||||||
return self.display(Success(msg))
|
return self.display(Success(msg))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue