def application_language(): from config import nettacker_global_config nettacker_global_configuration = nettacker_global_config() if "-L" in sys.argv: language = find_args_value('-L') or 'en' elif "--language" in sys.argv: language = find_args_value('--language') or 'en' else: language = nettacker_global_configuration['nettacker_user_application_config']['language'] if language not in load_all_languages(): language = 'en' return language
def languages_to_country(): """ define list of languages with country flag for API Returns: HTML code for each language with its country flag """ from core.load_modules import load_all_languages languages = load_all_languages() res = "" flags = { "el": "gr", "fr": "fr", "en": "us", "nl": "nl", "ps": "ps", "tr": "tr", "de": "de", "ko": "kr", "it": "it", "ja": "jp", "fa": "ir", "hy": "am", "ar": "sa", "zh-cn": "cn", "vi": "vi", "ru": "ru", "hi": "in", "ur": "pk", "id": "id", "es": "es", "iw": "il", "pt-br": "br" } for language in languages: res += """<option {2} id="{0}" data-content='<span class="flag-icon flag-icon-{1}" value="{0}"></span> {0}'></option>""".format( language, flags[language], "selected" if language == "en" else "" ) return res
def load_all_args(): """ create the ARGS and help menu Returns: the parser, the ARGS """ nettacker_global_configuration = nettacker_global_config() # Language Options language = application_language() languages_list = load_all_languages() if language not in languages_list: die_failure( "Please select one of these languages {0}".format( languages_list ) ) reset_color() # Start Parser parser = argparse.ArgumentParser(prog="Nettacker", add_help=False) # Engine Options engineOpt = parser.add_argument_group( messages("engine"), messages("engine_input") ) engineOpt.add_argument( "-L", "--language", action="store", dest="language", default=nettacker_global_configuration['nettacker_user_application_config']["language"], help=messages("select_language").format(languages_list), ) engineOpt.add_argument( "-v", "--verbose", action="store_true", dest="verbose_mode", default=nettacker_global_configuration['nettacker_user_application_config']['verbose_mode'], help=messages("verbose_mode"), ) engineOpt.add_argument( "--verbose-event", action="store_true", dest="verbose_event", default=nettacker_global_configuration['nettacker_user_application_config']['verbose_event'], help=messages("verbose_event"), ) engineOpt.add_argument( "-V", "--version", action="store_true", default=nettacker_global_configuration['nettacker_user_application_config']['show_version'], dest="show_version", help=messages("software_version"), ) engineOpt.add_argument( "-o", "--output", action="store", default=nettacker_global_configuration['nettacker_user_application_config']['report_path_filename'], dest="report_path_filename", help=messages("save_logs"), ) engineOpt.add_argument( "--graph", action="store", default=nettacker_global_configuration['nettacker_user_application_config']["graph_name"], dest="graph_name", help=messages("available_graph").format(load_all_graphs()), ) engineOpt.add_argument( "-h", "--help", action="store_true", default=nettacker_global_configuration['nettacker_user_application_config']["show_help_menu"], dest="show_help_menu", help=messages("help_menu"), ) # Target Options target = parser.add_argument_group( messages("target"), messages("target_input") ) target.add_argument( "-i", "--targets", action="store", dest="targets", default=nettacker_global_configuration['nettacker_user_application_config']["targets"], help=messages("target_list"), ) target.add_argument( "-l", "--targets-list", action="store", dest="targets_list", default=nettacker_global_configuration['nettacker_user_application_config']["targets_list"], help=messages("read_target"), ) # Exclude Module Name exclude_modules = list(load_all_modules(limit=10).keys()) exclude_modules.remove("all") # Methods Options modules = parser.add_argument_group( messages("Method"), messages("scan_method_options") ) modules.add_argument( "-m", "--modules", action="store", dest="selected_modules", default=nettacker_global_configuration['nettacker_user_application_config']["selected_modules"], help=messages("choose_scan_method").format(list(load_all_modules(limit=10).keys())), ) modules.add_argument( "--modules-extra-args", action="store", dest="modules_extra_args", default=nettacker_global_configuration['nettacker_user_application_config']['modules_extra_args'], help=messages("modules_extra_args_help") ) modules.add_argument( "--show-all-modules", action="store_true", dest="show_all_modules", default=nettacker_global_configuration['nettacker_user_application_config']["show_all_modules"], help=messages("show_all_modules"), ) modules.add_argument( "--profile", action="store", default=nettacker_global_configuration['nettacker_user_application_config']["profiles"], dest="profiles", help=messages("select_profile").format(list(load_all_profiles(limit=10).keys())), ) modules.add_argument( "--show-all-profiles", action="store_true", dest="show_all_profiles", default=nettacker_global_configuration['nettacker_user_application_config']["show_all_profiles"], help=messages("show_all_profiles"), ) modules.add_argument( "-x", "--exclude-modules", action="store", dest="excluded_modules", default=nettacker_global_configuration['nettacker_user_application_config']["excluded_modules"], help=messages("exclude_scan_method").format(exclude_modules), ) modules.add_argument( "-u", "--usernames", action="store", dest="usernames", default=nettacker_global_configuration['nettacker_user_application_config']["usernames"], help=messages("username_list"), ) modules.add_argument( "-U", "--users-list", action="store", dest="usernames_list", default=nettacker_global_configuration['nettacker_user_application_config']["usernames_list"], help=messages("username_from_file"), ) modules.add_argument( "-p", "--passwords", action="store", dest="passwords", default=nettacker_global_configuration['nettacker_user_application_config']["passwords"], help=messages("password_seperator"), ) modules.add_argument( "-P", "--passwords-list", action="store", dest="passwords_list", default=nettacker_global_configuration['nettacker_user_application_config']["passwords_list"], help=messages("read_passwords"), ) modules.add_argument( "-g", "--ports", action="store", dest="ports", default=nettacker_global_configuration['nettacker_user_application_config']["ports"], help=messages("port_seperator"), ) modules.add_argument( "--user-agent", action="store", dest="user_agent", default=nettacker_global_configuration['nettacker_user_application_config']["user_agent"], help=messages("select_user_agent"), ) modules.add_argument( "-T", "--timeout", action="store", dest="timeout", default=nettacker_global_configuration['nettacker_user_application_config']["timeout"], type=float, help=messages("read_passwords"), ) modules.add_argument( "-w", "--time-sleep-between-requests", action="store", dest="time_sleep_between_requests", default=nettacker_global_configuration['nettacker_user_application_config']["time_sleep_between_requests"], type=float, help=messages("time_to_sleep"), ) modules.add_argument( "-r", "--range", action="store_true", default=nettacker_global_configuration['nettacker_user_application_config']["scan_ip_range"], dest="scan_ip_range", help=messages("range"), ) modules.add_argument( "-s", "--sub-domains", action="store_true", default=nettacker_global_configuration['nettacker_user_application_config']["scan_subdomains"], dest="scan_subdomains", help=messages("subdomains"), ) modules.add_argument( "-t", "--thread-per-host", action="store", default=nettacker_global_configuration['nettacker_user_application_config']["thread_per_host"], type=int, dest="thread_per_host", help=messages("thread_number_connections"), ) modules.add_argument( "-M", "--parallel-module-scan", action="store", default=nettacker_global_configuration['nettacker_user_application_config']["parallel_module_scan"], type=int, dest="parallel_module_scan", help=messages("thread_number_modules"), ) modules.add_argument( "--set-hardware-usage", action="store", dest="set_hardware_usage", default=nettacker_global_configuration['nettacker_user_application_config']['set_hardware_usage'], help=messages("set_hardware_usage") ) modules.add_argument( "-R", "--socks-proxy", action="store", dest="socks_proxy", default=nettacker_global_configuration['nettacker_user_application_config']["socks_proxy"], help=messages("outgoing_proxy"), ) modules.add_argument( "--retries", action="store", dest="retries", type=int, default=nettacker_global_configuration['nettacker_user_application_config']["retries"], help=messages("connection_retries"), ) modules.add_argument( "--ping-before-scan", action="store_true", dest="ping_before_scan", default=nettacker_global_configuration['nettacker_user_application_config']["ping_before_scan"], help=messages("ping_before_scan"), ) # API Options api = parser.add_argument_group( messages("API"), messages("API_options") ) api.add_argument( "--start-api", action="store_true", dest="start_api_server", default=nettacker_global_configuration['nettacker_api_config']["start_api_server"], help=messages("start_api_server") ) api.add_argument( "--api-host", action="store", dest="api_hostname", default=nettacker_global_configuration['nettacker_api_config']["api_hostname"], help=messages("API_host") ) api.add_argument( "--api-port", action="store", dest="api_port", default=nettacker_global_configuration['nettacker_api_config']["api_port"], help=messages("API_port") ) api.add_argument( "--api-debug-mode", action="store_true", dest="api_debug_mode", default=nettacker_global_configuration['nettacker_api_config']["api_debug_mode"], help=messages("API_debug") ) api.add_argument( "--api-access-key", action="store", dest="api_access_key", default=nettacker_global_configuration['nettacker_api_config']["api_access_key"], help=messages("API_access_key") ) api.add_argument( "--api-client-whitelisted-ips", action="store", dest="api_client_whitelisted_ips", default=nettacker_global_configuration['nettacker_api_config']["api_client_whitelisted_ips"], help=messages("define_whie_list") ) api.add_argument( "--api-access-log", action="store", dest="api_access_log", default=nettacker_global_configuration['nettacker_api_config']["api_access_log"], help=messages("API_access_log_file") ) api.add_argument( "--api-cert", action="store", dest="api_cert", help=messages("API_cert") ) api.add_argument( "--api-cert-key", action="store", dest="api_cert_key", help=messages("API_cert_key") ) # Return Options return parser