def review_menu(intro=""): ''' submenu for reviewing feels. ''' menuOptions = [ "read over feels", "modify feels publishing" ] util.print_menu(menuOptions, RAINBOW) choice = util.list_select(menuOptions, "what would you like to do with your feels? (or 'back' to return home) ") if choice is not False: if choice == 0: redraw("your recorded feels, listed by date:") view_feels(USER) elif choice == 1: redraw("here's your current nopub status:") set_nopubs() else: redraw() return redraw(intro) return review_menu()
def inventory_menu(): '''Top-level inventory handler.''' menuOptions = [ "manipulate current dataset", "load new dataset", "save current dataset" ] util.refresh(header) print("WELCOME TO INVENTORY HELL") print("-------------------------") util.print_menu(menuOptions) print("\ntell me your desires: ", end="") choice = input() if choice == "0": print(divider) print(data_menu()) elif choice == "1": print(choose_file()) elif choice == "2": print(save_file()) elif choice == 'q': return quickrel else: print(invalid) return inventory_menu()
def initialize(self): """ Load router exploits; store {router:[vuln]} """ self.load() while True: choice = util.print_menu([x for x in self.routers.keys()]) if choice is 0: del(self.routers) break elif choice is -1 or choice > len(self.routers.keys()): pass else: router = self.routers[self.routers.keys()[choice - 1]] while True: # print router modules choice = util.print_menu(['%s - %s' % (x().router, x().vuln) for x in router]) if choice is 0: break elif choice is -1 or choice > len(router): pass else: tmp = router[choice - 1]() if tmp.fetch_ip(): tmp.run()
def initialize(self): """ Load router exploits; store {router:[vuln]} """ self.load() while True: choice = util.print_menu([x for x in self.routers.keys()]) if choice is 0: del(self.routers) break elif choice is -1 or choice > len(self.routers.keys()): pass else: router = self.routers[self.routers.keys()[choice - 1]] while True: # print router modules choice = util.print_menu(['%s - %s' % (x().router, x().vuln) for x in router]) if choice is 0: break elif choice is -1 or choice > len(router): pass else: tmp = router[choice - 1]() tmp.fetch_ip() tmp.run()
def initialize(): menu = [ 'dlink', 'netgear', 'linksys', 'cisco' ] while True: choice = util.print_menu(menu) if choice == 1: choice = util.print_menu(dlink.vulnerabilities()) if choice == 0: continue dlink.run(choice) elif choice == 2: choice = util.print_menu(netgear.vulnerabilities()) if choice == 0: continue netgear.run(choice) elif choice == 3: choice = util.print_menu(linksys.vulnerabilities()) if choice == 0: continue linksys.run(choice) elif choice == 4: choice = util.print_menu(cisco.vulnerabilities()) if choice == 0: continue cisco.run(choice) elif choice == 0: break else: os.system('clear')
def feedback_menu(): ''' feedback handling menu * selects feedback type * calls feedback writing function ''' util.print_menu(SUBJECTS, RAINBOW) choice = raw_input("\npick a category for your feedback: ") cat = "" if choice in ['0', '1', '2', '3']: cat = SUBJECTS[int(choice)] entered = raw_input(""" composing a """+cat+""" to ~endorphant. press <enter> to open an external text editor. mail will be sent once you save and quit. """) redraw(send_feedback(entered, cat)) return else: redraw(INVALID) return feedback_menu()
def select_editor(): ''' setup helper for editor selection ''' util.print_menu(EDITORS, RAINBOW) choice = raw_input("\npick your favorite text editor: ") while choice not in ['0', '1', '2', '3', '4', '5']: choice = raw_input("\nplease pick a number from the list: ") return EDITORS[int(choice)]
def select_editor(): ''' setup helper for editor selection ''' util.print_menu(EDITORS, RAINBOW) choice = util.list_select(EDITORS, "pick your favorite text editor: ") if choice is False: redraw("please pick a text editor!") select_editor() return EDITORS[int(choice)]
def view_detail(itemID): global longView viewOptions = [ "edit details", "stamp item", "link item", "unlink item", "change status", "change location", "bookmark" ] print(divider) if len(get_links(itemID)) > 1: for x in get_links(itemID): print(single_item(x)) else: print(single_item(itemID)) print("ITEM DEETS") print("----------") util.print_menu(viewOptions) if not longView: print("\n\t[ a ] (show full detail view)") print("\ngonna do anything about it? (q to cancel) ", end="") choice = input() if choice == "0": print(edit_item(itemID)) elif choice == "1": print(stamp_item(itemID)) elif choice == "2": print(link_item(itemID)) elif choice == "3": print(unlink_item(itemID)) elif choice == "4": print(change_status(itemID)) elif choice == "5": print(change_loc(itemID)) elif choice == "6": print(bookmark(itemID)) elif choice == "q": return quickrel elif choice == "a" and not longView: longView = True print("full deets") print(single_item(itemID)) print("short deets") longView = False else: print(invalid) return view_detail(itemID)
def pick_list(options, caption): # pass in a list of options with a caption, return answer util.print_menu(options) print("\n\t(leave blank for none)") print("\n" + caption + ": ", end="") ans = input_int() value = "" if ans is not False: ans = validate_index(options, ans) value = options[ans] return value
def choose_file(): global working print("\nLOADING FILE") print("i found these files: \n") util.print_menu(files) print("\npick one to load (q to cancel): ", end="") choice = input() if choice == "q": return quickrel working = int(choice) return (load(files[working]))
def initialize(self): cmd = [] while True: choice = util.print_menu(self.cracks) if choice is 1: cmd = [ 'python', 'src/modules/parameter/wifite.py', '--wep', '--wept', '300', '--nofakeauth' ] break elif choice is 2: cmd = [ 'python', 'src/modules/parameter/wifite.py', '--wpa', '--wpat', '10', '--wpadt', '2' ] break elif choice is 3: cmd = [ 'python', 'src/modules/parameter/wifite.py', '--wps', '--wpst', '5', '--wpsretry', '8' ] elif choice is 0: return else: continue break try: os.system(' '.join(cmd)) except KeyboardInterrupt: pass except Exception, j: util.Error('Error initializing Wifite: %s' % j)
def select_editor(): ''' setup helper for editor selection ''' util.print_menu(EDITORS, RAINBOW) choice = util.list_select(EDITORS, "pick your favorite text editor: ") #choice = raw_input("\npick your favorite text editor: ") #while choice not in ['0', '1', '2', '3', '4', '5']: # choice = raw_input("\nplease pick a number from the list: ") if choice is False: redraw("please pick a text editor!") select_editor() return EDITORS[int(choice)]
def page_helper(options, prompt, pagify, rainbow, page, total, top): ''' A helper to process pagination. 'pagify' is the number of entries per page of display 'page' is the current page number 'total' is the total number of pages 'top' is displyed after the banner redraw ''' ## make short list x = 0 + page * pagify y = x + pagify optPage = options[x:y] util.print_menu(optPage, prompt) print( "\n\t( page {page} of {total}; type 'u' or 'd' to scroll up and down )" ).format(page=page + 1, total=total + 1) ans = util.list_select(optPage, prompt) if ans in util.NAVS: error = "" if ans == 'u': if page == 0: error = "can't scroll up anymore!\n\n> " else: page = page - 1 else: if page == total: error = "can't scroll down anymore!\n\n> " else: page = page + 1 redraw(error + top) return page_helper(options, prompt, pagify, rainbow, page, total, top) elif ans is False: return ans else: # shift answer to refer to index from original list ans = ans + page * pagify return ans
def initialize(self): """ Load router exploits; store {router:[vuln]} """ self.load() while True: choice = util.print_menu([x for x in self.routers.keys()]) if choice is 0: del (self.routers) break elif choice is -1 or choice > len(self.routers.keys()): pass else: router = self.routers[self.routers.keys()[choice - 1]] while True: choice = util.print_menu([x().which for x in router]) if choice is 0: break elif choice is -1 or choice > len(router): pass else: stream.initialize(router[choice - 1])
def initialize(self): self.load() while True: choice = util.print_menu([x for x in self.routers.keys()]) if choice is 0: del(self.routers) break elif choice is -1 or choice > len(self.routers.keys()): pass else: router = self.routers[self.routers.keys()[choice-1]] while True: # print router modules choice = util.print_menu(['%s - %s'%(x.__router__,x.__vuln__) for x in router]) if choice is 0: break elif choice is -1 or choice > len(router): pass else: tmp = util.get_subclass(router[choice-1], RouterVuln)() tmp.run()
def initialize(self): """ Load router exploits; store {router:[vuln]} """ self.load() while True: choice = util.print_menu([x for x in self.routers.keys()]) if choice is 0: del(self.routers) break elif choice is -1 or choice > len(self.routers.keys()): pass else: router = self.routers[self.routers.keys()[choice - 1]] while True: choice = util.print_menu([x().which for x in router]) if choice is 0: break elif choice is -1 or choice > len(router): pass else: stream.initialize(router[choice - 1])
def list_entries(metas, entries, prompt): ''' displays a list of entries for reading selection ''' util.print_menu(entries, RAINBOW) choice = util.list_select(entries, "pick an entry from the list, or type 'back' to go back: ") if choice is not False: redraw("now reading ~"+metas[choice][5]+"'s feels on "+metas[choice][4]+"\n> press <q> to return to feels list.\n\n") show_entry(metas[choice][0]) redraw(prompt) return list_entries(metas, entries, prompt) else: redraw() return
def main_menu(): '''Main controller.''' menuOptions = ["Inventory Hell", "Roster Rodeo", "Ollie Outie"] util.print_menu(menuOptions) print("\nwhere do you wanna go: ", end="") choice = input() if choice == "0": util.refresh(header, inventory_menu()) elif choice == "1": util.refresh(header, roster_menu()) elif choice == "2": return end() elif choice == 'q': return quickrel else: print(invalid) return main_menu()
def menu(): """Driver for the session management menu """ while True: stream.dump_sessions() choice = util.print_menu(session_menu) if choice == 0: break elif choice == 1: (module, number) = stream.get_session_input() if not module is None: stream.stop_session(module, number) elif choice == 2: (module, number) = stream.get_session_input() if not module is None: stream.view_session(module, number) elif choice == 3: try: display = color.B_YELLOW + '[' + color.B_GREEN + '!' + color.B_YELLOW + \ '] Enter file to log to' + color.B_WHITE + ' > ' + color.END file_path = raw_input(display) if file_path is None: return if util.does_file_exist(file_path) or path.islink(file_path): util.Error('File already exists.') return (module, number) = stream.get_session_input() if not module is None: display = color.B_YELLOW + '[' + color.B_GREEN + '!' + color.B_YELLOW + \ '] Log output from %s session %s to %s. Is this correct? ' + \ color.B_GREEN + '[' + color.B_YELLOW + 'Y' + color.B_GREEN + \ '/' + color.B_YELLOW + 'n' + color.B_GREEN + '] ' + \ color.B_WHITE + '> ' + color.END tmp = raw_input(display % (module, number, file_path)) if 'n' in tmp.lower(): return stream.toggle_log(module, number, file_path, True) except KeyboardInterrupt: return except Exception: util.Error('Error logging to given file') return elif choice == 4: (module, number) = stream.get_session_input() if not module is None: stream.toggle_log(module, number) elif choice == -1: pass else: system('clear')
def menu_handler(options, prompt, pagify=10, rainbow=False, top=""): ''' This menu handler takes an incoming list of options, pagifies to a pre-set value, and queries via the prompt. Calls print_menu() and list_select() as helpers. 'top' is an optional list topper, to be passed to redraw() ''' optCount = len(options) page = 0 total = optCount / pagify # don't display empty pages if optCount % pagify == 0: total = total - 1 if total < 2: util.print_menu(options, rainbow) return util.list_select(options, prompt) else: return page_helper(options, prompt, pagify, rainbow, page, total, top)
def initialize(self): self.load() while True: choice = util.print_menu([x for x in self.routers.keys()]) if choice is 0: del (self.routers) break elif choice is -1 or choice > len(self.routers.keys()): pass else: router = self.routers[self.routers.keys()[choice - 1]] while True: # print router modules choice = util.print_menu([ '%s - %s' % (x.__router__, x.__vuln__) for x in router ]) if choice is 0: break elif choice is -1 or choice > len(router): pass else: tmp = util.get_subclass(router[choice - 1], RouterVuln)() tmp.run()
def menu(): while True: stream.dump_sessions() choice = util.print_menu(session_menu) if choice == 0: break elif choice == 1: module, number = get_session_input() if not module is None: stream.stop_session(string.lower(module), int(number)) else: return elif choice == 2: module, number = get_session_input() if not module is None: stream.view_session(string.lower(module), int(number)) else: return elif choice == 3: print '[!] Enter file to log to: ' file_path = raw_input('> ') if file_path is None: return if util.does_file_exist(file_path): util.Error('File already exists.') return util.Msg('Module must be a sniffer or valid logging module.') module = None (module, number) = get_session_input() try: if not module is None: tmp = raw_input('[!] Log output from %s session %s to %s. Is this correct? '% (module,number,file_path)) else: return except Exception, j: util.Error('Error logging to given file') return if tmp == 'n': return stream.start_log_session(module, int(number), file_path) elif choice == 4: (module, number) = get_session_input() if not module is None: stream.stop_log_session(module, int(number))
def menu(): """Driver for the session management menu """ while True: stream.dump_sessions() choice = util.print_menu(session_menu) if choice == 0: break elif choice == 1: (module, number) = stream.get_session_input() if not module is None: stream.stop_session(module, number) elif choice == 2: (module, number) = stream.get_session_input() if not module is None: stream.view_session(module, number) elif choice == 3: print '[!] Enter file to log to: ' file_path = raw_input('> ') if file_path is None: return if util.does_file_exist(file_path) or path.islink(file_path): util.Error('File already exists.') return util.Msg('Module must be a sniffer or valid logging module.') (module, number) = stream.get_session_input() try: if not module is None: tmp = raw_input('[!] Log output from %s session %s to %s.' 'Is this correct? [Y/n]' % (module, number, file_path)) if 'n' in tmp.lower(): return stream.toggle_log(module, number, file_path, True) except Exception: util.Error('Error logging to given file') return elif choice == 4: (module, number) = stream.get_session_input() if not module is None: stream.toggle_log(module, number) elif choice == -1: pass else: system('clear')
def initialize(self): cmd = [] while True: choice = util.print_menu(self.cracks) if choice is 1: cmd = ['python', 'src/modules/parameter/wifite.py', '--wep', '--wept', '300', '--nofakeauth'] break elif choice is 2: cmd = ['python', 'src/modules/parameter/wifite.py', '--wpa', '--wpat', '10', '--wpadt', '2'] break elif choice is 3: cmd = ['python', 'src/modules/parameter/wifite.py', '--wps', '--wpst', '5', '--wpsretry', '8'] elif choice is 0: return else: continue break try: os.system(' '.join(cmd)) except KeyboardInterrupt: pass except Exception, j: util.Error('Error initializing Wifite: %s' % j)
def main(): """Main function""" # Print license print("\nSOCAD Copyright (C) 2018 Miguel Fernandes") print("This program comes with ABSOLUTELY NO WARRANTY.") print( "This is free software, and you are welcome to redistribute it under the terms" ) print( "of the GNU General Public License as published by the Free Software Foundation," ) print( "either version 3 of the License, or (at your option) any later version." ) print("For more information, see <http://www.gnu.org/licenses/>\n") try: print("Starting client...") client = Client() except OSError as err: print(f"[SOCKET ERROR] {err}") print("\n**** Ending program... Bye! ****") return 1 host = "localhost" port = 3000 try: print("Connecting to server...") addr = client.run(host, port) print( f"[INFO] Connected to server with the address {addr[0]}:{addr[1]}") data = {} variables = {} # Circuit variables (to be optimized) # Main loop while True: option = print_menu() if option == 1: req = dict(type='loadSimulator', data='ola') elif option == 2: print("\nSending updated variables...") for key, val in variables.items(): print(f"Key: {key} - Val:{val}") req = dict(type='updateAndRun', data=variables) else: if option: # if option != 0 print("Wrong option!!!") print("Shutting down.") req = dict(type='info', data='exit') client.send_data(req) break # Send data to server client.send_data(req) # Wait for data from server res = client.recv_data() typ, data = process_server_response(res) if typ == 'vars': variables = data elif typ == 'results': # results = data for key, val in variables.items(): variables[key] = val * 1.1 else: raise KeyError(f"Invalid data type: {typ}") # End the program req = dict(type='info', data='exit') client.send_data(req) except ConnectionError as err: print(f"[CONNECTION ERROR] {err}") return 2 except (TypeError, ValueError) as err: print(f"[TYPE/VALUE ERROR] {err}") return 3 except KeyError as err: print(f"[KEY ERROR] {err}") return 4 finally: print("\n**** Closing socket and ending program... Bye! ****") client.close() # Close the client socket return 0
def main(): """ Zarp entry point """ # set up configuration config.initialize() # set up database database.initialize() # load modules loader = LoadedModules() loader.load() Msg('Loaded %d modules.' % loader.total) # handle command line options first if len(argv) > 1: parse_cmd.parse(argv, loader) # menus main_menu = ['Poisoners', 'DoS Attacks', 'Sniffers', 'Scanners', 'Parameter', 'Services', 'Attacks', 'Sessions'] running = True choice = -1 while running: header() choice = print_menu(main_menu) if choice == 0: # check if they've got running sessions! cnt = stream.get_session_count() if cnt > 0: choice = raw_input(color.YELLOW + 'You have %d sessions running. Are you sure? [Y/n] ' % cnt + color.END) if 'y' in choice.lower() or choice == '': Msg('Shutting all sessions down...') stream.stop_session('all', -1) running = False else: debug("Exiting with session count: %d" % (cnt)) Msg("Exiting...") running = False elif choice == 1: while True: choice = print_menu([x().which for x in loader.poison]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.poison): continue else: stream.initialize(loader.poison[choice - 1]) elif choice == 2: while True: choice = print_menu([x().which for x in loader.dos]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.dos): continue else: stream.initialize(loader.dos[choice - 1]) elif choice == 3: while True: choice = print_menu([x().which for x in loader.sniffers]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.sniffers): continue else: stream.initialize(loader.sniffers[choice - 1]) elif choice == 4: while True: choice = print_menu([x().which for x in loader.scanner]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.scanner): continue else: stream.initialize(loader.scanner[choice - 1]) elif choice == 5: while True: choice = print_menu([x().which for x in loader.parameter]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.parameter): continue else: stream.initialize(loader.parameter[choice - 1]) elif choice == 6: while True: choice = print_menu([x().which for x in loader.services]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.services): continue else: stream.initialize(loader.services[choice - 1]) elif choice == 7: while True: choice = print_menu([x().which for x in loader.attacks]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.attacks): continue else: stream.initialize(loader.attacks[choice - 1]) elif choice == 8: session_manager.menu() elif choice == -1: pass
def data_menu(): global scratch dataOptions = [ "show dataset", "show scratchpad", "clear scratchpad", "show last search", "toggle view", "view detail", "count items", "search", "edit item", "add item", "back to main" ] print("") print("DATA BROWSING") print("-------------") util.print_menu(dataOptions) print("\ntell me your desires (q to cancel): ", end="") choice = input() if choice == "0": print(show_dataset(datafile)) elif choice == "1": for x in scratch: print(util.pretty_data(core.get_by_id(datafile, x))) elif choice == "2": scratch = [] elif choice == "3": for x in lastSearch: print(util.pretty_data(core.get_by_id(datafile, x))) print("total found: " + str(len(lastSearch))) elif choice == "4": print(toggle_view()) elif choice == "5": print(divider) itemID = pick_id() if itemID == quickrel: print(quickrel) else: print(view_detail(itemID)) elif choice == "6": print(divider) print(count_data()) elif choice == "7": print(divider) print(search_data()) elif choice == "8": print(divider) itemID = pick_id() if itemID == quickrel: print(quickrel) else: print(edit_item(itemID)) elif choice == "9": print(item_adder()) elif choice == "10": return divider elif choice == 'q': return quickrel else: print(invalid) autosave() return data_menu()
def main(): """ Zarp entry point """ # set up configuration config.initialize() # set up database database.initialize() # load modules loader = LoadedModules() loader.load() util.Msg('Loaded %d modules.' % loader.total) # handle command line options first if len(argv) > 1: parse_cmd.parse(argv, loader) # menus main_menu = ['Poisoners', 'DoS Attacks', 'Sniffers', 'Scanners', 'Parameter', 'Services', 'Attacks', 'Sessions'] running = True choice = -1 while running: util.header() choice = util.print_menu(main_menu) if choice == 0: # check if they've got running sessions! cnt = stream.get_session_count() if cnt > 0: display = color.B_YELLOW + 'You have %d sessions running. ' + \ 'Are you sure? ' + color.B_GREEN + '[' + color.B_YELLOW + \ 'Y' + color.B_GREEN + '/' + color.B_YELLOW + 'n' + \ color.B_GREEN + '] ' + color.END choice = raw_input(display % cnt) if 'y' in choice.lower() or choice == '': util.Msg('Shutting all sessions down...') stream.stop_session('all', -1) running = False else: util.debug("Exiting with session count: %d" % (cnt)) util.Msg("Exiting...") running = False # remove zarp temporary directory util.init_app('rm -fr /tmp/.zarp/') # recheck that all sessions are down cnt = stream.get_session_count() if cnt <= 0: # some libs dont clean up their own threads, so # we need to hard quit those to avoid hanging; FIXME _exit(1) elif choice == 1: while True: choice = util.print_menu([x().which for x in loader.poison]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.poison): continue else: stream.initialize(loader.poison[choice - 1]) elif choice == 2: while True: choice = util.print_menu([x().which for x in loader.dos]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.dos): continue else: stream.initialize(loader.dos[choice - 1]) elif choice == 3: while True: choice = util.print_menu([x().which for x in loader.sniffers]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.sniffers): continue else: stream.initialize(loader.sniffers[choice - 1]) elif choice == 4: while True: choice = util.print_menu([x().which for x in loader.scanner]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.scanner): continue else: stream.initialize(loader.scanner[choice - 1]) elif choice == 5: while True: choice = util.print_menu([x().which for x in loader.parameter]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.parameter): continue else: stream.initialize(loader.parameter[choice - 1]) elif choice == 6: while True: choice = util.print_menu([x().which for x in loader.services]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.services): continue else: stream.initialize(loader.services[choice - 1]) elif choice == 7: while True: choice = util.print_menu([x().which for x in loader.attacks]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.attacks): continue else: stream.initialize(loader.attacks[choice - 1]) elif choice == 8: session_manager.menu() elif choice == -1: pass
def view_neighbors(users): ''' generates list of all users on ttbp, sorted by most recent post * if user is publishing, list publish directory ''' userList = [] ## assumes list of users passed in all have valid config files for user in users: userRC = json.load(open(os.path.join("/home", user, ".ttbp", "config", "ttbprc"))) ## retrieve publishing url, if it exists url="\t\t\t" if userRC.get("publish dir"): url = LIVE+user+"/"+userRC.get("publish dir") ## find last entry files = os.listdir(os.path.join("/home", user, ".ttbp", "entries")) files.sort() lastfile = "" for filename in files: if core.valid(filename): lastfile = os.path.join("/home", user, ".ttbp", "entries", filename) ## generate human-friendly timestamp ago = "never" if lastfile: last = os.path.getctime(lastfile) since = time.time()-last ago = util.pretty_time(int(since)) + " ago" else: last = 0 ## some formatting handwavin urlpad = "" if ago == "never": urlpad = "\t" userpad = "" if len(user) < 7: userpad = "\t" userList.append(["\t~"+user+userpad+"\t("+ago+")"+urlpad+"\t"+url, last, user]) # sort user by most recent entry for display userList.sort(key = lambda userdata:userdata[1]) userList.reverse() sortedUsers = [] userIndex = [] for user in userList: sortedUsers.append(user[0]) userIndex.append(user[2]) util.print_menu(sortedUsers, RAINBOW) #raw_input("\n\npress <enter> to go back home.\n\n") choice = util.list_select(sortedUsers, "pick a townie to browse their feels, or type 'back' to go home: ") if choice is not False: redraw("~"+userIndex[choice]+"'s recorded feels, listed by date: \n") view_feels(userIndex[choice]) view_neighbors(users) else: redraw() return
def main(): # handle command line options first if len(sys.argv) > 1: parse_cmd.parse(sys.argv) # set up configuration config.initialize() # menus main_menu = [ 'Poisoners', 'DoS Attacks', 'Sniffers', 'Scanners', 'Parameter','Services','Sessions'] poison_menu = [ 'ARP Poison', 'DNS Poison', 'DHCP Poison', 'NBNS Spoof'] dos_menu = [ 'NDP', 'Nestea', 'LAND', 'TCP SYN', 'SMB2', 'DHCP Starve' ] sniffer_menu = [ 'HTTP Sniffer', 'Password Sniffer', 'Traffic Sniffer'] service_menu = [ 'HTTP Server', 'SSH Server', 'FTP Server', 'SMB Listener', 'Access Point' ] scanner_menu = [ 'NetMap', 'Service Scan', 'AP Scan'] parameter_menu = [ 'WEP Crack', 'WPA2 Crack', 'WPS Crack', 'Router Pwn', 'Pass-The-Hash' ] running = True choice = -1 while running: header() choice = print_menu(main_menu) if choice == 0: # check if they've got running sessions! cnt = stream.get_session_count() if cnt > 0: Msg('You have %d sessions running. Are you sure?'%cnt) choice = raw_input('> ') if 'y' in choice.lower(): stream.stop_session('all', -1) running = False else: debug("Exiting with session count: %d"%(cnt)) Msg("Exiting...") running = False elif choice == 1: while True: choice = print_menu(poison_menu) if choice == 0: break elif choice == 1: stream.initialize('arp') elif choice == 2: stream.initialize('dns') elif choice == 3: stream.initialize('dhcp') elif choice == 4: stream.initialize('nbns') elif choice == -1: pass elif choice == 2: while True: choice = print_menu(dos_menu) if choice == 1: stream.initialize('ndp') elif choice == 2: stream.initialize('nestea') elif choice == 3: stream.initialize('land') elif choice == 4: stream.initialize('tcp_syn') elif choice == 5: stream.initialize('smb2') elif choice == 6: stream.initialize('dhcp_starv') elif choice == 0: break elif choice == -1: pass else: os.system('clear') elif choice == 3: while True: choice = print_menu(sniffer_menu) if choice == 0: break elif choice == 1: stream.initialize('http_sniffer') elif choice == 2: stream.initialize('password_sniffer') elif choice == 3: stream.initialize('traffic_sniffer') elif choice == -1: pass elif choice == 4: while True: choice = print_menu(scanner_menu) if choice == 0: break elif choice == 1: stream.initialize('net_map') elif choice == 2: stream.initialize('service_scan') elif choice == 3: stream.initialize('ap_scan') elif choice == -1: pass elif choice == 5: while True: choice = print_menu(parameter_menu) if choice == 0: break elif choice == 1: stream.initialize('wep_crack') elif choice == 2: stream.initialize('wpa_crack') elif choice == 3: stream.initialize('wps_crack') elif choice == 4: stream.initialize('router_pwn') elif choice == 5: util.Error('Module not yet implemented') #stream.initialize('pass_the_hash') elif choice == -1: pass elif choice == 6: while True: choice = print_menu(service_menu) if choice == 0: break elif choice == 1: stream.initialize('http_server') elif choice == 2: stream.initialize('ssh_server') elif choice == 3: stream.initialize('ftp_server') elif choice == 4: stream.initialize('smb') elif choice == 5: stream.initialize('access_point') elif choice == -1: pass elif choice == 7: session_manager.menu() elif choice == -1: pass
def main_menu(): ''' main navigation menu ''' menuOptions = [ "record your feels", "review your feels", "check out your neighbors", "browse global feels", "scribble some graffiti\t(new!)", "change your settings", "send some feedback", "see credits", "read documentation"] print("you're at ttbp home. remember, you can always press <ctrl-c> to come back here.\n\n") util.print_menu(menuOptions, RAINBOW) try: choice = raw_input("\ntell me about your feels (or 'quit' to exit): ") except KeyboardInterrupt: redraw(EJECT) return main_menu() if choice == '0': redraw() today = time.strftime("%Y%m%d") write_entry(os.path.join(DATA, today+".txt")) core.www_neighbors() elif choice == '1': redraw("your recorded feels, listed by date:\n") view_feels(USER) elif choice == '2': users = core.find_ttbps() redraw("the following "+p.no("user", len(users))+" "+p.plural("is", len(users))+" recording feels on ttbp:\n") view_neighbors(users) elif choice == '3': redraw("most recent global entries\n") view_feed() elif choice == '4': graffiti_handler() elif choice == '5': redraw("now changing your settings. press <ctrl-c> if you didn't mean to do this.") try: core.load(setup()) # reload settings to core except KeyboardInterrupt(): redraw(EJECT) redraw() elif choice == '6': redraw("you're about to send mail to ~endorphant about ttbp\n") feedback_menu() elif choice == '7': redraw() show_credits() elif choice == '8': subprocess.call(["lynx", os.path.join(SOURCE, "..", "README.html")]) redraw() elif choice in QUITS: return stop() else: redraw(INVALID) return main_menu()
def main(): """ Zarp entry point """ # set up configuration config.initialize() # set up database database.initialize() # load modules loader = LoadedModules() loader.load() util.Msg('Loaded %d modules.' % loader.total) # handle command line options first if len(argv) > 1: parse_cmd.parse(argv, loader) # menus main_menu = [ 'Poisoners', 'DoS Attacks', 'Sniffers', 'Scanners', 'Parameter', 'Services', 'Attacks', 'Sessions' ] running = True choice = -1 while running: util.header() choice = util.print_menu(main_menu) if choice == 0: # check if they've got running sessions! cnt = stream.get_session_count() if cnt > 0: display = color.B_YELLOW + 'You have %d sessions running. ' + \ 'Are you sure? ' + color.B_GREEN + '[' + color.B_YELLOW + \ 'Y' + color.B_GREEN + '/' + color.B_YELLOW + 'n' + \ color.B_GREEN + '] ' + color.END choice = raw_input(display % cnt) if 'y' in choice.lower() or choice == '': util.Msg('Shutting all sessions down...') stream.stop_session('all', -1) running = False else: util.debug("Exiting with session count: %d" % (cnt)) util.Msg("Exiting...") running = False # remove zarp temporary directory util.init_app('rm -fr /tmp/.zarp/') # recheck that all sessions are down cnt = stream.get_session_count() if cnt <= 0: # some libs dont clean up their own threads, so # we need to hard quit those to avoid hanging; FIXME _exit(1) elif choice == 1: while True: choice = util.print_menu([x().which for x in loader.poison]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.poison): continue else: stream.initialize(loader.poison[choice - 1]) elif choice == 2: while True: choice = util.print_menu([x().which for x in loader.dos]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.dos): continue else: stream.initialize(loader.dos[choice - 1]) elif choice == 3: while True: choice = util.print_menu([x().which for x in loader.sniffers]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.sniffers): continue else: stream.initialize(loader.sniffers[choice - 1]) elif choice == 4: while True: choice = util.print_menu([x().which for x in loader.scanner]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.scanner): continue else: stream.initialize(loader.scanner[choice - 1]) elif choice == 5: while True: choice = util.print_menu([x().which for x in loader.parameter]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.parameter): continue else: stream.initialize(loader.parameter[choice - 1]) elif choice == 6: while True: choice = util.print_menu([x().which for x in loader.services]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.services): continue else: stream.initialize(loader.services[choice - 1]) elif choice == 7: while True: choice = util.print_menu([x().which for x in loader.attacks]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.attacks): continue else: stream.initialize(loader.attacks[choice - 1]) elif choice == 8: session_manager.menu() elif choice == -1: pass
def main(): """ Zarp entry point """ # set up configuration config.initialize() # set up database database.initialize() # load modules loader = LoadedModules() loader.load() Msg("Loaded %d modules." % loader.total) # handle command line options first if len(argv) > 1: parse_cmd.parse(argv, loader) # menus main_menu = ["Poisoners", "DoS Attacks", "Sniffers", "Scanners", "Parameter", "Services", "Attacks", "Sessions"] running = True choice = -1 while running: header() choice = print_menu(main_menu) if choice == 0: # check if they've got running sessions! cnt = stream.get_session_count() if cnt > 0: choice = raw_input( color.YELLOW + "You have %d sessions running. Are you sure? [Y/n] " % cnt + color.END ) if "y" in choice.lower() or choice == "": Msg("Shutting all sessions down...") stream.stop_session("all", -1) running = False # recheck that all sessions are down cnt = stream.get_session_count() if cnt <= 0: # some libs dont clean up their own threads, so # we need to hard quit those to avoid hanging; FIXME _exit(1) else: debug("Exiting with session count: %d" % (cnt)) Msg("Exiting...") running = False elif choice == 1: while True: choice = print_menu([x().which for x in loader.poison]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.poison): continue else: stream.initialize(loader.poison[choice - 1]) elif choice == 2: while True: choice = print_menu([x().which for x in loader.dos]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.dos): continue else: stream.initialize(loader.dos[choice - 1]) elif choice == 3: while True: choice = print_menu([x().which for x in loader.sniffers]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.sniffers): continue else: stream.initialize(loader.sniffers[choice - 1]) elif choice == 4: while True: choice = print_menu([x().which for x in loader.scanner]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.scanner): continue else: stream.initialize(loader.scanner[choice - 1]) elif choice == 5: while True: choice = print_menu([x().which for x in loader.parameter]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.parameter): continue else: stream.initialize(loader.parameter[choice - 1]) elif choice == 6: while True: choice = print_menu([x().which for x in loader.services]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.services): continue else: stream.initialize(loader.services[choice - 1]) elif choice == 7: while True: choice = print_menu([x().which for x in loader.attacks]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.attacks): continue else: stream.initialize(loader.attacks[choice - 1]) elif choice == 8: session_manager.menu() elif choice == -1: pass
def main(): """ Zarp entry point """ # handle command line options first if len(sys.argv) > 1: parse_cmd.parse(sys.argv) # set up configuration config.initialize() # menus main_menu = [ 'Poisoners', 'DoS Attacks', 'Sniffers', 'Scanners', 'Parameter', 'Services', 'Sessions' ] # load modules loader = LoadedModules() loader.load() Msg('Loaded %d modules.' % loader.total) running = True choice = -1 while running: header() choice = print_menu(main_menu) if choice == 0: # check if they've got running sessions! cnt = stream.get_session_count() if cnt > 0: Msg('You have %d sessions running. Are you sure?' % cnt) choice = raw_input('> ') if 'y' in choice.lower(): Msg('Shutting all sessions down...') stream.stop_session('all', -1) running = False else: debug("Exiting with session count: %d" % (cnt)) Msg("Exiting...") running = False elif choice == 1: while True: choice = print_menu([x().which for x in loader.poison]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.poison): continue else: stream.initialize(loader.poison[choice - 1], 'POISON') elif choice == 2: while True: choice = print_menu([x().which for x in loader.dos]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.dos): continue else: stream.initialize(loader.dos[choice - 1], 'DOS') elif choice == 3: while True: choice = print_menu([x().which for x in loader.sniffers]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.sniffers): continue else: stream.initialize(loader.sniffers[choice - 1], 'SNIFFER') elif choice == 4: while True: choice = print_menu([x().which for x in loader.scanner]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.scanner): continue else: stream.initialize(loader.scanner[choice - 1], 'SCANNER') elif choice == 5: while True: choice = print_menu([x().which for x in loader.parameter]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.parameter): continue else: stream.initialize(loader.parameter[choice - 1], 'PARAMETER') elif choice == 6: while True: choice = print_menu([x().which for x in loader.services]) if choice == 0: break elif choice == -1: pass elif choice > len(loader.services): continue else: stream.initialize(loader.services[choice - 1], 'SERVICE') elif choice == 7: session_manager.menu() elif choice == -1: pass
def main_menu(): ''' main navigation menu ''' menuOptions = [ "record your feels", "review your feels", "check out your neighbors", "browse global feels", "scribble some graffiti\t(new!)", "change your settings", "send some feedback", "see credits", "read documentation"] print("you're at ttbp home. remember, you can always press <ctrl-c> to come back here.\n") util.print_menu(menuOptions, RAINBOW) try: choice = raw_input("\ntell me about your feels (or 'quit' to exit): ") except KeyboardInterrupt: redraw(EJECT) return main_menu() if choice == '0': redraw() today = time.strftime("%Y%m%d") write_entry(os.path.join(DATA, today+".txt")) core.www_neighbors() elif choice == '1': if core.publishing(): intro = "here are some options for reviewing your feels:" redraw(intro) review_menu(intro) core.load_files() core.write("index.html") else: redraw("your recorded feels, listed by date:") view_feels(USER) elif choice == '2': users = core.find_ttbps() redraw("the following "+p.no("user", len(users))+" "+p.plural("is", len(users))+" recording feels on ttbp:") view_neighbors(users) elif choice == '3': redraw("most recent global entries") view_feed() elif choice == '4': graffiti_handler() elif choice == '5': redraw("now changing your settings. press <ctrl-c> if you didn't mean to do this.") try: core.load(setup()) # reload settings to core except KeyboardInterrupt(): redraw(EJECT) redraw() elif choice == '6': redraw("you're about to send mail to ~endorphant about ttbp") feedback_menu() elif choice == '7': redraw() show_credits() elif choice == '8': subprocess.call(["lynx", os.path.join(SOURCE, "..", "README.html")]) redraw() elif choice in QUITS: return stop() else: redraw(INVALID) return main_menu()