Skip to content

Commit

Permalink
Fixed: Added filename quote escaping to prevent 400 error from API du…
Browse files Browse the repository at this point in the history
…e to quotes in filename
  • Loading branch information
Evert-Arends authored and RicoVZ committed Oct 6, 2023
1 parent ffa9b5a commit 005c95f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/triage/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2023 Hatching B.V
# All rights reserved.

__version__ = "0.1.11"
__version__ = "0.2.0"
6 changes: 5 additions & 1 deletion python/triage/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _req_json(self, method, path, data=None):
except exceptions.HTTPError as err:
raise ServerError(err)

def submit_sample_file(self, filename, file, interactive=False, profiles=None, password=None, timeout=150, network="internet"):
def submit_sample_file(self, filename, file, interactive=False, profiles=None, password=None, timeout=150, network="internet", escape_filename=True):
"""
Submit a file for analysis on Triage.
Expand All @@ -80,6 +80,8 @@ def submit_sample_file(self, filename, file, interactive=False, profiles=None, p
Timeout of the analysis
network (str):
Type of network routing to use ("internet" | "drop" | "tor" | "sim200" | "sim404" | "simnx")
escape_filename (bool):
Filename escaping to prevent quotation issues
Returns:
response (dict):
{
Expand All @@ -102,6 +104,8 @@ def submit_sample_file(self, filename, file, interactive=False, profiles=None, p
'network': network
}
}
if escape_filename:
filename = filename.replace('"', '\\"')
if password:
d['password'] = password
body, content_type = encode_multipart_formdata({
Expand Down

0 comments on commit 005c95f

Please sign in to comment.