mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
updates to check license at autopsy startup
This commit is contained in:
parent
f57eefed15
commit
e9cd619533
@ -68,3 +68,4 @@ CTLicenseDialog.licenseNumberTextField.toolTipText=AUT-XXXXXXXX-XXXX-XXXX-XXXX-X
|
|||||||
CTMalwareScannerOptionsPanel.licenseErrorLabel.text=
|
CTMalwareScannerOptionsPanel.licenseErrorLabel.text=
|
||||||
CTMalwareScannerOptionsPanel.licenseInfoRemoveButton.text=Remove License
|
CTMalwareScannerOptionsPanel.licenseInfoRemoveButton.text=Remove License
|
||||||
CTMalwareScannerOptionsPanel.text=<html>The Cyber Triage Malware Scanner module uses 40+ malware scanning engines to identify if Windows executables are malicious. It requires a paid subscription to use.</html>
|
CTMalwareScannerOptionsPanel.text=<html>The Cyber Triage Malware Scanner module uses 40+ malware scanning engines to identify if Windows executables are malicious. It requires a paid subscription to use.</html>
|
||||||
|
Installer_LicenseCheck_cloudExceptionTitle=Cyber Triage Error
|
||||||
|
@ -727,7 +727,7 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
|
|||||||
String errMessage;
|
String errMessage;
|
||||||
if (ex.getCause() != null && ex.getCause() instanceof CTCloudException cloudEx) {
|
if (ex.getCause() != null && ex.getCause() instanceof CTCloudException cloudEx) {
|
||||||
logger.log(Level.WARNING, "An API error occurred while fetching license information", cloudEx);
|
logger.log(Level.WARNING, "An API error occurred while fetching license information", cloudEx);
|
||||||
errMessage = cloudEx.getErrorCode().getDescription();
|
errMessage = cloudEx.getErrorDetails();
|
||||||
} else {
|
} else {
|
||||||
logger.log(Level.WARNING, "An error occurred while fetching data", ex);
|
logger.log(Level.WARNING, "An error occurred while fetching data", ex);
|
||||||
errMessage = Bundle.CTMalwareScannerOptionsPanel_LicenseFetcher_localErr_desc();
|
errMessage = Bundle.CTMalwareScannerOptionsPanel_LicenseFetcher_localErr_desc();
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2023 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.basistech.df.cybertriage.autopsy.ctoptions.ctcloud;
|
||||||
|
|
||||||
|
import com.basistech.df.cybertriage.autopsy.ctapi.CTApiDAO;
|
||||||
|
import com.basistech.df.cybertriage.autopsy.ctapi.CTCloudException;
|
||||||
|
import com.basistech.df.cybertriage.autopsy.ctapi.json.AuthTokenResponse;
|
||||||
|
import com.basistech.df.cybertriage.autopsy.ctapi.json.LicenseInfo;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import org.openide.modules.ModuleInstall;
|
||||||
|
import org.openide.util.NbBundle.Messages;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installer to check for a functional license at startup.
|
||||||
|
*/
|
||||||
|
public class Installer extends ModuleInstall {
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(Installer.class.getName());
|
||||||
|
|
||||||
|
private final static Installer INSTANCE = new Installer();
|
||||||
|
|
||||||
|
public static Installer getDefault() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Installer() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restored() {
|
||||||
|
new Thread(new LicenseCheck()).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Messages({
|
||||||
|
"Installer_LicenseCheck_cloudExceptionTitle=Cyber Triage Error"
|
||||||
|
})
|
||||||
|
private static class LicenseCheck implements Runnable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
Optional<LicenseInfo> licenseInfoOpt = CTLicensePersistence.getInstance().loadLicenseInfo();
|
||||||
|
if (licenseInfoOpt.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LicenseInfo licenseInfo = licenseInfoOpt.get();
|
||||||
|
AuthTokenResponse authTokenResp = CTApiDAO.getInstance().getAuthToken(licenseInfo.getDecryptedLicense());
|
||||||
|
// if we got this far, then it was a successful request
|
||||||
|
} catch (CTCloudException cloudEx) {
|
||||||
|
LOGGER.log(Level.WARNING, "A cloud exception occurred while fetching an auth token", cloudEx);
|
||||||
|
MessageNotifyUtil.Notify.warn(Bundle.Installer_LicenseCheck_cloudExceptionTitle(), cloudEx.getErrorDetails());
|
||||||
|
} catch (Throwable t) {
|
||||||
|
LOGGER.log(Level.WARNING, "An error occurred while fetching license info", t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -217,6 +217,7 @@ public class Installer extends ModuleInstall {
|
|||||||
packageInstallers.add(org.sleuthkit.autopsy.casemodule.Installer.getDefault());
|
packageInstallers.add(org.sleuthkit.autopsy.casemodule.Installer.getDefault());
|
||||||
packageInstallers.add(org.sleuthkit.autopsy.modules.hashdatabase.infrastructure.Installer.getDefault());
|
packageInstallers.add(org.sleuthkit.autopsy.modules.hashdatabase.infrastructure.Installer.getDefault());
|
||||||
packageInstallers.add(org.sleuthkit.autopsy.report.infrastructure.Installer.getDefault());
|
packageInstallers.add(org.sleuthkit.autopsy.report.infrastructure.Installer.getDefault());
|
||||||
|
packageInstallers.add(com.basistech.df.cybertriage.autopsy.ctoptions.ctcloud.Installer.getDefault());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a temporary workaround for the following bug in Tika that
|
* This is a temporary workaround for the following bug in Tika that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user