Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Included privacy type setting for URL/File analysis #854

Merged
merged 2 commits into from
Sep 18, 2020
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
8 changes: 8 additions & 0 deletions analyzers/AnyRun/AnyRun_Sandbox_Analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
"multi": false,
"required": false
},
{
"name": "privacy_type",
"description": "Define the privacy setting (Allowed values: public, bylink, owner)",
"type": "string",
"multi": false,
"required": true,
"defaultValue": "bylink"
},
{
"name": "verify_ssl",
"description": "Verify SSL certificate",
Expand Down
7 changes: 5 additions & 2 deletions analyzers/AnyRun/anyrun_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def __init__(self):
Analyzer.__init__(self)
self.url = "https://api.any.run/v1"
self.token = self.get_param("config.token", None, "Service token is missing")
self.privacy_type = self.get_param("config.privacy_type", None, "Privacy type is missing")
self.verify_ssl = self.get_param("config.verify_ssl", True, None)
if not self.verify_ssl:
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
Expand Down Expand Up @@ -49,9 +50,11 @@ def run(self):
while status_code in (None, 429) and tries <= 15:
with open(filepath, "rb") as sample:
files = {"file": (filename, sample)}
data = {"opt_privacy_type": self.privacy_type}
response = requests.post(
"{0}/analysis".format(self.url),
files=files,
data=data,
headers=headers,
verify=self.verify_ssl,
)
Expand All @@ -68,7 +71,7 @@ def run(self):
self.error(response.json()["message"])
elif self.data_type == "url":
url = self.get_param("data", None, "Url is missing")
data = {"obj_type": "url", "obj_url": url}
data = {"obj_type": "url", "obj_url": url, "opt_privacy_type": self.privacy_type}
while status_code in (None, 429) and tries <= 15:
response = requests.post(
"{0}/analysis".format(self.url),
Expand Down Expand Up @@ -127,4 +130,4 @@ def run(self):


if __name__ == "__main__":
AnyRunAnalyzer().run()
AnyRunAnalyzer().run()