diff --git a/README.md b/README.md index 4b60f9e2..5c4b31fe 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ optional arguments: -t N, --timeout N timeout (in seconds) for connection and reading (default: 5) -v, --verbose enable verbose output + -V, --version show version and exit --conn-rate-test N[:max_rate] perform a connection rate test (useful for collecting metrics related to susceptibility of the DHEat vuln). diff --git a/src/ssh_audit/ssh_audit.py b/src/ssh_audit/ssh_audit.py index 67b90db9..20a37ab9 100755 --- a/src/ssh_audit/ssh_audit.py +++ b/src/ssh_audit/ssh_audit.py @@ -786,6 +786,7 @@ def process_commandline(out: OutputBuffer, args: List[str]) -> 'AuditConf': # p parser.add_argument("-T", "--targets", action="store", dest="targets", metavar="targets.txt", type=str, default=None, help="a file containing a list of target hosts (one per line, format HOST[:PORT]). Use -p/--port to set the default port for all hosts. Use --threads to control concurrent scans") parser.add_argument("-t", "--timeout", action="store", dest="timeout", metavar="N", type=int, default=5, help="timeout (in seconds) for connection and reading (default: %(default)s)") parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", default=False, help="enable verbose output") + parser.add_argument("-V", "--version", action="store_true", dest="version", default=False, help="show version and exit") # Add long options to the parser parser.add_argument("--conn-rate-test", action="store", dest="conn_rate_test", metavar="N[:max_rate]", type=str, default=None, help="perform a connection rate test (useful for collecting metrics related to susceptibility of the DHEat vuln). Testing is conducted with N concurrent sockets with an optional maximum rate of connections per second") @@ -810,6 +811,11 @@ def process_commandline(out: OutputBuffer, args: List[str]) -> 'AuditConf': # p try: argument = parser.parse_args(args=args) + # Print version and exit. + if argument.version is True: + print(VERSION) + sys.exit(exitcodes.GOOD) + # Set simple flags. aconf.client_audit = argument.client_audit aconf.ipv4 = argument.ipv4 diff --git a/ssh-audit.1 b/ssh-audit.1 index 24f60d51..1d22eabe 100644 --- a/ssh-audit.1 +++ b/ssh-audit.1 @@ -166,6 +166,11 @@ The number of threads to use when scanning multiple targets (with -T/--targets). .br Enable verbose output. +.TP +.B -V, \-\-version +.br +Show version and exit. + .SH STANDARD AUDIT .PP