Skip to content
Snippets Groups Projects
Commit dc9c212d authored by Greg DiCristofaro's avatar Greg DiCristofaro
Browse files

fixes

parent e3353b29
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,11 @@ MalwareScanIngestModule_ShareProcessing_noLookupsRemaining_desc=There are no mor ...@@ -33,6 +33,11 @@ MalwareScanIngestModule_ShareProcessing_noLookupsRemaining_desc=There are no mor
MalwareScanIngestModule_ShareProcessing_noLookupsRemaining_title=No remaining lookups MalwareScanIngestModule_ShareProcessing_noLookupsRemaining_title=No remaining lookups
MalwareScanIngestModule_ShareProcessing_noUploadsRemaining_desc=There are no more remaining file uploads for this license at this time. File uploading will be disabled. MalwareScanIngestModule_ShareProcessing_noUploadsRemaining_desc=There are no more remaining file uploads for this license at this time. File uploading will be disabled.
MalwareScanIngestModule_ShareProcessing_noUploadsRemaining_title=No remaining file uploads MalwareScanIngestModule_ShareProcessing_noUploadsRemaining_title=No remaining file uploads
MalwareScanIngestModule_uploadFile_noRemainingFileUploads_desc=There are no more file uploads on this license at this time. File uploads will be disabled for remaining uploads.
MalwareScanIngestModule_uploadFile_noRemainingFileUploads_title=No Remaining File Uploads
# {0} - objectId
MalwareScanIngestModule_uploadFile_notUploadable_desc=A file did not meet requirements for upload (object id: {0}).
MalwareScanIngestModule_uploadFile_notUploadable_title=Not Able to Upload
MalwareScanIngestModuleFactory_description=The malware scan ingest module queries the Cyber Triage cloud API for any possible malicious executables. MalwareScanIngestModuleFactory_description=The malware scan ingest module queries the Cyber Triage cloud API for any possible malicious executables.
MalwareScanIngestModuleFactory_displayName=Cyber Triage Malware Scanner MalwareScanIngestModuleFactory_displayName=Cyber Triage Malware Scanner
MalwareScanIngestModuleFactory_version=1.0.0 MalwareScanIngestModuleFactory_version=1.0.0
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
import com.basistech.df.cybertriage.autopsy.ctapi.json.MalwareResultBean.Status; import com.basistech.df.cybertriage.autopsy.ctapi.json.MalwareResultBean.Status;
import com.basistech.df.cybertriage.autopsy.ctapi.json.MetadataUploadRequest; import com.basistech.df.cybertriage.autopsy.ctapi.json.MetadataUploadRequest;
import com.basistech.df.cybertriage.autopsy.ctoptions.ctcloud.CTLicensePersistence; import com.basistech.df.cybertriage.autopsy.ctoptions.ctcloud.CTLicensePersistence;
import java.security.DigestInputStream;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.text.MessageFormat; import java.text.MessageFormat;
...@@ -559,6 +558,18 @@ private List<CTCloudBean> getHashLookupResults(IngestJobState ingestJobState, Li ...@@ -559,6 +558,18 @@ private List<CTCloudBean> getHashLookupResults(IngestJobState ingestJobState, Li
} else if (ingestJobState.getIngestJobContext().fileIngestIsCancelled()) { } else if (ingestJobState.getIngestJobContext().fileIngestIsCancelled()) {
return Collections.emptyList(); return Collections.emptyList();
} }
// while we have a valid auth token, also check file uploads.
if (ingestJobState.isUploadUnknownFiles()) {
long remainingUploads = remaining(authTokenResponse.getFileUploadLimit(), authTokenResponse.getHashLookupCount());
if (remainingUploads <= 0) {
ingestJobState.disableUploadUnknownFiles();
notifyWarning(
Bundle.MalwareScanIngestModule_uploadFile_noRemainingFileUploads_title(),
Bundle.MalwareScanIngestModule_uploadFile_noRemainingFileUploads_desc(),
null);
}
}
// using auth token, get results // using auth token, get results
return ctApiDAO.getReputationResults( return ctApiDAO.getReputationResults(
...@@ -598,13 +609,27 @@ private static boolean isUploadable(AbstractFile af) { ...@@ -598,13 +609,27 @@ private static boolean isUploadable(AbstractFile af) {
* @throws CTCloudException * @throws CTCloudException
* @throws TskCoreException * @throws TskCoreException
*/ */
@Messages({
"MalwareScanIngestModule_uploadFile_notUploadable_title=Not Able to Upload",
"# {0} - objectId",
"MalwareScanIngestModule_uploadFile_notUploadable_desc=A file did not meet requirements for upload (object id: {0}).",
"MalwareScanIngestModule_uploadFile_noRemainingFileUploads_title=No Remaining File Uploads",
"MalwareScanIngestModule_uploadFile_noRemainingFileUploads_desc=There are no more file uploads on this license at this time. File uploads will be disabled for remaining uploads.",})
private boolean uploadFile(IngestJobState ingestJobState, String md5, long objId) throws CTCloudException, TskCoreException, NoSuchAlgorithmException, ReadContentInputStream.ReadContentInputStreamException { private boolean uploadFile(IngestJobState ingestJobState, String md5, long objId) throws CTCloudException, TskCoreException, NoSuchAlgorithmException, ReadContentInputStream.ReadContentInputStreamException {
if (!ingestJobState.isUploadUnknownFiles() || ingestJobState.getIngestJobContext().fileIngestIsCancelled()) { if (!ingestJobState.isUploadUnknownFiles() || ingestJobState.getIngestJobContext().fileIngestIsCancelled()) {
return false; return false;
} }
AbstractFile af = ingestJobState.getTskCase().getAbstractFileById(objId); AbstractFile af = ingestJobState.getTskCase().getAbstractFileById(objId);
if (af == null || !isUploadable(af)) { if (af == null) {
return false;
}
if (!isUploadable(af)) {
notifyWarning(
Bundle.MalwareScanIngestModule_uploadFile_notUploadable_title(),
Bundle.MalwareScanIngestModule_uploadFile_notUploadable_desc(objId),
null);
return false; return false;
} }
...@@ -615,6 +640,11 @@ private boolean uploadFile(IngestJobState ingestJobState, String md5, long objId ...@@ -615,6 +640,11 @@ private boolean uploadFile(IngestJobState ingestJobState, String md5, long objId
} else if (remaining(authTokenResponse.getFileUploadLimit(), authTokenResponse.getFileUploadCount()) <= 0) { } else if (remaining(authTokenResponse.getFileUploadLimit(), authTokenResponse.getFileUploadCount()) <= 0) {
// don't proceed with upload if reached limit // don't proceed with upload if reached limit
ingestJobState.disableUploadUnknownFiles(); ingestJobState.disableUploadUnknownFiles();
notifyWarning(
Bundle.MalwareScanIngestModule_uploadFile_noRemainingFileUploads_title(),
Bundle.MalwareScanIngestModule_uploadFile_noRemainingFileUploads_desc(),
null);
return false; return false;
} else if (ingestJobState.getIngestJobContext().fileIngestIsCancelled()) { } else if (ingestJobState.getIngestJobContext().fileIngestIsCancelled()) {
return false; return false;
...@@ -640,6 +670,7 @@ private boolean uploadFile(IngestJobState ingestJobState, String md5, long objId ...@@ -640,6 +670,7 @@ private boolean uploadFile(IngestJobState ingestJobState, String md5, long objId
/** /**
* Does long polling for any pending results. * Does long polling for any pending results.
*
* @param ingestJobState The state of the ingest job. * @param ingestJobState The state of the ingest job.
* @throws InterruptedException * @throws InterruptedException
* @throws CTCloudException * @throws CTCloudException
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment