def load_all_args(module_names, graph_names):
    # Language Options
    # import libs
    default_config = _builder(_core_config(), _core_default_config())
    _all_profiles = [key for key in _builder(_profiles(), default_profiles())]
    _all_profiles.append("all")
    language_list = [lang for lang in messages(-1, 0)]
    if "-L" in sys.argv or "--language" in sys.argv:
        try:
            index = sys.argv.index("-L") + 1
        except:
            index = sys.argv.index("--language") + 1
    else:
        index = -1
    if index is -1:
        language = "en"
    else:
        _error_flag = False
        try:
            language = sys.argv[index]
        except:
            _error_flag = True
        if _error_flag or language not in language_list:
            __die_failure("Please select one of these languages {0}".format(
                language_list))

    # Check if compatible
    check(language)
    finish()
    # Start Parser
    parser = argparse.ArgumentParser(prog="Nettacker", add_help=False)

    # parser = OptionParser(usage=messages(language, 1),
    #                      description=messages(language, 2),
    #                      epilog=messages(language, 3))

    # Engine Options
    engineOpt = parser.add_argument_group(messages(language, 4),
                                          messages(language, 5))
    engineOpt.add_argument("-L",
                           "--language",
                           action="store",
                           dest="language",
                           default=default_config["language"],
                           help=messages(language, 6).format(language_list))
    engineOpt.add_argument("-v",
                           "--verbose",
                           action="store",
                           dest="verbose_level",
                           default=default_config["verbose_level"],
                           help=messages(language, 59))
    engineOpt.add_argument("-V",
                           "--version",
                           action="store_true",
                           default=default_config["show_version"],
                           dest="show_version",
                           help=messages(language, 60))
    engineOpt.add_argument("-c",
                           "--update",
                           action="store_true",
                           default=default_config["check_update"],
                           dest="check_update",
                           help=messages(language, 61))
    engineOpt.add_argument("-o",
                           "--output",
                           action="store",
                           default=default_config["log_in_file"],
                           dest="log_in_file",
                           help=messages(language, 11))
    engineOpt.add_argument("--graph",
                           action="store",
                           default=default_config["graph_flag"],
                           dest="graph_flag",
                           help=messages(language, 86).format(graph_names))
    engineOpt.add_argument("-h",
                           "--help",
                           action="store_true",
                           default=default_config["help_menu_flag"],
                           dest="help_menu_flag",
                           help=messages(language, 2))
    engineOpt.add_argument("-W",
                           "--wizard",
                           action="store_true",
                           default=default_config["wizard_mode"],
                           dest="wizard_mode",
                           help=messages(language, 107))
    engineOpt.add_argument("--profile",
                           action="store",
                           default=default_config["profile"],
                           dest="profile",
                           help=messages(language, 136).format(_all_profiles))

    # Target Options
    target = parser.add_argument_group(messages(language, 12),
                                       messages(language, 13))
    target.add_argument("-i",
                        "--targets",
                        action="store",
                        dest="targets",
                        default=default_config["targets"],
                        help=messages(language, 14))
    target.add_argument("-l",
                        "--targets-list",
                        action="store",
                        dest="targets_list",
                        default=default_config["targets_list"],
                        help=messages(language, 15))

    # Exclude Module Name
    exclude_names = module_names[:]
    exclude_names.remove("all")

    # Methods Options
    method = parser.add_argument_group(messages(language, 142),
                                       messages(language, 16))
    method.add_argument("-m",
                        "--method",
                        action="store",
                        dest="scan_method",
                        default=default_config["scan_method"],
                        help=messages(language, 17).format(module_names))
    method.add_argument("-x",
                        "--exclude",
                        action="store",
                        dest="exclude_method",
                        default=default_config["exclude_method"],
                        help=messages(language, 18).format(exclude_names))
    method.add_argument("-u",
                        "--usernames",
                        action="store",
                        dest="users",
                        default=default_config["users"],
                        help=messages(language, 19))
    method.add_argument("-U",
                        "--users-list",
                        action="store",
                        dest="users_list",
                        default=default_config["users_list"],
                        help=messages(language, 20))
    method.add_argument("-p",
                        "--passwords",
                        action="store",
                        dest="passwds",
                        default=default_config["passwds"],
                        help=messages(language, 21))
    method.add_argument("-P",
                        "--passwords-list",
                        action="store",
                        dest="passwds_list",
                        default=default_config["passwds_list"],
                        help=messages(language, 22))
    method.add_argument("-g",
                        "--ports",
                        action="store",
                        dest="ports",
                        default=default_config["ports"],
                        help=messages(language, 23))
    method.add_argument("-T",
                        "--timeout",
                        action="store",
                        dest="timeout_sec",
                        default=default_config["timeout_sec"],
                        type=float,
                        help=messages(language, 24))
    method.add_argument("-w",
                        "--time-sleep",
                        action="store",
                        dest="time_sleep",
                        default=default_config["time_sleep"],
                        type=float,
                        help=messages(language, 25))
    method.add_argument("-r",
                        "--range",
                        action="store_true",
                        default=default_config["check_ranges"],
                        dest="check_ranges",
                        help=messages(language, 7))
    method.add_argument("-s",
                        "--sub-domains",
                        action="store_true",
                        default=default_config["check_subdomains"],
                        dest="check_subdomains",
                        help=messages(language, 8))
    method.add_argument("-t",
                        "--thread-connection",
                        action="store",
                        default=default_config["thread_number"],
                        type=int,
                        dest="thread_number",
                        help=messages(language, 9))
    method.add_argument("-M",
                        "--thread-hostscan",
                        action="store",
                        default=default_config["thread_number_host"],
                        type=int,
                        dest="thread_number_host",
                        help=messages(language, 10))
    method.add_argument("-R",
                        "--socks-proxy",
                        action="store",
                        dest="socks_proxy",
                        default=default_config["socks_proxy"],
                        help=messages(language, 62))
    method.add_argument("--retries",
                        action="store",
                        dest="retries",
                        type=int,
                        default=default_config["retries"],
                        help=messages(language, 64))
    method.add_argument("--ping-before-scan",
                        action="store_true",
                        dest="ping_flag",
                        default=default_config["ping_flag"],
                        help=messages(language, 99))
    method.add_argument("--method-args",
                        action="store",
                        dest="methods_args",
                        default=default_config["methods_args"],
                        help=messages(language, 35))
    method.add_argument("--method-args-list",
                        action="store_true",
                        dest="method_args_list",
                        default=default_config["method_args_list"],
                        help=messages(language, 111))

    # API Options
    api = parser.add_argument_group(messages(language, 143),
                                    messages(language, 144))
    api.add_argument("--start-api",
                     action="store_true",
                     dest="start_api",
                     default=default_config["start_api"],
                     help=messages(language, 145))
    api.add_argument("--api-host",
                     action="store",
                     dest="api_host",
                     default=default_config["api_host"],
                     help=messages(language, 146))
    api.add_argument("--api-port",
                     action="store",
                     dest="api_port",
                     default=default_config["api_port"],
                     help=messages(language, 147))
    api.add_argument("--api-debug-mode",
                     action="store_true",
                     dest="api_debug_mode",
                     default=default_config["api_debug_mode"],
                     help=messages(language, 148))
    api.add_argument("--api-access-key",
                     action="store",
                     dest="api_access_key",
                     default=default_config["api_access_key"],
                     help=messages(language, 149))
    api.add_argument("--api-client-white-list",
                     action="store_true",
                     dest="api_client_white_list",
                     default=default_config["api_client_white_list"],
                     help=messages(language, 150))
    api.add_argument("--api-client-white-list-ips",
                     action="store",
                     dest="api_client_white_list_ips",
                     default=default_config["api_client_white_list_ips"],
                     help=messages(language, 151))
    api.add_argument("--api-access-log",
                     action="store_true",
                     dest="api_access_log",
                     default=default_config["api_access_log"],
                     help=messages(language, 152))
    api.add_argument("--api-access-log-filename",
                     action="store",
                     dest="api_access_log_filename",
                     default=default_config["api_access_log_filename"],
                     help=messages(language, 153))

    # Return Options
    return [
        parser,
        parser.parse_args(), default_config["startup_check_for_update"]
    ]
