fixed bug in init of cmd classes

This commit is contained in:
Daniel Sagi
2021-06-17 15:08:40 +00:00
parent 46b7f9f5d9
commit d5efef45e2
3 changed files with 7 additions and 4 deletions
+5 -4
View File
@@ -2,8 +2,9 @@ import cmd2
class AuthSubConsole(cmd2.Cmd):
def __init__(self, env):
super(AuthSubConsole, self).__init__()
self.env = env
self.prompt = environment.get_prompt(sub_console="env/auth")
self.prompt = self.env.get_prompt(sub_console="env/auth")
def do_set(self, auth_index):
"""Manages the auth database, Usage:
@@ -21,15 +22,15 @@ class AuthSubConsole(cmd2.Cmd):
print("ERROR: Auth index should be a integer")
return
print(environment.current_auth.get_auth(auth_index).raw_token)
print(self.env.current_auth.get_auth(auth_index).raw_token)
else:
print(environment.current_auth.get_table())
print(self.env.current_auth.get_table())
def do_exit(self, arg):
return True
def postcmd(self, stop, line):
self.prompt = self.prompt.get_prompt(sub_console="env/auth")
self.prompt = self.env.get_prompt(sub_console="env/auth")
if stop:
return True
+1
View File
@@ -9,6 +9,7 @@ class EnvSubConsole(cmd2.Cmd):
Includes: Auth database..
"""
def __init__(self, env):
super(EnvSubConsole, self).__init__()
self.env = env
self.prompt = self.env.get_prompt(sub_command="env")
+1
View File
@@ -6,6 +6,7 @@ from kube_hunter.modules.discovery.hosts import RunningAsPodEvent
class KubeHunterMainConsole(cmd2.Cmd):
def __init__(self, env=None):
super(KubeHunterMainConsole, self).__init__()
kube_hunter_logo = r"""
__ __ __ __
/\ \ /\ \ /\ \ /\ \__