Пример #1
0
def command_line_arguments() -> argparse.Namespace:
    """Parse the command line arguments"""

    parser = config.common_args("ATT&CK simulator")

    parser.add_argument(
        "-b",
        "--technique-bundle",
        type=Path,
        help="The threat actor file to simulate",
    )

    parser.add_argument('--seeds',
                        type=config.split_arg,
                        help="Entry conditions 'already in place'")
    parser.add_argument('--end-condition',
                        type=str,
                        default="objective_exfiltration",
                        help="What condition is the desired outcome")
    parser.add_argument('--include-techniques',
                        type=config.split_arg,
                        help="Include the following techniques in the "
                        "simulation as accessible to the attacker")
    parser.add_argument('--exclude-techniques',
                        type=config.split_arg,
                        help=("Exclude the following techniques from "
                              "the simulation even if accessible to "
                              "the attacker"))
    parser.add_argument('--show-promises',
                        action='store_true',
                        help="Show available promises on each stage")
    parser.add_argument('--show-tactics',
                        action='store_true',
                        help="Show tactics in paranthesis after techniques "
                        "and the set of all tactics at each stage in a column")
    parser.add_argument('--nop-empty-provides',
                        action='store_true',
                        help="Do not check requires for empty list. "
                        "Remove techniques with empty provides only.")
    parser.add_argument('--include-tools',
                        action='store_true',
                        help="Include techniques for threat actor that "
                        "is inherited from tools used")
    parser.add_argument('--system-conditions',
                        type=config.split_arg,
                        help="List of conditions related to the "
                        "system (e.g. poor_security_practices)")

    args: argparse.Namespace = config.handle_args(parser, "generate")

    if not args.technique_bundle:
        sys.stderr.write("--technique-bundle must be specified\n")
        sys.exit(1)

    return args
Пример #2
0
def command_line_arguments() -> argparse.Namespace:
    """Parse the command line arguments"""

    parser = config.common_args("Show promises")

    parser.add_argument("--promise", type=str,
                        help="Show how this promise is used")


    args = config.handle_args(parser, "show-promise")

    if not args.promise:
        sys.stderr.write("Specify promise with --promise [PROMISE]\n")
        sys.exit(1)

    return args
Пример #3
0
def command_line_arguments() -> argparse.Namespace:
    """Parse the command line arguments"""

    parser = config.common_args("Show a technique")

    parser.add_argument("-t",
                        "--technique",
                        type=str,
                        help="Technique to show")

    args = config.handle_args(parser, "show-technique")

    if not args.technique:
        sys.stderr.write("Specify technique with -t [TECHNIQUE_ID]\n")
        sys.exit(1)

    return args
Пример #4
0
def command_line_arguments() -> argparse.Namespace:
    """parse the command line arguments"""

    parser = config.common_args("Show little or unused promises")

    parser.add_argument("-rl",
                        "--requirelimit",
                        type=int,
                        default=0,
                        help="Show promises with required count "
                        "less than or equal to this")
    parser.add_argument("-pl",
                        "--providelimit",
                        type=int,
                        default=0,
                        help="Show promises with provided count "
                        "less than or equal to this")

    return config.handle_args(parser, "promise-usage")
Пример #5
0
def command_line_arguments() -> argparse.Namespace:
    """Parse the command line arguments"""

    parser = config.common_args("Search techniques")

    parser.add_argument("-p", "--provides", type=config.split_arg,
                        help="Search for techniques providing these promises")
    parser.add_argument("-np", "--notprovides", type=config.split_arg,
                        help="Search for techniques that does _not_ provide promises")
    parser.add_argument("-r", "--requires", type=config.split_arg,
                        help="Search for techniques requires these promises")
    parser.add_argument("-nr", "--notrequires", type=config.split_arg,
                        help="Search for techniques that does _not_ require promises")
    parser.add_argument("-n", "--name", type=config.split_arg,
                        help="Search for techniques whos name contains this string")

    args = config.handle_args(parser, "promise-search")

    if not (args.provides or args.notprovides or args.requires or args.notrequires or args.name):
        sys.stderr.write("Specify at least one search option\n")
        sys.exit(1)

    return args
Пример #6
0
def command_line_arguments() -> argparse.Namespace:
    """Parse the command line arguments"""

    parser = config.common_args("ATT&CK simulator")

    parser.add_argument(
        "-b",
        "--technique-bundle",
        type=Path,
        help="The threat actor file to simulate",
    )

    parser.add_argument('--include-tools', action='store_true',
                        help="Include techniques for threat actor that "
                             "is inherited from tools used")

    args: argparse.Namespace = config.handle_args(parser, "show-bundle")

    if not args.technique_bundle:
        sys.stderr.write("--technique-bundle must be specified\n")
        sys.exit(1)

    return args