Exemple #2
0
def load_all_args(module_names, graph_names):
    """
    create the ARGS and help menu

    Args:
        module_names: all module names
        graph_names: all graph names

    Returns:
        the parser, the ARGS
    """
    # Language Options
    # import libs
    default_config = _builder(_core_config(), _core_default_config())
    _all_profiles = [key for key in _builder(_profiles(), default_profiles())]
    _all_profiles.append("all")
    language_list = [lang for lang in messages(-1, 0)]
    if "-L" in sys.argv or "--language" in sys.argv:
        try:
            index = sys.argv.index("-L") + 1
        except Exception:
            index = sys.argv.index("--language") + 1
    else:
        index = -1
    if index == -1:
        language = "en"
    else:
        _error_flag = False
        try:
            language = sys.argv[index]
        except Exception:
            _error_flag = True
        if _error_flag or language not in language_list:
            __die_failure(
                "Please select one of these languages {0}".format(
                    language_list
                )
            )

    # Check if compatible
    check(language)
    finish()
    # Start Parser
    parser = argparse.ArgumentParser(prog="Nettacker", add_help=False)

    # parser = OptionParser(usage=messages(language,"options"),
    #                      description=messages(language,"help_menu"),
    #                      epilog=messages(language,"license"))

    # Engine Options
    engineOpt = parser.add_argument_group(
        messages(language, "engine"), messages(language, "engine_input")
    )
    engineOpt.add_argument(
        "-L",
        "--language",
        action="store",
        dest="language",
        default=default_config["language"],
        help=messages(language, "select_language").format(language_list),
    )
    engineOpt.add_argument(
        "-v",
        "--verbose",
        action="store",
        type=int,
        dest="verbose_level",
        default=default_config["verbose_level"],
        help=messages(language, "verbose_level"),
    )
    engineOpt.add_argument(
        "-V",
        "--version",
        action="store_true",
        default=default_config["show_version"],
        dest="show_version",
        help=messages(language, "software_version"),
    )
    engineOpt.add_argument(
        "-c",
        "--update",
        action="store_true",
        default=default_config["check_update"],
        dest="check_update",
        help=messages(language, "check_updates"),
    )
    engineOpt.add_argument(
        "-o",
        "--output",
        action="store",
        default=default_config["log_in_file"],
        dest="log_in_file",
        help=messages(language, "save_logs"),
    )
    engineOpt.add_argument(
        "--graph",
        action="store",
        default=default_config["graph_flag"],
        dest="graph_flag",
        help=messages(language, "available_graph").format(graph_names),
    )
    engineOpt.add_argument(
        "-h",
        "--help",
        action="store_true",
        default=default_config["help_menu_flag"],
        dest="help_menu_flag",
        help=messages(language, "help_menu"),
    )
    engineOpt.add_argument(
        "-W",
        "--wizard",
        action="store_true",
        default=default_config["wizard_mode"],
        dest="wizard_mode",
        help=messages(language, "wizard_mode"),
    )
    engineOpt.add_argument(
        "--profile",
        action="store",
        default=default_config["profile"],
        dest="profile",
        help=messages(language, "select_profile").format(_all_profiles),
    )

    # Target Options
    target = parser.add_argument_group(
        messages(language, "target"), messages(language, "target_input")
    )
    target.add_argument(
        "-i",
        "--targets",
        action="store",
        dest="targets",
        default=default_config["targets"],
        help=messages(language, "target_list"),
    )
    target.add_argument(
        "-l",
        "--targets-list",
        action="store",
        dest="targets_list",
        default=default_config["targets_list"],
        help=messages(language, "read_target"),
    )

    # Exclude Module Name
    exclude_names = module_names[:]
    exclude_names.remove("all")

    # Methods Options
    method = parser.add_argument_group(
        messages(language, "Method"), messages(language, "scan_method_options")
    )
    method.add_argument(
        "-m",
        "--method",
        action="store",
        dest="scan_method",
        default=default_config["scan_method"],
        help=messages(language, "choose_scan_method").format(module_names),
    )
    method.add_argument(
        "-x",
        "--exclude",
        action="store",
        dest="exclude_method",
        default=default_config["exclude_method"],
        help=messages(language, "exclude_scan_method").format(exclude_names),
    )
    method.add_argument(
        "-u",
        "--usernames",
        action="store",
        dest="users",
        default=default_config["users"],
        help=messages(language, "username_list"),
    )
    method.add_argument(
        "-U",
        "--users-list",
        action="store",
        dest="users_list",
        default=default_config["users_list"],
        help=messages(language, "username_from_file"),
    )
    method.add_argument(
        "-p",
        "--passwords",
        action="store",
        dest="passwds",
        default=default_config["passwds"],
        help=messages(language, "password_seperator"),
    )
    method.add_argument(
        "-P",
        "--passwords-list",
        action="store",
        dest="passwds_list",
        default=default_config["passwds_list"],
        help=messages(language, "read_passwords"),
    )
    method.add_argument(
        "-g",
        "--ports",
        action="store",
        dest="ports",
        default=default_config["ports"],
        help=messages(language, "port_seperator"),
    )
    method.add_argument(
        "-T",
        "--timeout",
        action="store",
        dest="timeout_sec",
        default=default_config["timeout_sec"],
        type=float,
        help=messages(language, "read_passwords"),
    )
    method.add_argument(
        "-w",
        "--time-sleep",
        action="store",
        dest="time_sleep",
        default=default_config["time_sleep"],
        type=float,
        help=messages(language, "time_to_sleep"),
    )
    method.add_argument(
        "-r",
        "--range",
        action="store_true",
        default=default_config["check_ranges"],
        dest="check_ranges",
        help=messages(language, "range"),
    )
    method.add_argument(
        "-s",
        "--sub-domains",
        action="store_true",
        default=default_config["check_subdomains"],
        dest="check_subdomains",
        help=messages(language, "subdomains"),
    )
    method.add_argument(
        "-t",
        "--thread-connection",
        action="store",
        default=default_config["thread_number"],
        type=int,
        dest="thread_number",
        help=messages(language, "thread_number_connections"),
    )
    method.add_argument(
        "-M",
        "--thread-hostscan",
        action="store",
        default=default_config["thread_number_host"],
        type=int,
        dest="thread_number_host",
        help=messages(language, "thread_number_hosts"),
    )
    method.add_argument(
        "-R",
        "--socks-proxy",
        action="store",
        dest="socks_proxy",
        default=default_config["socks_proxy"],
        help=messages(language, "outgoing_proxy"),
    )
    method.add_argument(
        "--retries",
        action="store",
        dest="retries",
        type=int,
        default=default_config["retries"],
        help=messages(language, "connection_retries"),
    )
    method.add_argument(
        "--ping-before-scan",
        action="store_true",
        dest="ping_flag",
        default=default_config["ping_flag"],
        help=messages(language, "ping_before_scan"),
    )
    method.add_argument(
        "--method-args",
        action="store",
        dest="methods_args",
        default=default_config["methods_args"],
        help=messages(language, "method_inputs"),
    )
    method.add_argument(
        "--method-args-list",
        action="store_true",
        dest="method_args_list",
        default=default_config["method_args_list"],
        help=messages(language, "list_methods"),
    )
    # API Options
    api = parser.add_argument_group(
        messages(language, "API"), messages(language, "API_options"))
    api.add_argument("--start-api", action="store_true",
                     dest="start_api", default=default_config["start_api"],
                     help=messages(language, "start_API"))
    api.add_argument("--api-host", action="store",
                     dest="api_host", default=default_config["api_host"],
                     help=messages(language, "API_host"))
    api.add_argument("--api-port", action="store",
                     dest="api_port", default=default_config["api_port"],
                     help=messages(language, "API_port"))
    api.add_argument("--api-debug-mode", action="store_true",
                     dest="api_debug_mode", default=default_config["api_debug_mode"],
                     help=messages(language, "API_debug"))
    api.add_argument("--api-access-key", action="store",
                     dest="api_access_key", default=default_config["api_access_key"],
                     help=messages(language, "API_access_key"))
    api.add_argument("--api-client-white-list", action="store_true",
                     dest="api_client_white_list", default=default_config["api_client_white_list"],
                     help=messages(language, "white_list_API"))
    api.add_argument("--api-client-white-list-ips", action="store",
                     dest="api_client_white_list_ips", default=default_config["api_client_white_list_ips"],
                     help=messages(language, "define_whie_list"))
    api.add_argument("--api-access-log", action="store_true",
                     dest="api_access_log", default=default_config["api_access_log"],
                     help=messages(language, "gen_API_access_log"))
    api.add_argument("--api-access-log-filename", action="store",
                     dest="api_access_log_filename", default=default_config["api_access_log_filename"],
                     help=messages(language, "API_access_log_file"))
    api.add_argument("--api-cert", action="store", dest="api_cert", help=messages(language, "API_cert"))
    api.add_argument("--api-cert-key", action="store", dest="api_cert_key", help=messages(language, "API_cert_key"))
    # Return Options
    return [
        parser,
        parser.parse_args(),
        default_config["startup_check_for_update"],
    ]
