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

Infoblox connector dossier source changes #1623

Closed
wants to merge 4 commits into from
Closed
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
6 changes: 3 additions & 3 deletions stix_shifter_modules/infoblox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ python main.py translate infoblox query '{}' "[ipv4-addr:value = '127.0.0.1'] ST
export SS_CONNECTION='{"host":"xxx","port":443,"options":{"timeout":20}}'
export SS_AUTH='{"auth":{"token":"xxx"}}'

python main.py transmit infoblox:dnsEventData ${SS_CONNECTION} ${SS_AUTH} query '{"offset": 0, "query": "t0=1622536990&t1=1630406590&qip=127.0.0.1", "source": "dnsEventData"}'
python main.py transmit infoblox ${SS_CONNECTION} ${SS_AUTH} query '{"offset": 0, "query": "t0=1622536990&t1=1630406590&qip=127.0.0.1", "source": "dnsEventData"}'
```

#### STIX transmit query - output
Expand All @@ -69,7 +69,7 @@ python main.py transmit infoblox:dnsEventData ${SS_CONNECTION} ${SS_AUTH} query
export SS_CONNECTION='{"host":"xxx","port":443,"options":{"timeout":20}}'
export SS_AUTH='{"auth":{"token":"xxx"}}'

python main.py transmit infoblox:dnsEventData ${SS_CONNECTION} ${SS_AUTH} results '{"offset": 0, "query": "t0=1622536990&t1=1630406590&qip=127.0.0.1", "source": "dnsEventData"}' 0 5
python main.py transmit infoblox ${SS_CONNECTION} ${SS_AUTH} results '{"offset": 0, "query": "t0=1622536990&t1=1630406590&qip=127.0.0.1", "source": "dnsEventData"}' 0 5
```

#### STIX transmit results - output
Expand Down Expand Up @@ -115,7 +115,7 @@ export SS_DATA_SOURCE='{"type": "identity", "id": "xxx", "name": "Infoblox", "id
export SS_CONNECTION='{"host":"xxx","port":443,"options":{"timeout":20}}'
export SS_AUTH='{"auth":{"token":"xxx"}}'

python3 main.py execute infoblox:dnsEventData infoblox:dnsEventData $SS_DATA_SOURCE $SS_CONNECTION $SS_AUTH "[ipv4-addr:value = '208.50.179.13'] START t'2021-06-27T09:00:10Z' STOP t'2021-06-29T10:43:10Z'"
python3 main.py execute infoblox infoblox $SS_DATA_SOURCE $SS_CONNECTION $SS_AUTH "[ipv4-addr:value = '208.50.179.13'] START t'2021-06-27T09:00:10Z' STOP t'2021-06-29T10:43:10Z'"
```

#### STIX execute - output
Expand Down
9 changes: 5 additions & 4 deletions stix_shifter_modules/infoblox/stix_transmission/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ async def _get_dossierdata_results(self, search_id, range_start=0, range_end=Non
start = range_start if range_start else 0
end = range_end if range_end else 0

params = {'wait': 'true','source': 'pdns'}
params = {'wait': 'true'}

# NOTE: Dossier does not support pagination via multiple requests. All results returned in the response.
resp = await self.client.call_api(endpoint + "/" + payload["threat_type"] + "?" + payload["query"], 'GET', urldata=params, headers=headers, timeout=self.timeout)
Expand All @@ -202,10 +202,11 @@ async def _get_dossierdata_results(self, search_id, range_start=0, range_end=Non
return resp_dict

response_payload = json.loads(resp.read())
restructure_payload = {'job': {'create_time': response_payload['job']['create_time']},'results': []}
for i in response_payload["results"]:
for j in i["data"]["items"]:
restructure_payload = {'job': {'create_time': response_payload['job']['create_time']},'results': [{'data': {'items': [j]}}]}
resp_dict["data"].append({"dossierData": restructure_payload})
if "data" in i:
restructure_payload["results"].append({'dossierResult': {'source': i["params"], 'data': i["data"]}})
resp_dict["data"].append({"dossierData": restructure_payload})

# Trim result set based on min/max range values
end = end if end < len(resp_dict["data"]) else len(resp_dict["data"])
Expand Down
Loading