19 package com.basistech.df.cybertriage.autopsy.ctapi;
33 import java.io.InputStream;
34 import java.util.Collections;
35 import java.util.HashMap;
36 import java.util.List;
38 import org.apache.commons.collections.CollectionUtils;
50 private static final String
CTCLOUD_SERVER_HASH_PATH =
"/_ah/api/reputation/v1/query/file/hash/md5?query_types=CORRELATION,MALWARE";
68 private final CTCloudHttpClient
httpClient = CTCloudHttpClient.getInstance();
74 .setProduct(AUTOPSY_PRODUCT)
77 return httpClient.doPost(LICENSE_REQUEST_PATH, licenseRequest,
LicenseResponse.class);
89 .
setFileUploadSize(fileUploadSize != null && fileUploadSize > 0 ? fileUploadSize : null)
91 .setHostId(decrypted.getLicenseHostId());
93 return httpClient.doPost(AUTH_TOKEN_REQUEST_PATH, authTokenRequest,
AuthTokenResponse.class);
97 httpClient.doFileUploadPut(fileUploadRequest);
101 httpClient.doPost(CTCLOUD_UPLOAD_FILE_METADATA_PATH,
getAuthParams(authenticatedRequestData), metaRequest, null);
105 return new HashMap<String, String>() {
107 put(
"api_key", authenticatedRequestData.
getApiKey());
108 put(
"token", authenticatedRequestData.
getToken());
109 put(
"host_id", authenticatedRequestData.
getHostId());
115 if (CollectionUtils.isEmpty(md5Hashes)) {
116 return Collections.emptyList();
123 CTCLOUD_SERVER_HASH_PATH,
129 return resp == null || resp.
getItems() == null
130 ? Collections.emptyList()
static Map< String, String > getAuthParams(AuthenticatedRequestData authenticatedRequestData)
LicenseRequest setTimeZoneId(String timeZoneId)
static String getInferredUserTimeZone()
AuthTokenResponse getAuthToken(DecryptedLicenseResponse decrypted, Long fileUploadSize)
List< CTCloudBean > getItems()
static final CTApiDAO instance
static CTApiDAO getInstance()
LicenseRequest setHostId(String hostId)
AuthTokenRequest setFileUploadSize(Long fileUploadSize)
static final String CTCLOUD_SERVER_HASH_PATH
void uploadMeta(AuthenticatedRequestData authenticatedRequestData, MetadataUploadRequest metaRequest)
List< CTCloudBean > getReputationResults(AuthenticatedRequestData authenticatedRequestData, List< String > md5Hashes)
LicenseRequest setBoostLicenseCode(String boostLicenseCode)
AuthTokenRequest setRequestFileUpload(boolean requestFileUpload)
static String getAppVersion()
void uploadFile(FileUploadRequest fileUploadRequest)
AuthTokenRequest setAutopsyVersion(String autopsyVersion)
static final String CTCLOUD_UPLOAD_FILE_METADATA_PATH
static String generateLicenseHostID()
AuthTokenResponse getAuthToken(DecryptedLicenseResponse decrypted)
static final String LICENSE_REQUEST_PATH
AuthTokenRequest setBoostLicenseId(String boostLicenseId)
FileReputationRequest setHashes(List< String > hashes)
static final String AUTOPSY_PRODUCT
static String getVersion()
static final String AUTH_TOKEN_REQUEST_PATH
LicenseResponse getLicenseInfo(String licenseString)
final CTCloudHttpClient httpClient