def load_all_args(module_names, graph_names):
    # Language Options
    # import libs
    from core.color import finish
    default_config = _builder(get_config())
    language_list = [lang for lang in messages(-1, 0)]
    if "-L" in sys.argv or "--language" in sys.argv:
        try:
            index = sys.argv.index("-L") + 1
        except:
            index = sys.argv.index("--language") + 1
    else:
        index = -1
    if index is -1:
        language = "en"
    else:
        _error_flag = False
        try:
            language = sys.argv[index]
        except:
            _error_flag = True
        if _error_flag or language not in language_list:
            error("Please select one of these languages {0}".format(
                language_list))
            finish()
            sys.exit(1)

    # Check if compatible
    check(language)
    finish()
    # Start Parser
    parser = argparse.ArgumentParser(prog="Nettacker", add_help=False)

    # parser = OptionParser(usage=messages(language, 1),
    #                      description=messages(language, 2),
    #                      epilog=messages(language, 3))

    # Engine Options
    engineOpt = parser.add_argument_group(messages(language, 4),
                                          messages(language, 5))
    engineOpt.add_argument("-L",
                           "--language",
                           action="store",
                           dest="language",
                           default=default_config["language"],
                           help=messages(language, 6).format(language_list))
    engineOpt.add_argument("-v",
                           "--verbose",
                           action="store",
                           dest="verbose_level",
                           default=default_config["verbose_level"],
                           help=messages(language, 59))
    engineOpt.add_argument("-V",
                           "--version",
                           action="store_true",
                           default=default_config["show_version"],
                           dest="show_version",
                           help=messages(language, 60))
    engineOpt.add_argument("-c",
                           "--update",
                           action="store_true",
                           default=default_config["check_update"],
                           dest="check_update",
                           help=messages(language, 61))
    engineOpt.add_argument("-o",
                           "--output",
                           action="store",
                           default=default_config["log_in_file"],
                           dest="log_in_file",
                           help=messages(language, 11))
    engineOpt.add_argument("--graph",
                           action="store",
                           default=default_config["graph_flag"],
                           dest="graph_flag",
                           help=messages(language, 86).format(graph_names))
    engineOpt.add_argument("-h",
                           "--help",
                           action="store_true",
                           default=default_config["help_menu_flag"],
                           dest="help_menu_flag",
                           help=messages(language, 2))

    # Target Options
    target = parser.add_argument_group(messages(language, 12),
                                       messages(language, 13))
    target.add_argument("-i",
                        "--targets",
                        action="store",
                        dest="targets",
                        default=default_config["targets"],
                        help=messages(language, 14))
    target.add_argument("-l",
                        "--targets-list",
                        action="store",
                        dest="targets_list",
                        default=default_config["targets_list"],
                        help=messages(language, 15))

    # Exclude Module Name
    exclude_names = module_names[:]
    exclude_names.remove('all')

    # Methods Options
    method = parser.add_argument_group("Method", messages(language, 16))
    method.add_argument("-m",
                        "--method",
                        action="store",
                        dest="scan_method",
                        default=default_config["scan_method"],
                        help=messages(language, 17).format(module_names))
    method.add_argument("-x",
                        "--exclude",
                        action="store",
                        dest="exclude_method",
                        default=default_config["exclude_method"],
                        help=messages(language, 18).format(exclude_names))
    method.add_argument("-u",
                        "--usernames",
                        action="store",
                        dest="users",
                        default=default_config["users"],
                        help=messages(language, 19))
    method.add_argument("-U",
                        "--users-list",
                        action="store",
                        dest="users_list",
                        default=default_config["users_list"],
                        help=messages(language, 20))
    method.add_argument("-p",
                        "--passwords",
                        action="store",
                        dest="passwds",
                        default=default_config["passwds"],
                        help=messages(language, 21))
    method.add_argument("-P",
                        "--passwords-list",
                        action="store",
                        dest="passwds_list",
                        default=default_config["passwds_list"],
                        help=messages(language, 22))
    method.add_argument("-g",
                        "--ports",
                        action="store",
                        dest="ports",
                        default=default_config["ports"],
                        help=messages(language, 23))
    method.add_argument("-T",
                        "--timeout",
                        action="store",
                        dest="timeout_sec",
                        default=default_config["timeout_sec"],
                        type=float,
                        help=messages(language, 24))
    method.add_argument("-w",
                        "--time-sleep",
                        action="store",
                        dest="time_sleep",
                        default=default_config["time_sleep"],
                        type=float,
                        help=messages(language, 25))
    method.add_argument("-r",
                        "--range",
                        action="store_true",
                        default=default_config["check_ranges"],
                        dest="check_ranges",
                        help=messages(language, 7))
    method.add_argument("-s",
                        "--sub-domains",
                        action="store_true",
                        default=default_config["check_subdomains"],
                        dest="check_subdomains",
                        help=messages(language, 8))
    method.add_argument("-t",
                        "--thread-connection",
                        action="store",
                        default=default_config["thread_number"],
                        type=int,
                        dest="thread_number",
                        help=messages(language, 9))
    method.add_argument("-M",
                        "--thread-hostscan",
                        action="store",
                        default=default_config["thread_number_host"],
                        type=int,
                        dest="thread_number_host",
                        help=messages(language, 10))
    method.add_argument("-R",
                        "--socks-proxy",
                        action="store",
                        dest="proxies",
                        default=default_config["socks_proxy"],
                        help=messages(language, 62))
    method.add_argument("--retries",
                        action="store",
                        dest="retries",
                        type=int,
                        default=default_config["retries"],
                        help=messages(language, 64))
    method.add_argument('--ping-before-scan',
                        action="store_true",
                        dest='ping_flag',
                        default=default_config["ping_flag"],
                        help=messages(language, 99))
    method.add_argument('--method-args',
                        action="store",
                        dest="methods_args",
                        default=default_config["methods_args"],
                        help=messages(language, 35))
    method.add_argument('--method-args-list',
                        action='store_true',
                        dest='method_args_list',
                        default=default_config["method_args_list"],
                        help=messages(language, 111))
    # Return Options
    return [
        parser,
        parser.parse_args(), default_config["startup_check_for_update"]
    ]
