Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@
#if sys.maxsize > 2**32 and sys.platform == "win32":
# sys.exit("You should install python3 x86! not x64")

AGENT_VERSION = "0.21"
AGENT_VERSION = "0.22"
AGENT_FEATURES = [
"execpy",
"execute",
"pinning",
"logs",
"largefile",
"unicodepath",
"subdir_upload",
]
BASE_64_ENCODING = "base64"

Expand Down Expand Up @@ -592,6 +593,9 @@ def do_store():
return json_error(400, "No file has been provided")

try:
dirpath = os.path.dirname(request.form["filepath"])
if dirpath:
os.makedirs(dirpath, exist_ok=True)
with open(request.form["filepath"], "wb") as f:
shutil.copyfileobj(request.files["file"], f, 10 * 1024 * 1024)
except Exception as ex:
Expand Down
10 changes: 7 additions & 3 deletions lib/cuckoo/core/guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,14 @@ def start_analysis(self, options):
# Update file_name in options if category is file/archive to include task-id unique subdirectory
# This must be done BEFORE self.add_config(options) is called so that analysis.conf in guest has the correct path
if options["category"] in ("file", "archive"):
if self.platform == "windows":
options["file_name"] = f"{options['id']}\\{sanitize_filename(options['file_name'])}"
if "subdir_upload" in features:
if self.platform == "windows":
options["file_name"] = f"{options['id']}\\{sanitize_filename(options['file_name'])}"
else:
options["file_name"] = f"{options['id']}/{sanitize_filename(options['file_name'])}"
else:
options["file_name"] = f"{options['id']}/{sanitize_filename(options['file_name'])}"
options["file_name"] = sanitize_filename(options["file_name"])


# Pass along the analysis.conf file.
self.add_config(options)
Expand Down
Loading