nos0s/main.py

46 lines
1.3 KiB
Python
Raw Permalink Normal View History

2023-03-26 17:58:31 +00:00
from menu import MenuState, LeafMenu
from sniff import udp
from common import config_loader, log
2023-03-24 04:03:49 +00:00
def init_menus():
main_menu = MenuState("NOS0S\nselect an option", "NOS0S MAIN")
2023-03-26 17:58:31 +00:00
net = MenuState("net recon", "tools to gain intel on network devices")
sniffer = LeafMenu("Sniffer", "Sniffs for network traffic. CTRL+C to cancel.")
sniffer.set_action(udp.sniff, (config_loader.config['sniff']['host'], log.warning))
net.add_submenu(sniffer)
2023-03-24 04:03:49 +00:00
main_menu.add_submenu(net)
return main_menu
def main():
2023-03-26 17:58:31 +00:00
log.set_lvl(log.LogLevel.DEBUG)
2023-03-24 04:03:49 +00:00
main_menu = init_menus()
current_menu = main_menu
while current_menu != None:
2023-03-26 17:58:31 +00:00
display, return_to_parent = current_menu.display_CLI()
print(display)
if(return_to_parent):
current_menu = current_menu.nav_to_parent()
continue
2023-03-24 04:03:49 +00:00
res = input('> ')
if res == 'q':
break
elif res == 'b':
current_menu = current_menu.nav_to_parent()
else:
try:
selection = int(res)
current_menu = current_menu.nav_to_sub(selection)
except:
print("Invalid input. Please try again.")
if __name__ == '__main__':
main()