From 36e426c8693e8543e075e4c3a49976ecbe8a8956 Mon Sep 17 00:00:00 2001 From: TGLuis Date: Mon, 25 May 2020 21:23:15 +0200 Subject: [PATCH] Adding an option to display the version and quit change v to V to be coherent with setup.py --- cuckoo/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cuckoo/main.py b/cuckoo/main.py index 14500cfbe0..8bb5282fdd 100644 --- a/cuckoo/main.py +++ b/cuckoo/main.py @@ -248,6 +248,7 @@ def handle_sigterm(sig, f): stop() @click.group(invoke_without_command=True) +@click.option("-V", "--version", is_flag=True, help="Display the version of Cuckoo") @click.option("-d", "--debug", is_flag=True, help="Enable verbose logging") @click.option("-q", "--quiet", is_flag=True, help="Only log warnings and critical messages") @click.option("--nolog", is_flag=True, help="Don't log to file.") @@ -256,7 +257,7 @@ def handle_sigterm(sig, f): @click.option("--user", help="Drop privileges to this user") @click.option("--cwd", help="Cuckoo Working Directory") @click.pass_context -def main(ctx, debug, quiet, nolog, maxcount, ignore_vuln, user, cwd): +def main(ctx, version, debug, quiet, nolog, maxcount, ignore_vuln, user, cwd): """Invoke the Cuckoo daemon or one of its subcommands. To be able to use different Cuckoo configurations on the same machine with @@ -271,6 +272,10 @@ def main(ctx, debug, quiet, nolog, maxcount, ignore_vuln, user, cwd): * Current directory (if the ".cwd" file exists) * Default value ("~/.cuckoo") """ + if version: + print(cuckoo.misc.version) + return + decide_cwd(cwd) # Drop privileges.