Skip to content

Commit

Permalink
fixed: console cmdloop KeyboardInterrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
mh4x0f committed Oct 24, 2023
1 parent 5328f08 commit 5366366
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 4 additions & 1 deletion wifipumpkin3/core/common/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,9 @@ def help_mode(self):

def do_exit(self, args):
"""core: exit program and all threads"""
self.killThreads()
if len(self.threads["RogueAP"]) > 0:
user_input = input("Do you really want to quit? [y/n]: ").lower()
if user_input == 'y':
self.killThreads()
print("Exiting...")
raise SystemExit
14 changes: 8 additions & 6 deletions wifipumpkin3/core/common/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,12 @@ def __init__(self, parse_args=None):
self.setOptions()

def cmdloop(self, intro=None):
print(intro)
doQuit = False
while doQuit != True:
try:
super(ConsoleUI, self).cmdloop(intro="")
doQuit = True
except KeyboardInterrupt:
print("caught ctrl+c, press return to exit")
self.do_exit([])
pass

def initialize_core(self):
raise NotImplementedError()
Expand Down Expand Up @@ -406,8 +403,13 @@ def onecmd(self, commands, separator=";"):
if not str(command).startswith("use"):
Cmd.onecmd(self, command)

def do_exit(self, args):
sys.exit(0)
def cmdloop(self, intro=None):
doQuit = False
while doQuit != True:
try:
super(ModuleUI, self).cmdloop(intro="")
except KeyboardInterrupt:
pass


class ExtensionUI(ConsoleUIBase):
Expand Down

0 comments on commit 5366366

Please sign in to comment.