Exemple #4
0
def load_all_args(module_names):
    # Language Options
    language_list = [lang for lang in messages(-1, 0)]
    if "-L" in sys.argv or "--language" in sys.argv:
        try:
            index = sys.argv.index("-L") + 1
        except:
            index = sys.argv.index("-language") + 1
    else:
        index = -1
    if index is -1:
        language = "en"
    else:
        language = sys.argv[index]
        if language not in language_list:
            sys.exit(
                error("Please select one of these languages {0}".format(
                    language_list)))

    # Check if compatible
    check(language)

    # Start Parser
    parser = OptionParser(usage=messages(language, 1),
                          description=messages(language, 2),
                          epilog=messages(language, 3))
    # Engine Options
    engineOpt = OptionGroup(parser, messages(language, 4),
                            messages(language, 5))
    engineOpt.add_option("-L",
                         "--language",
                         action="store",
                         dest="language",
                         default="en",
                         help=messages(language, 6).format(language_list))
    engineOpt.add_option("-v",
                         "--verbose",
                         action="store",
                         dest="verbose_level",
                         default=0,
                         help=messages(language, 59))
    engineOpt.add_option("-V",
                         "--version",
                         action="store_true",
                         default=False,
                         dest="show_version",
                         help=messages(language, 60))
    engineOpt.add_option("-c",
                         "--update",
                         action="store_true",
                         default=False,
                         dest="check_update",
                         help=messages(language, 61))
    engineOpt.add_option("-o",
                         "--output",
                         action="store",
                         default="results.txt",
                         dest="log_in_file",
                         help=messages(language, 11))

    # Build Engine Options
    parser.add_option_group(engineOpt)

    # Target Options
    target = OptionGroup(parser, messages(language, 12),
                         messages(language, 13))
    target.add_option("-i",
                      "--targets",
                      action="store",
                      dest="targets",
                      default=None,
                      help=messages(language, 14))
    target.add_option("-l",
                      "--targets-list",
                      action="store",
                      dest="targets_list",
                      default=None,
                      help=messages(language, 15))
    # Build Options
    parser.add_option_group(target)

    # Methods Options
    method = OptionGroup(parser, "Method", messages(language, 16))
    method.add_option("-m",
                      "--method",
                      action="store",
                      dest="scan_method",
                      default=None,
                      help=messages(language, 17).format(module_names))
    method.add_option("-x",
                      "--exclude",
                      action="store",
                      dest="exclude_method",
                      default=None,
                      help=messages(language, 18).format(module_names))
    method.add_option("-u",
                      "--usernames",
                      action="store",
                      dest="users",
                      default=None,
                      help=messages(language, 19))
    method.add_option("-U",
                      "--users-list",
                      action="store",
                      dest="users_list",
                      default=None,
                      help=messages(language, 20))
    method.add_option("-p",
                      "--passwords",
                      action="store",
                      dest="passwds",
                      default=None,
                      help=messages(language, 21))
    method.add_option("-P",
                      "--passwords-list",
                      action="store",
                      dest="passwds_list",
                      default=None,
                      help=messages(language, 22))
    method.add_option("-g",
                      "--ports",
                      action="store",
                      dest="ports",
                      default=None,
                      help=messages(language, 23))
    method.add_option("-T",
                      "--timeout",
                      action="store",
                      dest="timeout_sec",
                      default=None,
                      type="float",
                      help=messages(language, 24))
    method.add_option("-w",
                      "--time-sleep",
                      action="store",
                      dest="time_sleep",
                      default=None,
                      type="float",
                      help=messages(language, 25))
    method.add_option("-r",
                      "--range",
                      action="store_true",
                      default=False,
                      dest="check_ranges",
                      help=messages(language, 7))
    method.add_option("-s",
                      "--sub-domains",
                      action="store_true",
                      default=False,
                      dest="check_subdomains",
                      help=messages(language, 8))
    method.add_option("-t",
                      "--thread-connection",
                      action="store",
                      default=10,
                      type="int",
                      dest="thread_number",
                      help=messages(language, 9))
    method.add_option("-M",
                      "--thread-hostscan",
                      action="store",
                      default=10,
                      type="int",
                      dest="thread_number_host",
                      help=messages(language, 10))
    method.add_option("-R",
                      "--proxy",
                      action="store",
                      dest="proxies",
                      default=None,
                      help=messages(language, 62))
    method.add_option("--proxy-list",
                      action="store",
                      dest="proxies",
                      default=None,
                      help=messages(language, 63))
    method.add_option("--retries",
                      action="store",
                      dest="retries",
                      default=3,
                      help=messages(language, 64))
    # Build Options
    parser.add_option_group(method)

    # Return Options
    return [parser, parser.parse_args()]
