コード例 #1
0
def get_credentials():
    """
    Get credentials either through the saved configurations or
    through interactive setup mode.
    Args:
        None
    Raises:
        None
    Returns:
        final_creds (dict): Collected credentials
    """
    args = get_args()
    debug = bool(args.debug)
    final_creds = {"debug": debug}

    # Create ArgsHelper object for collecting configurations
    args_helper_obj = args_helper.ArgsHelper(args=args)

    if int(platform.sys.version_info[0]) < 3:  # if Python 2.X.X
        config_decision = raw_input(
            "[!] Do you want to use the saved configuratons? (Y/y): ").strip(
                " ")
    else:
        config_decision = str(
            input("[!] Do you want to use the saved configuratons? (Y/y): ")
        ).strip(" ")
    if (config_decision.lower() == "y"):
        _extracted_from_get_credentials_21(args_helper_obj, final_creds)
    else:
        _extracted_from_get_credentials_49(args_helper_obj, final_creds)
    return final_creds
コード例 #2
0
def get_credentials():
    """
    Get credentials either through the saved configurations or
    through interactive setup mode.

    Args:
        None

    Raises:
        None

    Returns:
        final_creds (dict): Collected credentials
    """
    args = get_args()
    debug = bool(args.debug)
    final_creds = {"debug": debug}

    # Create ArgsHelper object for collecting configurations
    args_helper_obj = args_helper.ArgsHelper(args=args)

    if int(platform.sys.version_info[0]) < 3:  # if Python 2.X.X
        config_decision = raw_input("[!] Do you want to use the saved configuratons? (Y/y): ").strip(" ")
    else:
        config_decision = str(input("[!] Do you want to use the saved configuratons? (Y/y): ")).strip(" ")
    if (config_decision.lower() == "y"):
        # Fetch credentials
        creds = args_helper_obj.securetea_conf.get_creds(args_helper_obj.args)

        if creds.get("firewall"):
            _extracted_from_get_credentials_24(
                final_creds,
                "firewall",
                creds,
                "\n[!] Select network interface for Firewall",
            )

        if creds.get("ids"):
            _extracted_from_get_credentials_24(
                final_creds,
                "ids",
                creds,
                "\n[!] Select network interface for Intrusion Detection System",
            )

        if creds.get("iot-check"):
            final_creds["iot-check"] = creds["iot-check"]
    else:
        _extracted_from_get_credentials_41(args_helper_obj, final_creds)
    return final_creds
コード例 #3
0
ファイル: system_ep.py プロジェクト: sibudar/security
def get_credentials():
    """
    Get credentials either through the saved configurations or
    through interactive setup mode.

    Args:
        None

    Raises:
        None

    Returns:
        final_creds (dict): Collected credentials
    """
    args = get_args()
    if args.debug:
        debug = True
    else:
        debug = False

    final_creds = {"debug": debug}

    # Create ArgsHelper object for collecting configurations
    args_helper_obj = args_helper.ArgsHelper(args=args)

    if int(platform.sys.version_info[0]) < 3:  # if Python 2.X.X
        config_decision = raw_input("[!] Do you want to use the saved configuratons? (Y/y): ").strip(" ")
    else:
        config_decision = str(input("[!] Do you want to use the saved configuratons? (Y/y): ")).strip(" ")
    if (config_decision.lower() == "Y" or
        config_decision.lower() == "y"):
        # Fetch credentials
        creds = args_helper_obj.securetea_conf.get_creds(args_helper_obj.args)

        if creds.get("firewall"):
            final_creds["firewall"] = creds["firewall"]
            interface = final_creds["firewall"]["interface"]
            if not interface or interface == "XXXX":
                print("\n[!] Select network interface for Firewall")
                interface = get_interface()
                final_creds["firewall"]["interface"] = interface
        if creds.get("ids"):
            final_creds["ids"] = creds["ids"]
            interface = final_creds["ids"]["interface"]
            if not interface or interface == "XXXX":
                print("\n[!] Select network interface for Intrusion Detection System")
                interface = get_interface()
                final_creds["ids"]["interface"] = interface
        if creds.get("antivirus"):
            final_creds["antivirus"] = creds["antivirus"]
    else:
        # Start interactive setup for Firewall
        firewall = args_helper_obj.configureFirewall()
        # Start interactive setup for IDS
        ids = args_helper_obj.configureIDS()
        # Start interactive setup for AntiVirus
        antivirus = args_helper_obj.configureAntiVirus()

        if firewall:
            final_creds["firewall"] = firewall
            interface = final_creds["firewall"]["interface"]
            if not interface or interface == "XXXX":
                print("\n[!] Select network interface for Firewall")
                interface = get_interface()
                final_creds["firewall"]["interface"] = interface
        if ids:
            final_creds["ids"] = ids
            interface = final_creds["ids"]["interface"]
            if not interface or interface == "XXXX":
                print("\n[!] Select network interface for Intrusion Detection System")
                interface = get_interface()
                final_creds["ids"]["interface"] = interface
        if antivirus:
            final_creds["antivirus"] = antivirus

    return final_creds