some fixes

This commit is contained in:
Greg DiCristofaro 2023-07-27 15:33:29 -04:00
parent 9a702f5cca
commit 8917867778
3 changed files with 12 additions and 11 deletions

View File

@ -96,7 +96,7 @@ public class CTApiDAO {
}
public void uploadMeta(AuthenticatedRequestData authenticatedRequestData, MetadataUploadRequest metaRequest) throws CTCloudException {
httpClient.doPost(AUTH_TOKEN_REQUEST_PATH, getAuthParams(authenticatedRequestData), metaRequest, null);
httpClient.doPost(CTCLOUD_UPLOAD_FILE_METADATA_PATH, getAuthParams(authenticatedRequestData), metaRequest, null);
}
private static Map<String, String> getAuthParams(AuthenticatedRequestData authenticatedRequestData) {

View File

@ -38,10 +38,10 @@ public class MetadataUploadRequest {
private String filePath;
@JsonProperty("fileSize")
private long fileSizeBytes;
private Long fileSizeBytes;
@JsonProperty("createdDate")
private long createdDate;
private Long createdDate;
public String getFileUploadUrl() {
return fileUploadUrl;
@ -88,20 +88,20 @@ public class MetadataUploadRequest {
return this;
}
public long getFileSizeBytes() {
public Long getFileSizeBytes() {
return fileSizeBytes;
}
public MetadataUploadRequest setFileSizeBytes(long fileSizeBytes) {
public MetadataUploadRequest setFileSizeBytes(Long fileSizeBytes) {
this.fileSizeBytes = fileSizeBytes;
return this;
}
public long getCreatedDate() {
public Long getCreatedDate() {
return createdDate;
}
public MetadataUploadRequest setCreatedDate(long createdDate) {
public MetadataUploadRequest setCreatedDate(Long createdDate) {
this.createdDate = createdDate;
return this;
}

View File

@ -462,7 +462,7 @@ public class MalwareScanIngestModule implements FileIngestModule {
}
if (performFileUpload) {
uploadFile(ingestJobState, correspondingObjIds.get(0));
uploadFile(ingestJobState, sanitizedMd5, correspondingObjIds.get(0));
}
ingestJobState.getUnidentifiedHashes().put(sanitizedMd5, correspondingObjIds);
@ -539,7 +539,7 @@ public class MalwareScanIngestModule implements FileIngestModule {
* @throws CTCloudException
* @throws TskCoreException
*/
private boolean uploadFile(IngestJobState ingestJobState, long objId) throws CTCloudException, TskCoreException {
private boolean uploadFile(IngestJobState ingestJobState, String md5, long objId) throws CTCloudException, TskCoreException {
if (!ingestJobState.isUploadUnknownFiles() || ingestJobState.getIngestJobContext().fileIngestIsCancelled()) {
return false;
}
@ -567,11 +567,12 @@ public class MalwareScanIngestModule implements FileIngestModule {
// upload metadata
MetadataUploadRequest metaRequest = new MetadataUploadRequest()
.setCreatedDate(af.getCrtime())
.setCreatedDate(af.getCrtime() == 0 ? null : af.getCrtime())
.setFilePath(af.getUniquePath())
.setFileSizeBytes(af.getSize())
.setFileUploadUrl(authTokenResponse.getFileUploadUrl())
.setMd5(af.getMd5Hash())
.setMd5(md5)
// these may be missing, but that's fine
.setSha1(af.getSha1Hash())
.setSha256(af.getSha256Hash());