def list_tools(self): message.title() index_tools = 1 print(util.color(' [#] Available Tools: \n')) for key, tool in sorted(self.loaded_tools.items()): print('\t' + str(index_tools) + ")\t" + tool.tool_name) index_tools += 1 print("\nCoffee > Did you Check it?") print("Coffee > " +util.color("[ Press Enter to go back to the menu ]", bold=True)) print() return
def tool_title(name, version): scanner_title = "=" * 80 + "\n" scanner_title += " " * 30 + util.color("CoffeeNet " + name, bold=True) + "\n" scanner_title += " " * 60 + "Version : " + version + "\n" scanner_title += "=" * 80 + "\n" os.system("clear") print(scanner_title)
def print_service(service_data): open_port = service_data["open_ports"] if open_port == None: print("Coffee > " + util.color("It has no open ports")) return print("="*80) print("{:^10}{:^20}{:^30}".format('port', 'service', 'version')) print() for port_num in open_port: print("{:^10}{:^20}{:^35}".format(str(port_num), open_port[port_num]['service'], open_port[port_num]['version'])) print("="*80) print()
def info(): info_data = " " + "=" * 59 + "\n" info_data += "|" + " Hi, I am normaltic." + " " * 39 + "|\n" info_data += "|" + " CoffeeNet is for Small Network like cafe, library, etc " + "|\n" info_data += "|" + " " * 59 + "|\n" info_data += "|" + " Scan your Network using scanner tool in CoffeeNet " + " " * 8 + "|\n" info_data += "|" + " And If you want, YOU CAN create sniffing ENV " + " " * 13 + "|\n" info_data += "|" + " Enjoy your HACK LIFE " + " " * 37 + "|\n" info_data += " " + "=" * 59 + "\n" info_data += "\n" + util.color("USAGE") + "\n" info_data += " Command[info]\t->\tinfo [Number or tool_name]\n" info_data += " Command[use]\t->\tuse [Number or Tool Name] \n" print(info_data) return
def get_interface(): print("Select the interface you want to use\n") interface_list = netifaces.interfaces() for x in range(len(interface_list)): print("\t" + str(x+1) +")\t" + str(interface_list[x])) print("\n\n") while True: select = "" select = input("Coffee < ") if len(select.split()) == 2: if(select.split()[0] == "use" and select.split()[1].isdigit()): select = int(select.split()[1]) else: print(util.color("It is not Available command", warning=True)) continue elif select.isdigit(): select = int(select) else: if select.startswith("help"): print("Coffee > You need to type number") continue else: print(util.color("It is not Available command", warning=True)) continue if 0 < select <= len(interface_list): return interface_list[select-1] else: print("Coffee > " + util.color("It is not Availabe!!!",warning=True)+"\n") print("Coffee > Select Again") print("Coffee > If you need Help, Type help")
def main_menu(self): user_command = "" menu_show = True try: while user_command == "": if menu_show: message.title() print(util.color("Coffee :", warning=True)+"\t" + util.color(str(self.number_of_tools)) + " tools loaded\n") print("Availabe Commands:\n") for command in list(self.mainmenu_commands.keys()): print("\t" + util.color(command) + "\t\t\t" + self.mainmenu_commands[command]) print() user_command = input("Coffee < ").strip() if user_command.startswith('list'): self.list_tools() menu_show = False user_command = '' elif user_command.startswith('use'): #check user command ( use [number or tool name] ) if len(user_command.split()) == 1: # Not enought Param self.list_tools() menu_show = False elif len(user_command.split()) == 2: tool_select = user_command.split()[1] # check it is number if tool_select.isdigit() and 0 < int(tool_select) <= self.number_of_tools: tool_index = 1 for key, tool_obj in sorted(self.loaded_tools.items()): if int(tool_select) == tool_index: tool_obj.main_menu() tool_index += 1 main_show = True else: tool_index += 1 menu_show = True # check it is tool name else: for key, tool_obj in sorted(self.loaded_tools.items()): if tool_select.lower() == tool_obj.tool_name.lower(): tool_obj.main_menu() menu_show = True else: pass user_command = '' elif user_command.startswith('info'): if len(user_command.split()) == 1: menu_show = False message.info() user_command = '' elif len(user_command.split()) == 2: info_select = user_command.split()[1] if info_select.isdigit() and 0<int(info_select) <= self.number_of_tools: tool_index = 1 for key, tool_obj in sorted(self.loaded_tools.items()): if int(info_select) == tool_index: print() print(util.color(tool_obj.tool_name) + tool_obj.description) print() menu_show = False tool_index += 1 # in case, tool name input else: for key, tool_obj in sorted(self.loaded_tools.items()): if info_select.lower() == tool_obj.tool_name.lower(): print() print(util.color(tool_obj.tool_name) + tool_obj.description) print() menu_show = False user_command = '' else: user_command = '' menu_show = True elif user_command.startswith('exit'): print("\n\n" + util.color("Exit CoffeeNet... Have a Good Day!", warning=True)) sys.exit() elif user_command.startswith('update'): user_command = '' menu_show = False print("Coffee > Sorry, \"Update\" Command is not supported in 1.0 Version.") else: menu_show = True user_command = '' except KeyboardInterrupt: print("\n\n" + util.color("Exit CoffeeNet... Have a Good Day!", warning=True)) sys.exit()
def print_info(interface, ip, gateway_ip, ip_range): cidr = ip_range.split("/")[1] print("Selected Interface\t:\t" + util.color(interface)) print("Local IP Address\t:\t" + util.color(ip)) print("Gateway IP Address\t:\t" + util.color(gateway_ip)) print("\n")