Exemple #5
0
'''
OWASP ZSC | ZCR Shellcoder

ZeroDay Cyber Research
Z3r0D4y.Com
Ali Razmjoo
'''
import time
import sys
import os
from time import strftime,gmtime
from core import start
from core import argv_control
from lib import analyser
from core.compatible import check
def main(): #main function
	'''
	main function of ZCR Shellcoder
	'''
	if argv_control.exist() is not True: #if execute without any argv
		start.start() #show start page and exit
	else:
		if argv_control.check() is True: #check argv, if entered accurately
			analyser.do(argv_control.run()) #go for generating
			start.sig() #print software signature and exit
		else:
			start.inputcheck()
if __name__ == "__main__":
	check() #check os and python version if compatible
	main() #execute main function
Exemple #6
0
#!/usr/bin/env python
'''
Nmapalayzer
'''
import sys
from core.pyversion import version
from core import compatible
from core import argv
from lib import run
version = version()
compatible.check()
if argv.checkup() is True:
	inputs = argv.inputanalysis()
	fname = inputs[0].rsplit('file:')[1]
	mod = inputs[1].rsplit('mod:')[1]
	run.execute(fname,mod)
else:
	argv.wronginput()
Exemple #7
0
def do(cont):
    content = cont.rsplit("\x90\x90\x90")
    os_name, filename, encode_type, job = content[0], content[1], content[2], content[3]
    shellcode = None
    if "freebsd_x64" in os_name:
        if "chmod(" in job:
            from lib.generator.freebsd_x64 import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.freebsd_x64 import dir_create

            shellcode = dir_create.run(dir_creator(job))
        if "download(" in job:
            from lib.generator.freebsd_x64 import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.freebsd_x64 import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.freebsd_x64 import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.freebsd_x64 import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.freebsd_x64 import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.freebsd_x64 import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.freebsd_x64 import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if "freebsd_x86" in os_name:
        if "chmod(" in job:
            from lib.generator.freebsd_x86 import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.freebsd_x86 import dir_create

            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if "download(" in job:
            from lib.generator.freebsd_x86 import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.freebsd_x86 import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.freebsd_x86 import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.freebsd_x86 import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.freebsd_x86 import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.freebsd_x86 import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.freebsd_x86 import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if "linux_arm" in os_name:
        if "chmod(" in job:
            from lib.generator.linux_arm import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.linux_arm import dir_create

            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if "download(" in job:
            from lib.generator.linux_arm import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.linux_arm import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.linux_arm import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.linux_arm import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.linux_arm import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.linux_arm import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.linux_arm import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if "linux_mips" in os_name:
        if "chmod(" in job:
            from lib.generator.linux_mips import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.linux_mips import dir_create

            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if "download(" in job:
            from lib.generator.linux_mips import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.linux_mips import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.linux_mips import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.linux_mips import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.linux_mips import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.linux_mips import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.linux_mips import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if "linux_x64" in os_name:
        if "chmod(" in job:
            from lib.generator.linux_x64 import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.linux_x64 import dir_create

            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if "download(" in job:
            from lib.generator.linux_x64 import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.linux_x64 import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.linux_x64 import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.linux_x64 import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.linux_x64 import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.linux_x64 import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.linux_x64 import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if "linux_x86" in os_name:
        if "chmod(" in job:
            from lib.generator.linux_x86 import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.linux_x86 import dir_create

            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if "download(" in job:
            from lib.generator.linux_x86 import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.linux_x86 import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.linux_x86 import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.linux_x86 import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.linux_x86 import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.linux_x86 import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.linux_x86 import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if "osx" in os_name:
        if "chmod(" in job:
            from lib.generator.osx import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.osx import dir_create

            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if "download(" in job:
            from lib.generator.osx import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.osx import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.osx import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.osx import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.osx import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.osx import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.osx import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if "solaris_x64" in os_name:
        if "chmod(" in job:
            from lib.generator.solaris_x64 import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.solaris_x64 import dir_create

            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if "download(" in job:
            from lib.generator.solaris_x64 import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.solaris_x64 import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.solaris_x64 import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.solaris_x64 import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.solaris_x64 import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.solaris_x64 import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.solaris_x64 import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if "solaris_x86" in os_name:
        if "chmod(" in job:
            from lib.generator.solaris_x86 import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.solaris_x86 import dir_create

            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if "download(" in job:
            from lib.generator.solaris_x86 import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.solaris_x86 import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.solaris_x86 import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.solaris_x86 import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.solaris_x86 import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.solaris_x86 import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.solaris_x86 import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if "windows_x64" in os_name:
        if "chmod(" in job:
            from lib.generator.windows_x64 import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.windows_x64 import dir_create

            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if "download(" in job:
            from lib.generator.windows_x64 import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.windows_x64 import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.windows_x64 import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.windows_x64 import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.windows_x64 import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.windows_x64 import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.windows_x64 import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if "windows_x86" in os_name:
        if "chmod(" in job:
            from lib.generator.windows_x86 import chmod

            values = chmod_spliter(job).rsplit("\x90\x90\x90")
            shellcode = chmod.run(values[0], values[1])
        if "dir_create(" in job:
            from lib.generator.windows_x86 import dir_create

            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if "download(" in job:
            from lib.generator.windows_x86 import download

            values = download_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download.run(values[0], values[1])
        if "download_execute(" in job:
            from lib.generator.windows_x86 import download_execute

            values = download_exec_spliter(job).rsplit("\x90\x90\x90")
            shellcode = download_execute.run(values[0], values[1], values[2])
        if "exec(" in job:
            from lib.generator.windows_x86 import exc

            shellcode = exc.run(executor(job))
        if "file_create(" in job:
            from lib.generator.windows_x86 import file_create

            values = file_creator(job).rsplit("\x90\x90\x90")
            shellcode = file_create.run(values[0], values[1])
        if "script_executor(" in job:
            from lib.generator.windows_x86 import script_executor

            values = script_exec(job).rsplit("\x90\x90\x90")
            shellcode = script_executor.run(values[0], values[1], values[2])
        if "system(" in job:
            from lib.generator.windows_x86 import system

            shellcode = system.run(syst(job))
        if "write(" in job:
            from lib.generator.windows_x86 import write

            values = file_writer(job).rsplit("\x90\x90\x90")
            shellcode = write.run(values[0], values[1])
    if shellcode == "N":
        done.disable(os_name, job)
        return 0
    old_encode_type = ""
    if shellcode is not None:
        shellcode = (
            encode.process(encode_type, shellcode, os_name, job)
            .replace("\n\n", "\n")
            .replace("\n\n", "\n")
            .replace("    ", " ")
            .replace("   ", " ")
        )
        NE = False
        if shellcode[0] == "N":
            shellcode = shellcode[1:]
            NE = True
            old_encode_type = encode_type
            encode_type = "none"
            # tmpname = '.tmp.'+filename
            # save = open(tmpname,'w')
            # save.write(shellcode)
            # save.close()
    comment = shellcode
    res = '"' + opcode.generator(shellcode, os_name) + '"'
    """
	tmp = os.popen('as %s -o %s.o > .tmp2.%s'%(tmpname,tmpname,tmpname)).read()
	comment = os.popen('objdump -D %s.o'%(tmpname)).read()
	comment = comment.replace('.tmp.'+filename+'.o',filename).replace('\n\n','\n')
	res = os.popen('''objdump -D %s.o |grep '[0-9a-f]:'|grep -v 'file'|cut -f2 -d:|cut -f1-6 -d' '|tr -s ' '|tr '\t' ' '|sed 's/ $//g'|sed 's/ /\\x/g'|paste -d '' -s |sed 's/^/"/'|sed 's/$/"/g' '''%(tmpname)).read()
	res = res.replace('x','\\x').rsplit()[0]
	null = os.system('rm -rf %s %s.o .tmp2.%s'%(tmpname,tmpname,tmpname))
	"""
    PASS = False
    if str(len(res) % 2) == "0":
        PASS = True
    shellcode = done.c_style(
        job,
        os_name,
        encode_type,
        str(int(len(res) / 4)),
        comment,
        str(filename.rsplit(".")[0]) + "_compiled",
        str(filename),
        res,
    )
    compatible.check()  # clear screen
    done.res(PASS, shellcode, filename, os_name, job, encode_type, str(int(len(res) / 4)), old_encode_type, NE)
