diff --git a/cme/cli.py b/cme/cli.py index e701b52c..cbf69b22 100755 --- a/cme/cli.py +++ b/cme/cli.py @@ -190,7 +190,7 @@ def gen_cli_args(): protocol_object = p_loader.load_protocol(protocols[protocol]["argspath"]) subparsers = protocol_object.proto_args(subparsers, std_parser, module_parser) except: - cme_logger.exception("Error loading proto_args from proto_args.py file in protocol folder: {}".format(protocol)) + cme_logger.exception(f"Error loading proto_args from proto_args.py file in protocol folder: {protocol}") if len(sys.argv) == 1: parser.print_help() diff --git a/cme/loaders/protocolloader.py b/cme/loaders/protocolloader.py index 981aefce..da359909 100755 --- a/cme/loaders/protocolloader.py +++ b/cme/loaders/protocolloader.py @@ -35,12 +35,12 @@ class ProtocolLoader: db_file_path = path_join(path, protocol_name, "database.py") db_nav_path = path_join(path, protocol_name, "db_navigator.py") - protocol_args_path = path_join(path, protocol_name, 'proto_args.py') + protocol_args_path = path_join(path, protocol_name, "proto_args.py") if exists(db_file_path): protocols[protocol_name]["dbpath"] = db_file_path if exists(db_nav_path): protocols[protocol_name]["nvpath"] = db_nav_path if exists(protocol_args_path): - protocols[protocol_name]['argspath'] = protocol_args_path + protocols[protocol_name]["argspath"] = protocol_args_path return protocols diff --git a/cme/protocols/ftp/proto_args.py b/cme/protocols/ftp/proto_args.py index a7594c97..3dbf9b5c 100644 --- a/cme/protocols/ftp/proto_args.py +++ b/cme/protocols/ftp/proto_args.py @@ -1,5 +1,5 @@ def proto_args(parser, std_parser, module_parser): - ftp_parser = parser.add_parser('ftp', help="own stuff using FTP", parents=[std_parser, module_parser]) + ftp_parser = parser.add_parser("ftp", help="own stuff using FTP", parents=[std_parser, module_parser]) ftp_parser.add_argument("--port", type=int, default=21, help="FTP port (default: 21)") # TODO: Create more options for the protocol diff --git a/cme/protocols/winrm/proto_args.py b/cme/protocols/winrm/proto_args.py index 95da58ff..bf884793 100644 --- a/cme/protocols/winrm/proto_args.py +++ b/cme/protocols/winrm/proto_args.py @@ -1,23 +1,23 @@ def proto_args(parser, std_parser, module_parser): - winrm_parser = parser.add_parser('winrm', help="own stuff using WINRM", parents=[std_parser, module_parser]) - winrm_parser.add_argument("-H", '--hash', metavar="HASH", dest='hash', nargs='+', default=[], help='NTLM hash(es) or file(s) containing NTLM hashes') + winrm_parser = parser.add_parser("winrm", help="own stuff using WINRM", parents=[std_parser, module_parser]) + winrm_parser.add_argument("-H", "--hash", metavar="HASH", dest="hash", nargs="+", default=[], help="NTLM hash(es) or file(s) containing NTLM hashes") winrm_parser.add_argument("--port", type=int, default=0, help="Custom WinRM port") - winrm_parser.add_argument("--ssl", action='store_true', help="Connect to SSL Enabled WINRM") - winrm_parser.add_argument("--ignore-ssl-cert", action='store_true', help="Ignore Certificate Verification") - winrm_parser.add_argument("--laps", dest='laps', metavar="LAPS", type=str, help="LAPS authentification", nargs='?', const='administrator') - winrm_parser.add_argument("--http-timeout", dest='http_timeout', type=int, default=10, help="HTTP timeout for WinRM connections") + winrm_parser.add_argument("--ssl", action="store_true", help="Connect to SSL Enabled WINRM") + winrm_parser.add_argument("--ignore-ssl-cert", action="store_true", help="Ignore Certificate Verification") + winrm_parser.add_argument("--laps", dest="laps", metavar="LAPS", type=str, help="LAPS authentification", nargs="?", const="administrator") + winrm_parser.add_argument("--http-timeout", dest="http_timeout", type=int, default=10, help="HTTP timeout for WinRM connections") dgroup = winrm_parser.add_mutually_exclusive_group() - dgroup.add_argument("-d", metavar="DOMAIN", dest='domain', type=str, default=None, help="domain to authenticate to") - dgroup.add_argument("--local-auth", action='store_true', help='authenticate locally to each target') + dgroup.add_argument("-d", metavar="DOMAIN", dest="domain", type=str, default=None, help="domain to authenticate to") + dgroup.add_argument("--local-auth", action="store_true", help="authenticate locally to each target") cgroup = winrm_parser.add_argument_group("Credential Gathering", "Options for gathering credentials") cegroup = cgroup.add_mutually_exclusive_group() - cegroup.add_argument("--sam", action='store_true', help='dump SAM hashes from target systems') - cegroup.add_argument("--lsa", action='store_true', help='dump LSA secrets from target systems') + cegroup.add_argument("--sam", action="store_true", help="dump SAM hashes from target systems") + cegroup.add_argument("--lsa", action="store_true", help="dump LSA secrets from target systems") cgroup = winrm_parser.add_argument_group("Command Execution", "Options for executing commands") - cgroup.add_argument('--no-output', action='store_true', help='do not retrieve command output') - cgroup.add_argument("-x", metavar="COMMAND", dest='execute', help="execute the specified command") - cgroup.add_argument("-X", metavar="PS_COMMAND", dest='ps_execute', help='execute the specified PowerShell command') + cgroup.add_argument("--no-output", action="store_true", help="do not retrieve command output") + cgroup.add_argument("-x", metavar="COMMAND", dest="execute", help="execute the specified command") + cgroup.add_argument("-X", metavar="PS_COMMAND", dest="ps_execute", help="execute the specified PowerShell command") return parser \ No newline at end of file