-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Updated parameters and bumped SDK * Refreshing the plugin * Linting the unit test
- Loading branch information
1 parent
10b82d1
commit 4097140
Showing
17 changed files
with
345 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
plugins/joe_sandbox/unit_test/responses/chunked_sample.json.resp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"data": { | ||
"apikey": "abcdef", | ||
"submission_id": "12345" | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
plugins/joe_sandbox/unit_test/responses/get_submitted_info.json.resp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"data": { | ||
"submission_info": { | ||
"analyses": [ | ||
{ | ||
"analysisid": "1111", | ||
"classification": "", | ||
"comments": "", | ||
"detection": "clean", | ||
"duration": 595, | ||
"encrypted": false, | ||
"filename": "test.csv", | ||
"has_malwareconfig": false, | ||
"md5": "df7761075b3e745e58ae6c9607721d04", | ||
"runs": [ | ||
{ | ||
"detection": "clean", | ||
"error": null, | ||
"score": 0, | ||
"sigma": false, | ||
"suricata": false, | ||
"system": "w10x64_21h1_office", | ||
"yara": false | ||
}, | ||
{ | ||
"detection": "clean", | ||
"error": null, | ||
"score": 0, | ||
"sigma": false, | ||
"suricata": false, | ||
"system": "w7x64_office", | ||
"yara": false | ||
} | ||
], | ||
"score": 0, | ||
"scriptname": "default.jbs", | ||
"sha1": "111", | ||
"sha256": "1111", | ||
"status": "finished", | ||
"tags": [], | ||
"threatname": "", | ||
"time": "2025-02-04T15:44:08+01:00", | ||
"webid": "1111" | ||
} | ||
], | ||
"most_relevant_analysis": { | ||
"detection": "clean", | ||
"score": 0, | ||
"webid": "1111" | ||
}, | ||
"name": "test.csv", | ||
"status": "finished", | ||
"submission_id": "12345", | ||
"time": "2025-02-04T15:44:06+01:00" | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
plugins/joe_sandbox/unit_test/responses/submit_sample.json.resp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"data": { | ||
"submission_id": "12345" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import sys | ||
import os | ||
|
||
sys.path.append(os.path.abspath("../")) | ||
|
||
from unittest import TestCase | ||
from unittest.mock import patch | ||
from icon_joe_sandbox.actions.get_submitted_info.action import GetSubmittedInfo | ||
from icon_joe_sandbox.actions.get_submitted_info.schema import Input, Output | ||
from jsonschema import validate | ||
from mock import Util, mock_request_200, mocked_request, MagicMock | ||
|
||
|
||
class TestGetSubmittedInfo(TestCase): | ||
@patch("requests.request", side_effect=mock_request_200) | ||
def setUp(self, mock_client) -> None: | ||
self.action = Util.default_connector(GetSubmittedInfo()) | ||
self.params = {Input.SUBMISSION_ID: "12345"} | ||
|
||
@patch("requests.request", side_effect=mock_request_200) | ||
def test_get_submitted_info(self, mock_get) -> None: | ||
mocked_request(mock_get) | ||
response = self.action.run(self.params) | ||
expected = { | ||
Output.SUBMISSION_INFO: { | ||
"submission_info": { | ||
"analyses": [ | ||
{ | ||
"analysisid": "1111", | ||
"classification": "", | ||
"comments": "", | ||
"detection": "clean", | ||
"duration": 595, | ||
"encrypted": False, | ||
"filename": "test.csv", | ||
"has_malwareconfig": False, | ||
"md5": "df7761075b3e745e58ae6c9607721d04", | ||
"runs": [ | ||
{ | ||
"detection": "clean", | ||
"error": None, | ||
"score": 0, | ||
"sigma": False, | ||
"suricata": False, | ||
"system": "w10x64_21h1_office", | ||
"yara": False, | ||
}, | ||
{ | ||
"detection": "clean", | ||
"error": None, | ||
"score": 0, | ||
"sigma": False, | ||
"suricata": False, | ||
"system": "w7x64_office", | ||
"yara": False, | ||
}, | ||
], | ||
"score": 0, | ||
"scriptname": "default.jbs", | ||
"sha1": "111", | ||
"sha256": "1111", | ||
"status": "finished", | ||
"tags": [], | ||
"threatname": "", | ||
"time": "2025-02-04T15:44:08+01:00", | ||
"webid": "1111", | ||
} | ||
], | ||
"most_relevant_analysis": { | ||
"detection": "clean", | ||
"score": 0, | ||
"webid": "1111", | ||
}, | ||
"name": "test.csv", | ||
"status": "finished", | ||
"submission_id": "12345", | ||
"time": "2025-02-04T15:44:06+01:00", | ||
}, | ||
"most_relevant_analysis": { | ||
"webid": "running", | ||
"detection": "running", | ||
"score": "running", | ||
}, | ||
} | ||
} | ||
|
||
validate(response, self.action.output.schema) | ||
self.assertEqual(response, expected) |
Oops, something went wrong.