I need to return a specific value from every dictionary. In this case, I need to return the action performed by the antivirus, whose id is either id:5 or id:6. The action is either File Cleaned or Quarantine Successfully. Another problem is that the lists do not have the same length. Most have 6 dictionaries in them, but sometimes you can find a list with 1 dict or even 8 dicts.
Here is the list:
data = [
[
{
"id": 1,
"type": "detection_name",
"field": "malName",
"value": "HKTL_AMMYYADMIN",
"provenance": [
"Alert"
]
},
{
"id": 2,
"type": "file_sha1",
"field": "fileHash",
"value": "",
"provenance": [
"Alert"
]
},
{
"id": 3,
"type": "filename",
"field": "fileName",
"value": "D:\\PAMH\\DATA\\LABORTATORY\\AMMYY_Admin.exe",
"provenance": [
"Alert"
]
},
{
"id": 4,
"type": "fullpath",
"field": "fullPath",
"value": "D:\\PAMH\\DATA\\LABORTATORY\\AMMYY_Admin.exe",
"provenance": [
"Alert"
]
},
{
"id": 5,
"type": "text",
"field": "actResult",
"value": "File cleaned",
"provenance": [
"Alert"
]
},
{
"id": 6,
"type": "text",
"field": "scanType",
"value": "Real-time Scan",
"provenance": [
"Alert"
]
}
],
[
{
"id": 1,
"type": "command_line",
"field": "objectCmd",
"value": "c:\\SW\\nmap\\nmap.exe -sS -P0 92.168.155.83 -p 22",
"provenance": [
"Alert"
]
}
],
[
{
"id": 1,
"type": "detection_name",
"field": "malName",
"value": "HackTool.Win32.PortScan.SWO",
"provenance": [
"Alert"
]
},
{
"id": 2,
"type": "file_sha1",
"field": "fileHash",
"value": "",
"provenance": [
"Alert"
]
},
{
"id": 3,
"type": "filename",
"field": "fileName",
"value": "E:\\EXCHANGE\\John Smith\\Documents\\Advanced_Port_Scanner_2.5.3869.exe",
"provenance": [
"Alert"
]
},
{
"id": 4,
"type": "filename",
"field": "fileName",
"value": "H:\\home\\john.smith\\Documents\\Advanced_Port_Scanner_2.5.3869.exe",
"provenance": [
"Alert"
]
},
{
"id": 5,
"type": "fullpath",
"field": "fullPath",
"value": "H:\\home\\john.smith\\Documents\\Advanced_Port_Scanner_2.5.3869.exe",
"provenance": [
"Alert"
]
},
{
"id": 6,
"type": "text",
"field": "actResult",
"value": "File cleaned",
"provenance": [
"Alert"
]
},
{
"id": 7,
"type": "text",
"field": "actResult",
"value": "File cleaned",
"provenance": [
"Alert"
]
},
{
"id": 8,
"type": "text",
"field": "scanType",
"value": "Scheduled Scan",
"provenance": [
"Alert"
]
}
]
]
I'm able to return values from a list of dicts, but so far everything I tried with a list of lists of dicts hasn't worked.
Expected Output:
"File cleaned", "-", "File cleaned"