Skip to content

Commit

Permalink
Merge pull request #854 from aacgood/develop
Browse files Browse the repository at this point in the history
Included privacy type setting for URL/File analysis
  • Loading branch information
garanews authored Sep 18, 2020
2 parents 5bfeecc + 1cf0ecf commit a56645d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
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()

0 comments on commit a56645d

Please sign in to comment.