def import_(ctx, mode, path): """Imports an older Cuckoo setup into a new CWD. The old setup should be identified by PATH and the new CWD may be specified with the --cwd parameter, e.g., "cuckoo --cwd /tmp/cwd import old-cuckoo".""" if mode == "symlink" and is_windows(): sys.exit(red( "You can only use the 'symlink' mode on non-Windows platforms." )) print yellow("You are importing an existing Cuckoo setup. Please") print yellow("understand that, depending on the mode taken, if ") print yellow("you remove the old Cuckoo setup after this import ") print yellow("you may still"), red("loose ALL of your data!") print print yellow("Additionally, database migrations will be performed ") print yellow("in-place. You won't be able to use your old Cuckoo ") print yellow("setup anymore afterwards! However, we'll provide ") print yellow("you with the option to create a SQL backup beforehand.") print print red("TL;DR Cleaning the old setup after the import may") print red("corrupt your new setup: its SQL, MongoDB, and ") print red("ElasticSearch database may be dropped and, in 'symlink'") print red("mode, the analyses removed.") print value = click.confirm( "... I've read the above and understand the consequences", False ) if not value: sys.exit(red("Aborting operation.. please try again!")) try: import_cuckoo(ctx.parent.user, mode, path) except KeyboardInterrupt: print(red("Aborting import of Cuckoo instance.."))
def import_(ctx, mode, path): """Imports an older Cuckoo setup into a new CWD. The old setup should be identified by PATH and the new CWD may be specified with the --cwd parameter, e.g., "cuckoo --cwd /tmp/cwd import old-cuckoo".""" if os.path.exists(os.path.join(path, ".cwd")): print(yellow( "The 'cuckoo import' feature is meant to import a legacy Cuckoo, " "i.e., Cuckoo 1.2, 2.0-dev, 2.0-rc1, or 2.0-rc2 into a new Cuckoo " "CWD." )) print(red( "You're attempting to import an existing Cuckoo CWD. To upgrade " "Cuckoo / your CWD, simply run 'pip install -U cuckoo' and re-run " "the cuckoo commands!" )) sys.exit(1) if mode == "symlink" and is_windows(): sys.exit(red( "You can only use the 'symlink' mode on non-Windows platforms." )) print yellow("You are importing an existing Cuckoo setup. Please") print yellow("understand that, depending on the mode taken, if ") print yellow("you remove the old Cuckoo setup after this import ") print yellow("you may still"), red("lose ALL of your data!") print print yellow("Additionally, database migrations will be performed ") print yellow("in-place*. You won't be able to use your old Cuckoo ") print yellow("setup anymore afterwards! However, we'll provide ") print yellow("you with the option to create a SQL backup beforehand.") print print red("TL;DR Cleaning the old setup after the import may") print red("corrupt your new setup: its SQL, MongoDB, and ") print red("ElasticSearch database may be dropped and, in 'symlink'") print red("mode, the analyses removed.") print print yellow("*: Except for sqlite3 databases in combination with") print yellow(" the import 'copy' approach.") print value = click.confirm( "... I've read the above and understand the consequences", False ) if not value: sys.exit(red("Aborting operation.. please try again!")) try: import_cuckoo(ctx.parent.user, mode, path) except KeyboardInterrupt: print(red("Aborting import of Cuckoo instance.."))
def import_(ctx, mode, path): """Import an older Cuckoo setup into a new CWD. The old setup should be identified by PATH and the new CWD may be specified with the --cwd parameter, e.g., "cuckoo --cwd /tmp/cwd import old-cuckoo".""" if os.path.exists(os.path.join(path, ".cwd")): print(yellow( "The 'cuckoo import' feature is meant to import a legacy Cuckoo, " "i.e., Cuckoo 1.2, 2.0-dev, 2.0-rc1, or 2.0-rc2 into a new Cuckoo " "CWD." )) print(red( "You're attempting to import an existing Cuckoo CWD. To upgrade " "Cuckoo / your CWD, simply run 'pip install -U cuckoo' and re-run " "the cuckoo commands!" )) sys.exit(1) if mode == "symlink" and is_windows(): sys.exit(red( "You can only use the 'symlink' mode on non-Windows platforms." )) print yellow("You are importing an existing Cuckoo setup. Please") print yellow("understand that, depending on the mode taken, if ") print yellow("you remove the old Cuckoo setup after this import ") print yellow("you may still"), red("lose ALL of your data!") print print yellow("Additionally, database migrations will be performed ") print yellow("in-place*. You won't be able to use your old Cuckoo ") print yellow("setup anymore afterwards! However, we'll provide ") print yellow("you with the option to create a SQL backup beforehand.") print print red("TL;DR Cleaning the old setup after the import may") print red("corrupt your new setup: its SQL, MongoDB, and ") print red("ElasticSearch database may be dropped and, in 'symlink'") print red("mode, the analyses removed.") print print yellow("*: Except for sqlite3 databases in combination with") print yellow(" the import 'copy' approach.") print value = click.confirm( "... I've read the above and understand the consequences", False ) if not value: sys.exit(red("Aborting operation.. please try again!")) try: import_cuckoo(ctx.parent.user, mode, path) except KeyboardInterrupt: print(red("Aborting import of Cuckoo instance.."))