Skip to content

Commit

Permalink
Fixed some issues with length+offset
Browse files Browse the repository at this point in the history
Signed-off-by: DerekRushton <[email protected]>
  • Loading branch information
DerekRushton committed Aug 20, 2024
1 parent 4c10d00 commit a3ff4a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stix_shifter_modules/crowdstrike_alerts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ $ python3 main.py execute crowdstrike_alerts crowdstrike_alerts "<data_source>"


```bash
$ python3 main.py execute crowdstrike_alerts crowdstrike_alerts "{\"type\":\"identity\",\"id\":\"identity--f431f809-377b-45e0-aa1c-6a4751cae5ff\",\"name\":\"Crowdstrike\",\"identity_class\":\"events\", \"created\":\"2022-05-22T13:22:50.336Z\",\"modified\":\"2022-05-25T13:22:50.336Z\"}" "{\"host\":\"[host\"}" "{\"auth\":{\"client_id\":\"[id]\", \"client_secret\":\"u9fE7zS4yM25XVDvtKmBY8qUj6d1AohP3pRscLC0\"}}" "[ipv4-addr:value != '1.1.1.1'] START t'2024-03-01T11:00:00.000Z' STOP t'2024-07-03T11:54:00.000Z'" -r 100
$ python3 main.py execute crowdstrike_alerts crowdstrike_alerts "{\"type\":\"identity\",\"id\":\"identity--f431f809-377b-45e0-aa1c-6a4751cae5ff\",\"name\":\"Crowdstrike\",\"identity_class\":\"events\", \"created\":\"2022-05-22T13:22:50.336Z\",\"modified\":\"2022-05-25T13:22:50.336Z\"}" "{\"host\":\"[host\"}" "{\"auth\":{\"client_id\":\"[id]\", \"client_secret\":\"[secret]\"}}" "[ipv4-addr:value != '1.1.1.1'] START t'2024-03-01T11:00:00.000Z' STOP t'2024-07-03T11:54:00.000Z'" -r 100
```

Note in this example some logging is omitted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ async def ping_connection(self):
async def create_results_connection(self, query, offset, length, metadata=None):
#Initialize the starting offset and initial variables to empty.
return_obj = dict()
length = int(length)
offset = int(offset)

if(metadata == None):
metadata = dict()
current_offset = offset
Expand Down Expand Up @@ -117,11 +120,16 @@ async def _get_alert_info(self, list_of_alert_id_list):
return alert_info

def _handle_Exception(self, exception):
return_obj = dict()
response_dict = {}
return_obj = {}
try:
raise exception
except Exception as ex:
except APIResponseException as ex:
return self._handle_api_response(ex)
except Exception as ex:
ErrorResponder.fill_error(return_obj, response_dict, error=ex, connector=self.connector)
return return_obj


def _handle_api_response(self, rest_api_exception):
response_dict = {}
Expand All @@ -141,5 +149,5 @@ def _handle_api_response(self, rest_api_exception):
else:
raise Exception(rest_api_exception.error_message)

ErrorResponder.fill_error(return_obj, response_dict, ['message'], error=connection_error, connector=self.connector)
ErrorResponder.fill_error(return_obj, response_dict, response_dict['message'], error=connection_error, connector=self.connector)
return return_obj

0 comments on commit a3ff4a8

Please sign in to comment.