mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
update for limit type
This commit is contained in:
parent
5aded98cec
commit
c35357938d
@ -38,7 +38,7 @@ public class DecryptedLicenseResponse {
|
|||||||
private final Long fileUploads;
|
private final Long fileUploads;
|
||||||
private final Instant activationTime;
|
private final Instant activationTime;
|
||||||
private final String product;
|
private final String product;
|
||||||
private final String limitType;
|
private final LicenseLimitType limitType;
|
||||||
private final String timezone;
|
private final String timezone;
|
||||||
private final String customerEmail;
|
private final String customerEmail;
|
||||||
private final String customerName;
|
private final String customerName;
|
||||||
@ -54,7 +54,7 @@ public class DecryptedLicenseResponse {
|
|||||||
@JsonDeserialize(using = InstantEpochMillisDeserializer.class)
|
@JsonDeserialize(using = InstantEpochMillisDeserializer.class)
|
||||||
@JsonProperty("activationTime") Instant activationTime,
|
@JsonProperty("activationTime") Instant activationTime,
|
||||||
@JsonProperty("product") String product,
|
@JsonProperty("product") String product,
|
||||||
@JsonProperty("limitType") String limitType,
|
@JsonProperty("limitType") LicenseLimitType limitType,
|
||||||
@JsonProperty("timezone") String timezone,
|
@JsonProperty("timezone") String timezone,
|
||||||
@JsonProperty("customerEmail") String customerEmail,
|
@JsonProperty("customerEmail") String customerEmail,
|
||||||
@JsonProperty("customerName") String customerName
|
@JsonProperty("customerName") String customerName
|
||||||
@ -96,7 +96,7 @@ public class DecryptedLicenseResponse {
|
|||||||
return product;
|
return product;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLimitType() {
|
public LicenseLimitType getLimitType() {
|
||||||
return limitType;
|
return limitType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,10 @@ CTMalwareScannerOptionsPanel.licenseInfoIdLabel.text=
|
|||||||
CTMalwareScannerOptionsPanel.licenseInfoExpiresLabel.text=
|
CTMalwareScannerOptionsPanel.licenseInfoExpiresLabel.text=
|
||||||
CTMalwareScannerOptionsPanel.fileUploadsRemainingLabel.text=
|
CTMalwareScannerOptionsPanel.fileUploadsRemainingLabel.text=
|
||||||
CTMalwareScannerOptionsPanel.licenseInfoUserLabel.text=
|
CTMalwareScannerOptionsPanel.licenseInfoUserLabel.text=
|
||||||
|
CTMalwareScannerOptionsPanel_getResetSuffix_daily=/day
|
||||||
|
CTMalwareScannerOptionsPanel_getResetSuffix_hourly=/hour
|
||||||
|
CTMalwareScannerOptionsPanel_getResetSuffix_monthly=/month
|
||||||
|
CTMalwareScannerOptionsPanel_getResetSuffix_weekly=/week
|
||||||
CTMalwareScannerOptionsPanel_licenseAddDialog_desc=License Number:
|
CTMalwareScannerOptionsPanel_licenseAddDialog_desc=License Number:
|
||||||
CTMalwareScannerOptionsPanel_licenseAddDialog_title=Add a License...
|
CTMalwareScannerOptionsPanel_licenseAddDialog_title=Add a License...
|
||||||
CTMalwareScannerOptionsPanel_licenseAddDialogEnteredErr_desc=The license number has already been entered
|
CTMalwareScannerOptionsPanel_licenseAddDialogEnteredErr_desc=The license number has already been entered
|
||||||
@ -45,9 +49,11 @@ CTMalwareScannerOptionsPanel_malwareScans_fileUploadsRemaining=File uploads rema
|
|||||||
# {0} - hashLookupsRemaining
|
# {0} - hashLookupsRemaining
|
||||||
CTMalwareScannerOptionsPanel_malwareScans_hashLookupsRemaining=Hash lookups remaining: {0}
|
CTMalwareScannerOptionsPanel_malwareScans_hashLookupsRemaining=Hash lookups remaining: {0}
|
||||||
# {0} - maxDailyFileLookups
|
# {0} - maxDailyFileLookups
|
||||||
CTMalwareScannerOptionsPanel_malwareScans_maxDailyFileLookups=Max file uploads: {0}/day
|
# {1} - resetSuffix
|
||||||
|
CTMalwareScannerOptionsPanel_malwareScans_maxDailyFileLookups=Max file uploads: {0}{1}
|
||||||
# {0} - maxDailyLookups
|
# {0} - maxDailyLookups
|
||||||
CTMalwareScannerOptionsPanel_malwareScans_maxDailyHashLookups=Max Hash lookups: {0}/day
|
# {1} - resetSuffix
|
||||||
|
CTMalwareScannerOptionsPanel_malwareScans_maxDailyHashLookups=Max Hash lookups: {0}{1}
|
||||||
CTMalwareScannerOptionsPanel_MalwareScansFetcher_apiErr_title=Server Error
|
CTMalwareScannerOptionsPanel_MalwareScansFetcher_apiErr_title=Server Error
|
||||||
CTMalwareScannerOptionsPanel_MalwareScansFetcher_localErr_desc=A general error occurred while fetching malware scans information. Please try again later.
|
CTMalwareScannerOptionsPanel_MalwareScansFetcher_localErr_desc=A general error occurred while fetching malware scans information. Please try again later.
|
||||||
CTMalwareScannerOptionsPanel_MalwareScansFetcher_localErr_title=General Error
|
CTMalwareScannerOptionsPanel_MalwareScansFetcher_localErr_title=General Error
|
||||||
|
@ -24,6 +24,7 @@ import com.basistech.df.cybertriage.autopsy.ctapi.CTApiDAO;
|
|||||||
import com.basistech.df.cybertriage.autopsy.ctapi.json.AuthTokenResponse;
|
import com.basistech.df.cybertriage.autopsy.ctapi.json.AuthTokenResponse;
|
||||||
import com.basistech.df.cybertriage.autopsy.ctapi.json.DecryptedLicenseResponse;
|
import com.basistech.df.cybertriage.autopsy.ctapi.json.DecryptedLicenseResponse;
|
||||||
import com.basistech.df.cybertriage.autopsy.ctapi.json.LicenseInfo;
|
import com.basistech.df.cybertriage.autopsy.ctapi.json.LicenseInfo;
|
||||||
|
import com.basistech.df.cybertriage.autopsy.ctapi.json.LicenseLimitType;
|
||||||
import com.basistech.df.cybertriage.autopsy.ctapi.json.LicenseResponse;
|
import com.basistech.df.cybertriage.autopsy.ctapi.json.LicenseResponse;
|
||||||
import com.basistech.df.cybertriage.autopsy.ctapi.util.LicenseDecryptorUtil;
|
import com.basistech.df.cybertriage.autopsy.ctapi.util.LicenseDecryptorUtil;
|
||||||
import com.basistech.df.cybertriage.autopsy.ctapi.util.LicenseDecryptorUtil.InvalidLicenseException;
|
import com.basistech.df.cybertriage.autopsy.ctapi.util.LicenseDecryptorUtil.InvalidLicenseException;
|
||||||
@ -130,7 +131,7 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
|
|||||||
if (licenseInfo != null) {
|
if (licenseInfo != null) {
|
||||||
loadMalwareScansInfo(licenseInfo);
|
loadMalwareScansInfo(licenseInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
MalwareIngestSettings ingestSettings = ctPersistence.loadMalwareIngestSettings();
|
MalwareIngestSettings ingestSettings = ctPersistence.loadMalwareIngestSettings();
|
||||||
setIngestSettings(ingestSettings);
|
setIngestSettings(ingestSettings);
|
||||||
}
|
}
|
||||||
@ -138,12 +139,12 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
|
|||||||
private synchronized LicenseResponse getLicenseInfo() {
|
private synchronized LicenseResponse getLicenseInfo() {
|
||||||
return this.licenseInfo == null ? null : this.licenseInfo.getLicenseResponse();
|
return this.licenseInfo == null ? null : this.licenseInfo.getLicenseResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
private MalwareIngestSettings getIngestSettings() {
|
private MalwareIngestSettings getIngestSettings() {
|
||||||
return new MalwareIngestSettings()
|
return new MalwareIngestSettings()
|
||||||
.setUploadFiles(this.fileUploadCheckbox.isSelected());
|
.setUploadFiles(this.fileUploadCheckbox.isSelected());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setIngestSettings(MalwareIngestSettings ingestSettings) {
|
private void setIngestSettings(MalwareIngestSettings ingestSettings) {
|
||||||
if (ingestSettings == null) {
|
if (ingestSettings == null) {
|
||||||
ingestSettings = new MalwareIngestSettings();
|
ingestSettings = new MalwareIngestSettings();
|
||||||
@ -439,9 +440,11 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
|
|||||||
"# {0} - idNumber",
|
"# {0} - idNumber",
|
||||||
"CTMalwareScannerOptionsPanel_licenseInfo_id=ID: {0}",
|
"CTMalwareScannerOptionsPanel_licenseInfo_id=ID: {0}",
|
||||||
"# {0} - maxDailyLookups",
|
"# {0} - maxDailyLookups",
|
||||||
"CTMalwareScannerOptionsPanel_malwareScans_maxDailyHashLookups=Max Hash lookups: {0}/day",
|
"# {1} - resetSuffix",
|
||||||
|
"CTMalwareScannerOptionsPanel_malwareScans_maxDailyHashLookups=Max Hash lookups: {0}{1}",
|
||||||
"# {0} - maxDailyFileLookups",
|
"# {0} - maxDailyFileLookups",
|
||||||
"CTMalwareScannerOptionsPanel_malwareScans_maxDailyFileLookups=Max file uploads: {0}/day",
|
"# {1} - resetSuffix",
|
||||||
|
"CTMalwareScannerOptionsPanel_malwareScans_maxDailyFileLookups=Max file uploads: {0}{1}",
|
||||||
"# {0} - countersResetDate",
|
"# {0} - countersResetDate",
|
||||||
"CTMalwareScannerOptionsPanel_malwareScans_countersReset=Counters reset: {0}",
|
"CTMalwareScannerOptionsPanel_malwareScans_countersReset=Counters reset: {0}",
|
||||||
"# {0} - hashLookupsRemaining",
|
"# {0} - hashLookupsRemaining",
|
||||||
@ -477,7 +480,7 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
|
|||||||
this.malwareScansMessageLabel.setVisible(StringUtils.isNotBlank(this.authTokenMessage));
|
this.malwareScansMessageLabel.setVisible(StringUtils.isNotBlank(this.authTokenMessage));
|
||||||
this.malwareScansMessageLabel.setText(this.authTokenMessage);
|
this.malwareScansMessageLabel.setText(this.authTokenMessage);
|
||||||
|
|
||||||
if (authTokenResponse == null) {
|
if (authTokenResponse == null || this.licenseInfo == null) {
|
||||||
this.maxHashLookupsLabel.setVisible(false);
|
this.maxHashLookupsLabel.setVisible(false);
|
||||||
this.maxFileUploadsLabel.setVisible(false);
|
this.maxFileUploadsLabel.setVisible(false);
|
||||||
this.countersResetLabel.setVisible(false);
|
this.countersResetLabel.setVisible(false);
|
||||||
@ -485,15 +488,62 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
|
|||||||
this.fileUploadsRemainingLabel.setVisible(false);
|
this.fileUploadsRemainingLabel.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
this.maxHashLookupsLabel.setVisible(true);
|
this.maxHashLookupsLabel.setVisible(true);
|
||||||
this.maxHashLookupsLabel.setText(Bundle.CTMalwareScannerOptionsPanel_malwareScans_maxDailyHashLookups(this.authTokenResponse.getHashLookupLimit()));
|
this.maxHashLookupsLabel.setText(Bundle.CTMalwareScannerOptionsPanel_malwareScans_maxDailyHashLookups(
|
||||||
|
this.authTokenResponse.getHashLookupLimit(),
|
||||||
|
getResetSuffix(this.licenseInfo.getDecryptedLicense().getLimitType())));
|
||||||
|
|
||||||
this.maxFileUploadsLabel.setVisible(true);
|
this.maxFileUploadsLabel.setVisible(true);
|
||||||
this.maxFileUploadsLabel.setText(Bundle.CTMalwareScannerOptionsPanel_malwareScans_maxDailyFileLookups(this.authTokenResponse.getFileUploadLimit()));
|
this.maxFileUploadsLabel.setText(Bundle.CTMalwareScannerOptionsPanel_malwareScans_maxDailyFileLookups(
|
||||||
|
this.authTokenResponse.getFileUploadLimit(),
|
||||||
|
getResetSuffix(this.licenseInfo.getDecryptedLicense().getLimitType())));
|
||||||
|
|
||||||
this.countersResetLabel.setVisible(true);
|
this.countersResetLabel.setVisible(true);
|
||||||
this.countersResetLabel.setText(Bundle.CTMalwareScannerOptionsPanel_malwareScans_countersReset(this.authTokenResponse.getResetDate() == null ? "" : MALWARE_SCANS_RESET_FORMAT.format(this.authTokenResponse.getResetDate())));
|
this.countersResetLabel.setText(getCountersResetText(this.licenseInfo.getDecryptedLicense().getLimitType(), this.authTokenResponse));
|
||||||
|
|
||||||
this.hashLookupsRemainingLabel.setVisible(true);
|
this.hashLookupsRemainingLabel.setVisible(true);
|
||||||
this.hashLookupsRemainingLabel.setText(Bundle.CTMalwareScannerOptionsPanel_malwareScans_hashLookupsRemaining(remaining(this.authTokenResponse.getHashLookupLimit(), this.authTokenResponse.getHashLookupCount())));
|
this.hashLookupsRemainingLabel.setText(
|
||||||
|
Bundle.CTMalwareScannerOptionsPanel_malwareScans_hashLookupsRemaining(
|
||||||
|
remaining(this.authTokenResponse.getHashLookupLimit(), this.authTokenResponse.getHashLookupCount())));
|
||||||
|
|
||||||
this.fileUploadsRemainingLabel.setVisible(true);
|
this.fileUploadsRemainingLabel.setVisible(true);
|
||||||
this.fileUploadsRemainingLabel.setText(Bundle.CTMalwareScannerOptionsPanel_malwareScans_fileUploadsRemaining(remaining(this.authTokenResponse.getFileUploadLimit(), this.authTokenResponse.getFileUploadCount())));
|
this.fileUploadsRemainingLabel.setText(
|
||||||
|
Bundle.CTMalwareScannerOptionsPanel_malwareScans_fileUploadsRemaining(
|
||||||
|
remaining(this.authTokenResponse.getFileUploadLimit(), this.authTokenResponse.getFileUploadCount())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getCountersResetText(LicenseLimitType limitType, AuthTokenResponse authTokenResponse) {
|
||||||
|
if (limitType == null || limitType == LicenseLimitType.NO_RESET) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return Bundle.CTMalwareScannerOptionsPanel_malwareScans_countersReset(
|
||||||
|
MALWARE_SCANS_RESET_FORMAT.format(authTokenResponse.getResetDate()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Messages({
|
||||||
|
"CTMalwareScannerOptionsPanel_getResetSuffix_hourly=/hour",
|
||||||
|
"CTMalwareScannerOptionsPanel_getResetSuffix_daily=/day",
|
||||||
|
"CTMalwareScannerOptionsPanel_getResetSuffix_weekly=/week",
|
||||||
|
"CTMalwareScannerOptionsPanel_getResetSuffix_monthly=/month"
|
||||||
|
})
|
||||||
|
private String getResetSuffix(LicenseLimitType limitType) {
|
||||||
|
if (limitType == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (limitType) {
|
||||||
|
case HOURLY:
|
||||||
|
return Bundle.CTMalwareScannerOptionsPanel_getResetSuffix_hourly();
|
||||||
|
case DAILY:
|
||||||
|
return Bundle.CTMalwareScannerOptionsPanel_getResetSuffix_daily();
|
||||||
|
case WEEKLY:
|
||||||
|
return Bundle.CTMalwareScannerOptionsPanel_getResetSuffix_weekly();
|
||||||
|
case MONTHLY:
|
||||||
|
return Bundle.CTMalwareScannerOptionsPanel_getResetSuffix_monthly();
|
||||||
|
case NO_RESET:
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user