DEV Community

Discussion on: Converting Nested JSON to CSV

Collapse
 
etyety profile image
etyety

{
"account_action_id": "20ee523e-32fe-456d-b891-5f29735b99cc",
"type": "scan",
"scans": [{
"name": "analyzer_results/862394810259/i-094db43f8f1ad67bc/20ee523e-32fe-456d-b891-5f29735b99cc_862394810259_i-094db43f8f1ad67bc.json",
"result": {
"metadata": {
"time": "2019-05-13T09:55:00.683231",
"version": "public"
},
"status": "success",
"main": {
"issues": {
"passwords_login": [{
"username": "myuser1",
"password": "qw**",
"source": "common",
"is_cache": true
}, {
"username": "myuser2",
"password": "12
",
"source": "common",
"is_cache": true
}, {
"username": "myuser10",
"password": "mi
",
"source": "leaked",
"is_cache": true
}
],
"passwords_auth_user": [{
"username": "myuser10",
"password": "mi
",
"source": "leaked",
"is_cache": true,
"files": ["/etc/httpd/.htpasswd"]
}, {
"username": "myuser23",
"password": "he
",
"source": "common",
"is_cache": true,
"files": ["/etc/apache2/.htpasswd"]
}, {
"username": "myuser22",
"password": "ab
",
"source": "common",
"is_cache": true,
"files": ["/etc/nginx/.htpasswd"]
}
],
"passwords_shell_history": [{
"cmd": "swaks",
"username": "you@example.com",
"password": "ab
",
"source": "common",
"cmdline": "swaks --to someone@gmail.com --from \"you@example.com\" --server mail.example.com --auth LOGIN --auth-user \"you@example.com\" --auth-password \"ab
\" -tls"
}, {
"cmd": "curl",
"username": "username",
"password": "pa
",
"source": "common",
"cmdline": "/bin/curl -u username:pa
** example.com"
}, {
"cmd": "mailx",
"username": "user1@gmail.com",
"password": "1q**",
"source": "common",
"cmdline": "mailx -v -s \"This is the subject\" -S smtp=\"mail.example.com:587\" -S smtp-auth=login -S smtp-auth-user=\"user1@gmail.com\" -S smtp-auth-password=\"1q
\" -S ssl-verify=ignore ismail@gmail.com"
}, {
"cmd": "wget",
"username": "doctorstrange",
"password": "la
",
"source": "leaked",
"cmdline": "wget --user doctorstrange --password la
** example.com/"
}
],
"additional_data": {
"last_brute_force": [{
"log_time": "May 11 04:44:15",
"username": "packer",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:44:28",
"username": "postgres",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:44:42",
"username": "deploy",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:44:58",
"username": "vagrant",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:45:13",
"username": "bot",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:45:29",
"username": "hdfs",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:45:45",
"username": "ts",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:46:01",
"username": "system",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:46:17",
"username": "tsbot",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:46:33",
"username": "server",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:47:06",
"username": "guest",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:47:22",
"username": "minecraft",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:47:39",
"username": "dev",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:47:55",
"username": "test",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:48:12",
"username": "www",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:48:46",
"username": "linux",
"source_ipv4": "52.174.51.107"
}, {
"log_time": "May 11 04:49:03",
"username": "nagios",
"source_ipv4": "52.174.51.107"
}
],
"last_successful_logins": [],
"last_failed_logins": [{
"log_time": "May 11 11:11:11",
"username": "pi",
"source_ipv4": "96.81.74.60"
}, {
"log_time": "May 11 11:11:54",
"username": "bananapi",
"source_ipv4": "96.81.74.60"
}, {
"log_time": "May 11 11:12:39",
"username": "vyos",
"source_ipv4": "96.81.74.60"
}, {
"log_time": "May 11 11:13:23",
"username": "xbian",
"source_ipv4": "96.81.74.60"
}, {
"log_time": "May 11 11:14:07",
"username": "vyatta",
"source_ipv4": "96.81.74.60"
}, {
"log_time": "May 11 16:37:28",
"username": "admin",
"source_ipv4": "37.114.183.184"
}, {
"log_time": "May 11 17:01:04",
"username": "support",
"source_ipv4": "89.197.161.164"
}, {
"log_time": "May 11 20:38:00",
"username": "pi",
"source_ipv4": "119.194.14.3"
}, {
"log_time": "May 11 20:38:00",
"username": "pi",
"source_ipv4": "119.194.14.3"
}, {
"log_time": "May 12 06:14:37",
"username": "admin",
"source_ipv4": "82.209.236.212"
}
],
"users_with_password": ["myuser1", "myuser2", "myuser10"]
},
"vip": {
"status": "$disabled"
},
"vulnerabilities": {
"status": "$disabled"
},
"clamav": {
"status": "$disabled"
},
"files_info": {
"status": "$disabled"
}
},
"asset": {
"instance": {
"AmiLaunchIndex": 0,
"ImageId": "ami-03803ff616e2d4872",
"InstanceId": "i-094db43f8f1ad67bc",
"InstanceType": "t2.nano",
"KeyName": "testing-master-key",
"LaunchTime": "2019-05-06 13:29:27+00:00",
"Monitoring": {
"State": "disabled"
},
"Placement": {
"AvailabilityZone": "us-east-1d",
"GroupName": "",
"Tenancy": "default"
},
"PrivateDnsName": "ip-172-31-18-161.ec2.internal",
"PrivateIpAddress": "172.31.18.161",
"ProductCodes": [],
"PublicDnsName": "ec2-52-91-99-231.compute-1.amazonaws.com",
"PublicIpAddress": "52.91.99.231",
"State": {
"Code": 16,
"Name": "running"
},
"StateTransitionReason": "",
"SubnetId": "subnet-298db763",
"VpcId": "vpc-7c47c106",
"Architecture": "x86_64",
"BlockDeviceMappings": [{
"DeviceName": "/dev/sda1",
"Ebs": {
"AttachTime": "2019-05-06 13:29:28+00:00",
"DeleteOnTermination": true,
"Status": "attached",
"VolumeId": "vol-0578befce5167531f"
}
}
],
"ClientToken": "",
"EbsOptimized": false,
"EnaSupport": true,
"Hypervisor": "xen",
"NetworkInterfaces": [{
"Association": {
"IpOwnerId": "amazon",
"PublicDnsName": "ec2-52-91-99-231.compute-1.amazonaws.com",
"PublicIp": "52.91.99.231"
},
"Attachment": {
"AttachTime": "2019-05-06 13:29:27+00:00",
"AttachmentId": "eni-attach-061d00b5ba9c32462",
"DeleteOnTermination": true,
"DeviceIndex": 0,
"Status": "attached"
},
"Description": "",
"Groups": [{
"GroupName": "ssh-sg-new",
"GroupId": "sg-0d42f9a8e8dc09b73"
}
],
"Ipv6Addresses": [],
"MacAddress": "0a:73:4e:7c:73:fc",
"NetworkInterfaceId": "eni-014c00856452e56fe",
"OwnerId": "862394810259",
"PrivateDnsName": "ip-172-31-18-161.ec2.internal",
"PrivateIpAddress": "172.31.18.161",
"PrivateIpAddresses": [{
"Association": {
"IpOwnerId": "amazon",
"PublicDnsName": "ec2-52-91-99-231.compute-1.amazonaws.com",
"PublicIp": "52.91.99.231"
},
"Primary": true,
"PrivateDnsName": "ip-172-31-18-161.ec2.internal",
"PrivateIpAddress": "172.31.18.161"
}
],
"SourceDestCheck": false,
"Status": "in-use",
"SubnetId": "subnet-298db763",
"VpcId": "vpc-7c47c106"
}
],
"RootDeviceName": "/dev/sda1",
"RootDeviceType": "ebs",
"SecurityGroups": [{
"GroupName": "ssh-sg-new",
"GroupId": "sg-0d42f9a8e8dc09b73"
}
],
"SourceDestCheck": false,
"Tags": [{
"Key": "Name",
"Value": "scan_me_too"
}, {
"Key": "system_test",
"Value": "recent_files"
}, {
"Key": "system_test2",
"Value": "passwords"
}
],
"VirtualizationType": "hvm",
"CpuOptions": {
"CoreCount": 1,
"ThreadsPerCore": 1
},
"CapacityReservationSpecification": {
"CapacityReservationPreference": "open"
},
"HibernationOptions": {
"Configured": false
}
},
"volumes": [{
"Attachments": [{
"AttachTime": "2019-05-06 13:29:28+00:00",
"Device": "/dev/sda1",
"InstanceId": "i-094db43f8f1ad67bc",
"State": "attached",
"VolumeId": "vol-0578befce5167531f",
"DeleteOnTermination": true
}
],
"AvailabilityZone": "us-east-1d",
"CreateTime": "2019-05-06 13:29:28.446000+00:00",
"Encrypted": false,
"Size": 8,
"SnapshotId": "snap-00a79a6d42de763df",
"State": "in-use",
"VolumeId": "vol-0578befce5167531f",
"Iops": 100,
"VolumeType": "gp2"
}
],
"snapshots": [],
"security_groups": [{
"Description": "Managed by Terraform",
"GroupName": "ssh-sg-new",
"IpPermissions": [{
"FromPort": 22,
"IpProtocol": "tcp",
"IpRanges": [{
"CidrIp": "0.0.0.0/0"
}
],
"Ipv6Ranges": [],
"PrefixListIds": [],
"ToPort": 22,
"UserIdGroupPairs": []
}
],
"OwnerId": "862394810259",
"GroupId": "sg-0d42f9a8e8dc09b73",
"IpPermissionsEgress": [{
"IpProtocol": "-1",
"IpRanges": [{
"CidrIp": "0.0.0.0/0"
}
],
"Ipv6Ranges": [],
"PrefixListIds": [],
"UserIdGroupPairs": []
}
],
"VpcId": "vpc-7c47c106"
}
],
"interfaces": [{
"id": "eni-014c00856452e56fe",
"vpc": "vpc-7c47c106",
"private_ips": ["172.31.18.161"],
"public_ips": ["52.91.99.231"]
}
],
"public_ports": {
"ports": ["22"],
"security_groups": ["sg-0d42f9a8e8dc09b73"]
},
"cpu": {},
"memory": {},
"disks": [{
"size": "7.7G",
"used": "1.8G",
"available": "5.9G",
"percent": "24%"
}
],
"os": {
"distro": "ubuntu",
"release": "16.04",
"kernel": null
},
"container_info": {
"container_id": "main"
}
}
}
}
}
]
}