Hi
I’m not used to work with invoke-rest method and api, but now I get stuck on trying to export some fields of the data returned.
I’m able to retrieve the list of my computers having vulnerabilities and gets arouns 2500 records.
data returned contains 3 objects :
Version : “v1.2.0”
Metadata :{ “links”: { “self”: “https://api.eu.amp.cisco.com/v1/events?group_guid[]=6c3c2005-4c74-4ba7-8dbb-c4d5b6bafe03&limit=1”, “next”: “https://api.eu.amp.cisco.com/v1/events?group_guid[]=6c3c2005-4c74-4ba7-8dbb-c4d5b6bafe03&limit=1&offset=1” }, “results”: { “total”: 350, “current_item_count”: 1, “index”: 0, “items_per_page”: 1 }}
data : {id : 15538481037811
timestamp : 1553848103
timestamp_nanoseconds : 0
date : 2019-03-29T08:28:23+00:00
event_type : Vulnerable Application Detected
event_type_id : 1107296279
connector_guid : b9fb77b6-e781-40f5-b430-516ecbfe5936
group_guids : {321a0154-b920-484c-b306-d10220f05418, 9e7c6c2e-eba9-4c72-92cf-1ce1699a13c0}
severity : Low
start_timestamp : 1553847273
start_date : 2019-03-29T08:14:33+00:00
computer : @{connector_guid=bjhhe6-e781-40f5-b430-516ecbfe5936; hostname=xxxxxxx.xxxx.net; external_ip=155.155.155.155; active=True; network_addresses=System.Object; links=}
file : @{disposition=Clean; file_name=AcroRd32.exe; identity=; parent=}
vulnerabilities : {@{name=Adobe Acrobat Reader; version=11.0.9; cve=CVE-2014-9160; score=10.0; url=Announcement Regarding Non-Cisco Product Security Alerts}, @{cve=CVE-2015-3046; score=10.0; url=Announcement Regarding Non-Cisco Product Security Alerts}, @{cve=CVE-2015-3048;
score=10.0; url=Announcement Regarding Non-Cisco Product Security Alerts}, @{cve=CVE-2015-3049; score=10.0; url=Announcement Regarding Non-Cisco Product Security Alerts}…}}
What I would like to achive is to export (to txt file or csv) only those fields for all my computers:
-date
-computer.hostname
-vulnerabilities.name
-vulnerabilities.version
I tried many things but none give me the attended result. Vulnerabilities object causes me trouble.
here is what I got so far :
“date”,“vulnerability_name”,“name”,“version”
“2019-03-29T07:15:36+00:00”,“System.Object”,“xxxxx.domain.net”,“System.Object”
“2019-03-29T07:06:56+00:00”,“System.Object”,“yyyy.domain.net”,“System.Object”
I hope it is clear, if not feel free to ask ![]()
Any help would be appreciated.
Thans a lot