Exemple #8
0
def do(cont):
    content = cont.rsplit('\x90\x90\x90')
    os_name, filename, encode_type, job = content[0], content[1], content[
        2], content[3]
    shellcode = None
    if 'freebsd_x64' in os_name:
        if 'chmod(' in job:
            from lib.generator.freebsd_x64 import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.freebsd_x64 import dir_create
            shellcode = dir_create.run(dir_creator(job))
        if 'download(' in job:
            from lib.generator.freebsd_x64 import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.freebsd_x64 import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.freebsd_x64 import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.freebsd_x64 import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.freebsd_x64 import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.freebsd_x64 import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.freebsd_x64 import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if 'freebsd_x86' in os_name:
        if 'chmod(' in job:
            from lib.generator.freebsd_x86 import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.freebsd_x86 import dir_create
            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if 'download(' in job:
            from lib.generator.freebsd_x86 import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.freebsd_x86 import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.freebsd_x86 import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.freebsd_x86 import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.freebsd_x86 import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.freebsd_x86 import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.freebsd_x86 import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if 'linux_arm' in os_name:
        if 'chmod(' in job:
            from lib.generator.linux_arm import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.linux_arm import dir_create
            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if 'download(' in job:
            from lib.generator.linux_arm import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.linux_arm import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.linux_arm import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.linux_arm import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.linux_arm import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.linux_arm import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.linux_arm import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if 'linux_mips' in os_name:
        if 'chmod(' in job:
            from lib.generator.linux_mips import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.linux_mips import dir_create
            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if 'download(' in job:
            from lib.generator.linux_mips import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.linux_mips import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.linux_mips import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.linux_mips import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.linux_mips import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.linux_mips import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.linux_mips import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if 'linux_x64' in os_name:
        if 'chmod(' in job:
            from lib.generator.linux_x64 import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.linux_x64 import dir_create
            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if 'download(' in job:
            from lib.generator.linux_x64 import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.linux_x64 import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.linux_x64 import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.linux_x64 import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.linux_x64 import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.linux_x64 import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.linux_x64 import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if 'linux_x86' in os_name:
        if 'chmod(' in job:
            from lib.generator.linux_x86 import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.linux_x86 import dir_create
            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if 'download(' in job:
            from lib.generator.linux_x86 import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.linux_x86 import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.linux_x86 import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.linux_x86 import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.linux_x86 import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.linux_x86 import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.linux_x86 import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if 'osx' in os_name:
        if 'chmod(' in job:
            from lib.generator.osx import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.osx import dir_create
            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if 'download(' in job:
            from lib.generator.osx import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.osx import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.osx import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.osx import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.osx import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.osx import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.osx import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if 'solaris_x64' in os_name:
        if 'chmod(' in job:
            from lib.generator.solaris_x64 import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.solaris_x64 import dir_create
            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if 'download(' in job:
            from lib.generator.solaris_x64 import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.solaris_x64 import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.solaris_x64 import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.solaris_x64 import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.solaris_x64 import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.solaris_x64 import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.solaris_x64 import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if 'solaris_x86' in os_name:
        if 'chmod(' in job:
            from lib.generator.solaris_x86 import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.solaris_x86 import dir_create
            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if 'download(' in job:
            from lib.generator.solaris_x86 import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.solaris_x86 import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.solaris_x86 import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.solaris_x86 import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.solaris_x86 import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.solaris_x86 import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.solaris_x86 import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if 'windows_x64' in os_name:
        if 'chmod(' in job:
            from lib.generator.windows_x64 import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.windows_x64 import dir_create
            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if 'download(' in job:
            from lib.generator.windows_x64 import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.windows_x64 import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.windows_x64 import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.windows_x64 import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.windows_x64 import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.windows_x64 import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.windows_x64 import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if 'windows_x86' in os_name:
        if 'chmod(' in job:
            from lib.generator.windows_x86 import chmod
            values = chmod_spliter(job).rsplit('\x90\x90\x90')
            shellcode = chmod.run(values[0], values[1])
        if 'dir_create(' in job:
            from lib.generator.windows_x86 import dir_create
            value = dir_creator(job)
            shellcode = dir_create.run(value)
        if 'download(' in job:
            from lib.generator.windows_x86 import download
            values = download_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download.run(values[0], values[1])
        if 'download_execute(' in job:
            from lib.generator.windows_x86 import download_execute
            values = download_exec_spliter(job).rsplit('\x90\x90\x90')
            shellcode = download_execute.run(values[0], values[1], values[2])
        if 'exec(' in job:
            from lib.generator.windows_x86 import exc
            shellcode = exc.run(executor(job))
        if 'file_create(' in job:
            from lib.generator.windows_x86 import file_create
            values = file_creator(job).rsplit('\x90\x90\x90')
            shellcode = file_create.run(values[0], values[1])
        if 'script_executor(' in job:
            from lib.generator.windows_x86 import script_executor
            values = script_exec(job).rsplit('\x90\x90\x90')
            shellcode = script_executor.run(values[0], values[1], values[2])
        if 'system(' in job:
            from lib.generator.windows_x86 import system
            shellcode = system.run(syst(job))
        if 'write(' in job:
            from lib.generator.windows_x86 import write
            values = file_writer(job).rsplit('\x90\x90\x90')
            shellcode = write.run(values[0], values[1])
    if shellcode == 'N':
        done.disable(os_name, job)
        return 0
    old_encode_type = ''
    if shellcode is not None:
        shellcode = encode.process(encode_type, shellcode, os_name,
                                   job).replace('\n\n', '\n').replace(
                                       '\n\n',
                                       '\n').replace('    ',
                                                     ' ').replace('   ', ' ')
        NE = False
        if shellcode[0] == 'N':
            shellcode = shellcode[1:]
            NE = True
            old_encode_type = encode_type
            encode_type = 'none'
    #tmpname = '.tmp.'+filename
    #save = open(tmpname,'w')
    #save.write(shellcode)
    #save.close()
    comment = shellcode
    res = '"' + opcode.generator(shellcode, os_name) + '"'
    '''
	tmp = os.popen('as %s -o %s.o > .tmp2.%s'%(tmpname,tmpname,tmpname)).read()
	comment = os.popen('objdump -D %s.o'%(tmpname)).read()
	comment = comment.replace('.tmp.'+filename+'.o',filename).replace('\n\n','\n')
	res = os.popen(\'''objdump -D %s.o |grep '[0-9a-f]:'|grep -v 'file'|cut -f2 -d:|cut -f1-6 -d' '|tr -s ' '|tr '\t' ' '|sed 's/ $//g'|sed 's/ /\\x/g'|paste -d '' -s |sed 's/^/"/'|sed 's/$/"/g' \'''%(tmpname)).read()
	res = res.replace('x','\\x').rsplit()[0]
	null = os.system('rm -rf %s %s.o .tmp2.%s'%(tmpname,tmpname,tmpname))
	'''
    PASS = False
    if str(len(res) % 2) == '0':
        PASS = True
    shellcode = done.c_style(job, os_name, encode_type, str(int(len(res) / 4)),
                             comment,
                             str(filename.rsplit('.')[0]) + '_compiled',
                             str(filename), res)
    compatible.check()  #clear screen
    done.res(PASS, shellcode, filename, os_name, job, encode_type,
             str(int(len(res) / 4)), old_encode_type, NE)