GetFindings delphiDll Example
var
rest: HCkRest;
success: Boolean;
authAws: HCkAuthAws;
json: HCkJsonObject;
sbRequestBody: HCkStringBuilder;
sbResponseBody: HCkStringBuilder;
respStatusCode: Integer;
jResp: HCkJsonObject;
accountId: PWideChar;
arn: PWideChar;
confidence: Integer;
createdAt: PWideChar;
description: PWideChar;
id: PWideChar;
partition: PWideChar;
region: PWideChar;
AccessKeyId: PWideChar;
PrincipalId: PWideChar;
UserName: PWideChar;
UserType: PWideChar;
Arn: PWideChar;
CreatedAt: Integer;
Name: PWideChar;
Status: PWideChar;
VpcId: PWideChar;
AvailabilityZone: PWideChar;
IamInstanceProfileArn: PWideChar;
Id: PWideChar;
ImageDescription: PWideChar;
ImageId: PWideChar;
InstanceId: PWideChar;
InstanceState: PWideChar;
InstanceType: PWideChar;
LaunchTime: PWideChar;
OutpostArn: PWideChar;
Platform: PWideChar;
Uid: PWideChar;
Username: PWideChar;
HostNetwork: Integer;
KubernetesWorkloadDetailsName: PWideChar;
Namespace: PWideChar;
v_Type: PWideChar;
KubernetesWorkloadDetailsUid: PWideChar;
ResourceType: PWideChar;
schemaVersion: PWideChar;
ActionType: PWideChar;
Api: PWideChar;
CallerType: PWideChar;
Domain: PWideChar;
ErrorCode: PWideChar;
AccountId: PWideChar;
Affiliated: Integer;
CityName: PWideChar;
CountryCode: PWideChar;
CountryName: PWideChar;
Lat: Integer;
Lon: Integer;
IpAddressV4: PWideChar;
v_Asn: PWideChar;
AsnOrg: PWideChar;
Isp: PWideChar;
Org: PWideChar;
ServiceName: PWideChar;
UserAgent: PWideChar;
DnsRequestActionDomain: PWideChar;
Parameters: PWideChar;
CityCityName: PWideChar;
CountryCountryCode: PWideChar;
CountryCountryName: PWideChar;
GeoLocationLat: Integer;
GeoLocationLon: Integer;
RemoteIpDetailsIpAddressV4: PWideChar;
OrganizationAsn: PWideChar;
OrganizationAsnOrg: PWideChar;
OrganizationIsp: PWideChar;
OrganizationOrg: PWideChar;
RequestUri: PWideChar;
StatusCode: Integer;
KubernetesApiCallActionUserAgent: PWideChar;
Verb: PWideChar;
Blocked: Integer;
ConnectionDirection: PWideChar;
LocalIpDetailsIpAddressV4: PWideChar;
Port: Integer;
PortName: PWideChar;
Protocol: PWideChar;
RemotePortDetailsPort: Integer;
RemotePortDetailsPortName: PWideChar;
PortProbeActionBlocked: Integer;
Archived: Integer;
Count: Integer;
DetectorId: PWideChar;
EventFirstSeen: PWideChar;
EventLastSeen: PWideChar;
ResourceRole: PWideChar;
serviceServiceName: PWideChar;
UserFeedback: PWideChar;
severity: Integer;
title: PWideChar;
v_type: PWideChar;
updatedAt: PWideChar;
j: Integer;
count_j: Integer;
key: PWideChar;
value: PWideChar;
networkInterfaceId: PWideChar;
privateDnsName: PWideChar;
privateIpAddress: PWideChar;
publicDnsName: PWideChar;
publicIp: PWideChar;
subnetId: PWideChar;
vpcId: PWideChar;
k: Integer;
count_k: Integer;
strVal: PWideChar;
groupId: PWideChar;
groupName: PWideChar;
code: PWideChar;
productType: PWideChar;
containerRuntime: PWideChar;
image: PWideChar;
imagePrefix: PWideChar;
name: PWideChar;
Privileged: Integer;
mountPath: PWideChar;
Path: PWideChar;
createdAt_int: Integer;
EncryptionType: PWideChar;
KmsMasterKeyArn: PWideChar;
ownerId: PWideChar;
EffectivePermission: PWideChar;
BlockPublicAcls: Integer;
BlockPublicPolicy: Integer;
IgnorePublicAcls: Integer;
RestrictPublicBuckets: Integer;
AllowsPublicReadAccess: Integer;
AllowsPublicWriteAccess: Integer;
BlockPublicAccessBlockPublicAcls: Integer;
BlockPublicAccessBlockPublicPolicy: Integer;
BlockPublicAccessIgnorePublicAcls: Integer;
BlockPublicAccessRestrictPublicBuckets: Integer;
BucketPolicyAllowsPublicReadAccess: Integer;
BucketPolicyAllowsPublicWriteAccess: Integer;
localIpDetailsIpAddressV4: PWideChar;
localPortDetailsPort: Integer;
localPortDetailsPortName: PWideChar;
remoteIpDetailsIpAddressV4: PWideChar;
threatListName: PWideChar;
i: Integer;
count_i: Integer;
begin
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
rest := CkRest_Create();
authAws := CkAuthAws_Create();
CkAuthAws_putAccessKey(authAws,'AWS_ACCESS_KEY');
CkAuthAws_putSecretKey(authAws,'AWS_SECRET_KEY');
// Don't forget to change the region to your particular region. (Also make the same change in the call to Connect below.)
CkAuthAws_putRegion(authAws,'us-west-2');
CkAuthAws_putServiceName(authAws,'guardduty');
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
CkRest_SetAuthAws(rest,authAws);
// URL: https://guardduty.us-west-2.amazonaws.com/
// Use the same region as specified above.
success := CkRest_Connect(rest,'guardduty.us-west-2.amazonaws.com',443,True,True);
if (success <> True) then
begin
Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(CkRest_getConnectFailReason(rest)));
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
// The following code creates the JSON request body.
// The JSON created by this code is shown below.
// Use this online tool to generate code from sample JSON:
// Generate Code to Create JSON
json := CkJsonObject_Create();
CkJsonObject_UpdateString(json,'findingIds[0]','string');
CkJsonObject_UpdateString(json,'sortCriteria.attributeName','string');
CkJsonObject_UpdateString(json,'sortCriteria.orderBy','string');
// The JSON request body created by the above code:
// {
// "findingIds": [
// "string"
// ],
// "sortCriteria": {
// "attributeName": "string",
// "orderBy": "string"
// }
// }
CkRest_AddHeader(rest,'Content-Type','application/x-amz-json-1.1');
CkRest_AddHeader(rest,'X-Amz-Target','GetFindings');
sbRequestBody := CkStringBuilder_Create();
CkJsonObject_EmitSb(json,sbRequestBody);
sbResponseBody := CkStringBuilder_Create();
success := CkRest_FullRequestSb(rest,'POST','/detector/{detectorId}/findings/get',sbRequestBody,sbResponseBody);
if (success <> True) then
begin
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
respStatusCode := CkRest_getResponseStatusCode(rest);
Memo1.Lines.Add('response status code = ' + IntToStr(respStatusCode));
if (respStatusCode <> 200) then
begin
Memo1.Lines.Add('Response Header:');
Memo1.Lines.Add(CkRest__responseHeader(rest));
Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkStringBuilder__getAsString(sbResponseBody));
Exit;
end;
jResp := CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
// The following code parses the JSON response.
// A sample JSON response is shown below the sample code.
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
i := 0;
count_i := CkJsonObject_SizeOfArray(jResp,'findings');
while i < count_i do
begin
CkJsonObject_putI(jResp,i);
accountId := CkJsonObject__stringOf(jResp,'findings[i].accountId');
arn := CkJsonObject__stringOf(jResp,'findings[i].arn');
confidence := CkJsonObject_IntOf(jResp,'findings[i].confidence');
createdAt := CkJsonObject__stringOf(jResp,'findings[i].createdAt');
description := CkJsonObject__stringOf(jResp,'findings[i].description');
id := CkJsonObject__stringOf(jResp,'findings[i].id');
partition := CkJsonObject__stringOf(jResp,'findings[i].partition');
region := CkJsonObject__stringOf(jResp,'findings[i].region');
AccessKeyId := CkJsonObject__stringOf(jResp,'findings[i].resource.accessKeyDetails.accessKeyId');
PrincipalId := CkJsonObject__stringOf(jResp,'findings[i].resource.accessKeyDetails.principalId');
UserName := CkJsonObject__stringOf(jResp,'findings[i].resource.accessKeyDetails.userName');
UserType := CkJsonObject__stringOf(jResp,'findings[i].resource.accessKeyDetails.userType');
Arn := CkJsonObject__stringOf(jResp,'findings[i].resource.eksClusterDetails.arn');
CreatedAt := CkJsonObject_IntOf(jResp,'findings[i].resource.eksClusterDetails.createdAt');
Name := CkJsonObject__stringOf(jResp,'findings[i].resource.eksClusterDetails.name');
Status := CkJsonObject__stringOf(jResp,'findings[i].resource.eksClusterDetails.status');
VpcId := CkJsonObject__stringOf(jResp,'findings[i].resource.eksClusterDetails.vpcId');
AvailabilityZone := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.availabilityZone');
IamInstanceProfileArn := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.iamInstanceProfile.arn');
Id := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.iamInstanceProfile.id');
ImageDescription := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.imageDescription');
ImageId := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.imageId');
InstanceId := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.instanceId');
InstanceState := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.instanceState');
InstanceType := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.instanceType');
LaunchTime := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.launchTime');
OutpostArn := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.outpostArn');
Platform := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.platform');
Uid := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesUserDetails.uid');
Username := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesUserDetails.username');
HostNetwork := CkJsonObject_IntOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.hostNetwork');
KubernetesWorkloadDetailsName := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.name');
Namespace := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.namespace');
v_Type := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.type');
KubernetesWorkloadDetailsUid := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.uid');
ResourceType := CkJsonObject__stringOf(jResp,'findings[i].resource.resourceType');
schemaVersion := CkJsonObject__stringOf(jResp,'findings[i].schemaVersion');
ActionType := CkJsonObject__stringOf(jResp,'findings[i].service.action.actionType');
Api := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.api');
CallerType := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.callerType');
Domain := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.domainDetails.domain');
ErrorCode := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.errorCode');
AccountId := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.remoteAccountDetails.accountId');
Affiliated := CkJsonObject_IntOf(jResp,'findings[i].service.action.awsApiCallAction.remoteAccountDetails.affiliated');
CityName := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.remoteIpDetails.city.cityName');
CountryCode := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.remoteIpDetails.country.countryCode');
CountryName := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.remoteIpDetails.country.countryName');
Lat := CkJsonObject_IntOf(jResp,'findings[i].service.action.awsApiCallAction.remoteIpDetails.geoLocation.lat');
Lon := CkJsonObject_IntOf(jResp,'findings[i].service.action.awsApiCallAction.remoteIpDetails.geoLocation.lon');
IpAddressV4 := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.remoteIpDetails.ipAddressV4');
v_Asn := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.remoteIpDetails.organization.asn');
AsnOrg := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.remoteIpDetails.organization.asnOrg');
Isp := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.remoteIpDetails.organization.isp');
Org := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.remoteIpDetails.organization.org');
ServiceName := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.serviceName');
UserAgent := CkJsonObject__stringOf(jResp,'findings[i].service.action.awsApiCallAction.userAgent');
DnsRequestActionDomain := CkJsonObject__stringOf(jResp,'findings[i].service.action.dnsRequestAction.domain');
Parameters := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.parameters');
CityCityName := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.city.cityName');
CountryCountryCode := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.country.countryCode');
CountryCountryName := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.country.countryName');
GeoLocationLat := CkJsonObject_IntOf(jResp,'findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.geoLocation.lat');
GeoLocationLon := CkJsonObject_IntOf(jResp,'findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.geoLocation.lon');
RemoteIpDetailsIpAddressV4 := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.ipAddressV4');
OrganizationAsn := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.organization.asn');
OrganizationAsnOrg := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.organization.asnOrg');
OrganizationIsp := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.organization.isp');
OrganizationOrg := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.organization.org');
RequestUri := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.requestUri');
StatusCode := CkJsonObject_IntOf(jResp,'findings[i].service.action.kubernetesApiCallAction.statusCode');
KubernetesApiCallActionUserAgent := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.userAgent');
Verb := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.verb');
Blocked := CkJsonObject_IntOf(jResp,'findings[i].service.action.networkConnectionAction.blocked');
ConnectionDirection := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.connectionDirection');
LocalIpDetailsIpAddressV4 := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.localIpDetails.ipAddressV4');
Port := CkJsonObject_IntOf(jResp,'findings[i].service.action.networkConnectionAction.localPortDetails.port');
PortName := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.localPortDetails.portName');
Protocol := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.protocol');
CityCityName := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.remoteIpDetails.city.cityName');
CountryCountryCode := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.remoteIpDetails.country.countryCode');
CountryCountryName := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.remoteIpDetails.country.countryName');
GeoLocationLat := CkJsonObject_IntOf(jResp,'findings[i].service.action.networkConnectionAction.remoteIpDetails.geoLocation.lat');
GeoLocationLon := CkJsonObject_IntOf(jResp,'findings[i].service.action.networkConnectionAction.remoteIpDetails.geoLocation.lon');
RemoteIpDetailsIpAddressV4 := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.remoteIpDetails.ipAddressV4');
OrganizationAsn := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.remoteIpDetails.organization.asn');
OrganizationAsnOrg := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.remoteIpDetails.organization.asnOrg');
OrganizationIsp := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.remoteIpDetails.organization.isp');
OrganizationOrg := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.remoteIpDetails.organization.org');
RemotePortDetailsPort := CkJsonObject_IntOf(jResp,'findings[i].service.action.networkConnectionAction.remotePortDetails.port');
RemotePortDetailsPortName := CkJsonObject__stringOf(jResp,'findings[i].service.action.networkConnectionAction.remotePortDetails.portName');
PortProbeActionBlocked := CkJsonObject_IntOf(jResp,'findings[i].service.action.portProbeAction.blocked');
Archived := CkJsonObject_IntOf(jResp,'findings[i].service.archived');
Count := CkJsonObject_IntOf(jResp,'findings[i].service.count');
DetectorId := CkJsonObject__stringOf(jResp,'findings[i].service.detectorId');
EventFirstSeen := CkJsonObject__stringOf(jResp,'findings[i].service.eventFirstSeen');
EventLastSeen := CkJsonObject__stringOf(jResp,'findings[i].service.eventLastSeen');
ResourceRole := CkJsonObject__stringOf(jResp,'findings[i].service.resourceRole');
serviceServiceName := CkJsonObject__stringOf(jResp,'findings[i].service.serviceName');
UserFeedback := CkJsonObject__stringOf(jResp,'findings[i].service.userFeedback');
severity := CkJsonObject_IntOf(jResp,'findings[i].severity');
title := CkJsonObject__stringOf(jResp,'findings[i].title');
v_type := CkJsonObject__stringOf(jResp,'findings[i].type');
updatedAt := CkJsonObject__stringOf(jResp,'findings[i].updatedAt');
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.eksClusterDetails.tags');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
key := CkJsonObject__stringOf(jResp,'findings[i].resource.eksClusterDetails.tags[j].key');
value := CkJsonObject__stringOf(jResp,'findings[i].resource.eksClusterDetails.tags[j].value');
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.instanceDetails.networkInterfaces');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
networkInterfaceId := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].networkInterfaceId');
privateDnsName := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].privateDnsName');
privateIpAddress := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].privateIpAddress');
publicDnsName := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].publicDnsName');
publicIp := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].publicIp');
subnetId := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].subnetId');
vpcId := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].vpcId');
k := 0;
count_k := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].ipv6Addresses');
while k < count_k do
begin
CkJsonObject_putK(jResp,k);
strVal := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].ipv6Addresses[k]');
k := k + 1;
end;
k := 0;
count_k := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].privateIpAddresses');
while k < count_k do
begin
CkJsonObject_putK(jResp,k);
privateDnsName := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].privateIpAddresses[k].privateDnsName');
privateIpAddress := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].privateIpAddresses[k].privateIpAddress');
k := k + 1;
end;
k := 0;
count_k := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].securityGroups');
while k < count_k do
begin
CkJsonObject_putK(jResp,k);
groupId := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].securityGroups[k].groupId');
groupName := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.networkInterfaces[j].securityGroups[k].groupName');
k := k + 1;
end;
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.instanceDetails.productCodes');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
code := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.productCodes[j].code');
productType := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.productCodes[j].productType');
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.instanceDetails.tags');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
key := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.tags[j].key');
value := CkJsonObject__stringOf(jResp,'findings[i].resource.instanceDetails.tags[j].value');
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.kubernetesDetails.kubernetesUserDetails.groups');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
strVal := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesUserDetails.groups[j]');
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
containerRuntime := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].containerRuntime');
id := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].id');
image := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].image');
imagePrefix := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].imagePrefix');
name := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].name');
Privileged := CkJsonObject_IntOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].securityContext.privileged');
k := 0;
count_k := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].volumeMounts');
while k < count_k do
begin
CkJsonObject_putK(jResp,k);
mountPath := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].volumeMounts[k].mountPath');
name := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].volumeMounts[k].name');
k := k + 1;
end;
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.volumes');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
Path := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.volumes[j].hostPath.path');
name := CkJsonObject__stringOf(jResp,'findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.volumes[j].name');
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.s3BucketDetails');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
arn := CkJsonObject__stringOf(jResp,'findings[i].resource.s3BucketDetails[j].arn');
createdAt_int := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].createdAt');
EncryptionType := CkJsonObject__stringOf(jResp,'findings[i].resource.s3BucketDetails[j].defaultServerSideEncryption.encryptionType');
KmsMasterKeyArn := CkJsonObject__stringOf(jResp,'findings[i].resource.s3BucketDetails[j].defaultServerSideEncryption.kmsMasterKeyArn');
name := CkJsonObject__stringOf(jResp,'findings[i].resource.s3BucketDetails[j].name');
ownerId := CkJsonObject__stringOf(jResp,'findings[i].resource.s3BucketDetails[j].owner.id');
EffectivePermission := CkJsonObject__stringOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.effectivePermission');
BlockPublicAcls := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.accountLevelPermissions.blockPublicAccess.blockPublicAcls');
BlockPublicPolicy := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.accountLevelPermissions.blockPublicAccess.blockPublicPolicy');
IgnorePublicAcls := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.accountLevelPermissions.blockPublicAccess.ignorePublicAcls');
RestrictPublicBuckets := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.accountLevelPermissions.blockPublicAccess.restrictPublicBuckets');
AllowsPublicReadAccess := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.accessControlList.allowsPublicReadAccess');
AllowsPublicWriteAccess := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.accessControlList.allowsPublicWriteAccess');
BlockPublicAccessBlockPublicAcls := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.blockPublicAccess.blockPublicAcls');
BlockPublicAccessBlockPublicPolicy := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.blockPublicAccess.blockPublicPolicy');
BlockPublicAccessIgnorePublicAcls := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.blockPublicAccess.ignorePublicAcls');
BlockPublicAccessRestrictPublicBuckets := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.blockPublicAccess.restrictPublicBuckets');
BucketPolicyAllowsPublicReadAccess := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.bucketPolicy.allowsPublicReadAccess');
BucketPolicyAllowsPublicWriteAccess := CkJsonObject_IntOf(jResp,'findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.bucketPolicy.allowsPublicWriteAccess');
v_type := CkJsonObject__stringOf(jResp,'findings[i].resource.s3BucketDetails[j].type');
k := 0;
count_k := CkJsonObject_SizeOfArray(jResp,'findings[i].resource.s3BucketDetails[j].tags');
while k < count_k do
begin
CkJsonObject_putK(jResp,k);
key := CkJsonObject__stringOf(jResp,'findings[i].resource.s3BucketDetails[j].tags[k].key');
value := CkJsonObject__stringOf(jResp,'findings[i].resource.s3BucketDetails[j].tags[k].value');
k := k + 1;
end;
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].service.action.kubernetesApiCallAction.sourceIps');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
strVal := CkJsonObject__stringOf(jResp,'findings[i].service.action.kubernetesApiCallAction.sourceIps[j]');
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].service.action.portProbeAction.portProbeDetails');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
localIpDetailsIpAddressV4 := CkJsonObject__stringOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].localIpDetails.ipAddressV4');
localPortDetailsPort := CkJsonObject_IntOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].localPortDetails.port');
localPortDetailsPortName := CkJsonObject__stringOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].localPortDetails.portName');
CityCityName := CkJsonObject__stringOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.city.cityName');
CountryCountryCode := CkJsonObject__stringOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.country.countryCode');
CountryCountryName := CkJsonObject__stringOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.country.countryName');
GeoLocationLat := CkJsonObject_IntOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.geoLocation.lat');
GeoLocationLon := CkJsonObject_IntOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.geoLocation.lon');
remoteIpDetailsIpAddressV4 := CkJsonObject__stringOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.ipAddressV4');
OrganizationAsn := CkJsonObject__stringOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.organization.asn');
OrganizationAsnOrg := CkJsonObject__stringOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.organization.asnOrg');
OrganizationIsp := CkJsonObject__stringOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.organization.isp');
OrganizationOrg := CkJsonObject__stringOf(jResp,'findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.organization.org');
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'findings[i].service.evidence.threatIntelligenceDetails');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
threatListName := CkJsonObject__stringOf(jResp,'findings[i].service.evidence.threatIntelligenceDetails[j].threatListName');
k := 0;
count_k := CkJsonObject_SizeOfArray(jResp,'findings[i].service.evidence.threatIntelligenceDetails[j].threatNames');
while k < count_k do
begin
CkJsonObject_putK(jResp,k);
strVal := CkJsonObject__stringOf(jResp,'findings[i].service.evidence.threatIntelligenceDetails[j].threatNames[k]');
k := k + 1;
end;
j := j + 1;
end;
i := i + 1;
end;
// A sample JSON response body parsed by the above code:
// {
// "findings": [
// {
// "accountId": "string",
// "arn": "string",
// "confidence": number,
// "createdAt": "string",
// "description": "string",
// "id": "string",
// "partition": "string",
// "region": "string",
// "resource": {
// "accessKeyDetails": {
// "accessKeyId": "string",
// "principalId": "string",
// "userName": "string",
// "userType": "string"
// },
// "eksClusterDetails": {
// "arn": "string",
// "createdAt": number,
// "name": "string",
// "status": "string",
// "tags": [
// {
// "key": "string",
// "value": "string"
// }
// ],
// "vpcId": "string"
// },
// "instanceDetails": {
// "availabilityZone": "string",
// "iamInstanceProfile": {
// "arn": "string",
// "id": "string"
// },
// "imageDescription": "string",
// "imageId": "string",
// "instanceId": "string",
// "instanceState": "string",
// "instanceType": "string",
// "launchTime": "string",
// "networkInterfaces": [
// {
// "ipv6Addresses": [
// "string"
// ],
// "networkInterfaceId": "string",
// "privateDnsName": "string",
// "privateIpAddress": "string",
// "privateIpAddresses": [
// {
// "privateDnsName": "string",
// "privateIpAddress": "string"
// }
// ],
// "publicDnsName": "string",
// "publicIp": "string",
// "securityGroups": [
// {
// "groupId": "string",
// "groupName": "string"
// }
// ],
// "subnetId": "string",
// "vpcId": "string"
// }
// ],
// "outpostArn": "string",
// "platform": "string",
// "productCodes": [
// {
// "code": "string",
// "productType": "string"
// }
// ],
// "tags": [
// {
// "key": "string",
// "value": "string"
// }
// ]
// },
// "kubernetesDetails": {
// "kubernetesUserDetails": {
// "groups": [
// "string"
// ],
// "uid": "string",
// "username": "string"
// },
// "kubernetesWorkloadDetails": {
// "containers": [
// {
// "containerRuntime": "string",
// "id": "string",
// "image": "string",
// "imagePrefix": "string",
// "name": "string",
// "securityContext": {
// "privileged": boolean
// },
// "volumeMounts": [
// {
// "mountPath": "string",
// "name": "string"
// }
// ]
// }
// ],
// "hostNetwork": boolean,
// "name": "string",
// "namespace": "string",
// "type": "string",
// "uid": "string",
// "volumes": [
// {
// "hostPath": {
// "path": "string"
// },
// "name": "string"
// }
// ]
// }
// },
// "resourceType": "string",
// "s3BucketDetails": [
// {
// "arn": "string",
// "createdAt": number,
// "defaultServerSideEncryption": {
// "encryptionType": "string",
// "kmsMasterKeyArn": "string"
// },
// "name": "string",
// "owner": {
// "id": "string"
// },
// "publicAccess": {
// "effectivePermission": "string",
// "permissionConfiguration": {
// "accountLevelPermissions": {
// "blockPublicAccess": {
// "blockPublicAcls": boolean,
// "blockPublicPolicy": boolean,
// "ignorePublicAcls": boolean,
// "restrictPublicBuckets": boolean
// }
// },
// "bucketLevelPermissions": {
// "accessControlList": {
// "allowsPublicReadAccess": boolean,
// "allowsPublicWriteAccess": boolean
// },
// "blockPublicAccess": {
// "blockPublicAcls": boolean,
// "blockPublicPolicy": boolean,
// "ignorePublicAcls": boolean,
// "restrictPublicBuckets": boolean
// },
// "bucketPolicy": {
// "allowsPublicReadAccess": boolean,
// "allowsPublicWriteAccess": boolean
// }
// }
// }
// },
// "tags": [
// {
// "key": "string",
// "value": "string"
// }
// ],
// "type": "string"
// }
// ]
// },
// "schemaVersion": "string",
// "service": {
// "action": {
// "actionType": "string",
// "awsApiCallAction": {
// "api": "string",
// "callerType": "string",
// "domainDetails": {
// "domain": "string"
// },
// "errorCode": "string",
// "remoteAccountDetails": {
// "accountId": "string",
// "affiliated": boolean
// },
// "remoteIpDetails": {
// "city": {
// "cityName": "string"
// },
// "country": {
// "countryCode": "string",
// "countryName": "string"
// },
// "geoLocation": {
// "lat": number,
// "lon": number
// },
// "ipAddressV4": "string",
// "organization": {
// "asn": "string",
// "asnOrg": "string",
// "isp": "string",
// "org": "string"
// }
// },
// "serviceName": "string",
// "userAgent": "string"
// },
// "dnsRequestAction": {
// "domain": "string"
// },
// "kubernetesApiCallAction": {
// "parameters": "string",
// "remoteIpDetails": {
// "city": {
// "cityName": "string"
// },
// "country": {
// "countryCode": "string",
// "countryName": "string"
// },
// "geoLocation": {
// "lat": number,
// "lon": number
// },
// "ipAddressV4": "string",
// "organization": {
// "asn": "string",
// "asnOrg": "string",
// "isp": "string",
// "org": "string"
// }
// },
// "requestUri": "string",
// "sourceIps": [
// "string"
// ],
// "statusCode": number,
// "userAgent": "string",
// "verb": "string"
// },
// "networkConnectionAction": {
// "blocked": boolean,
// "connectionDirection": "string",
// "localIpDetails": {
// "ipAddressV4": "string"
// },
// "localPortDetails": {
// "port": number,
// "portName": "string"
// },
// "protocol": "string",
// "remoteIpDetails": {
// "city": {
// "cityName": "string"
// },
// "country": {
// "countryCode": "string",
// "countryName": "string"
// },
// "geoLocation": {
// "lat": number,
// "lon": number
// },
// "ipAddressV4": "string",
// "organization": {
// "asn": "string",
// "asnOrg": "string",
// "isp": "string",
// "org": "string"
// }
// },
// "remotePortDetails": {
// "port": number,
// "portName": "string"
// }
// },
// "portProbeAction": {
// "blocked": boolean,
// "portProbeDetails": [
// {
// "localIpDetails": {
// "ipAddressV4": "string"
// },
// "localPortDetails": {
// "port": number,
// "portName": "string"
// },
// "remoteIpDetails": {
// "city": {
// "cityName": "string"
// },
// "country": {
// "countryCode": "string",
// "countryName": "string"
// },
// "geoLocation": {
// "lat": number,
// "lon": number
// },
// "ipAddressV4": "string",
// "organization": {
// "asn": "string",
// "asnOrg": "string",
// "isp": "string",
// "org": "string"
// }
// }
// }
// ]
// }
// },
// "archived": boolean,
// "count": number,
// "detectorId": "string",
// "eventFirstSeen": "string",
// "eventLastSeen": "string",
// "evidence": {
// "threatIntelligenceDetails": [
// {
// "threatListName": "string",
// "threatNames": [
// "string"
// ]
// }
// ]
// },
// "resourceRole": "string",
// "serviceName": "string",
// "userFeedback": "string"
// },
// "severity": number,
// "title": "string",
// "type": "string",
// "updatedAt": "string"
// }
// ]
// }
CkRest_Dispose(rest);
CkAuthAws_Dispose(authAws);
CkJsonObject_Dispose(json);
CkStringBuilder_Dispose(sbRequestBody);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);