mirror of
https://github.com/cuckoosandbox/cuckoo.git
synced 2026-10-12 02:12:40 +00:00
discourage users from importing cuckoo cwd setups
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2016-2017 Cuckoo Foundation.
|
||||
# Copyright (C) 2016-2018 Cuckoo Foundation.
|
||||
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
|
||||
# See the file 'docs/LICENSE' for copying permission.
|
||||
|
||||
@@ -127,7 +127,7 @@ def import_cuckoo(username, mode, dirpath):
|
||||
if not version:
|
||||
raise CuckooOperationalError(
|
||||
"The path that you specified is not a proper Cuckoo setup. Please "
|
||||
"point the path to the root of your older Cuckoo setup, i.e., to "
|
||||
"point the path to the root of your legacy Cuckoo setup, i.e., to "
|
||||
"the directory containing the cuckoo.py script!"
|
||||
)
|
||||
|
||||
|
||||
@@ -627,6 +627,19 @@ 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."
|
||||
|
||||
+13
-1
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2016-2017 Cuckoo Foundation.
|
||||
# Copyright (C) 2016-2018 Cuckoo Foundation.
|
||||
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
|
||||
# See the file 'docs/LICENSE' for copying permission.
|
||||
|
||||
@@ -298,6 +298,18 @@ def init_import_legacy(mode):
|
||||
assert not os.path.exists(cwd(analysis="latest"))
|
||||
return dirpath
|
||||
|
||||
def test_import_cuckoo_cwd(capsys):
|
||||
set_cwd(tempfile.mkdtemp())
|
||||
cuckoo_create()
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
main.main(
|
||||
("--cwd", cwd(), "import", cwd()), standalone_mode=False
|
||||
)
|
||||
|
||||
out, _ = capsys.readouterr()
|
||||
assert "import a legacy Cuckoo" in out
|
||||
|
||||
def test_import_legacy_analyses_copy():
|
||||
dirpath = init_import_legacy("copy")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user