Merge branch 'CT-7160-ctCloudIngest' of github.com:gdicristofaro/autopsy into CT-7161-fileUpload

This commit is contained in:
Greg DiCristofaro 2023-07-26 15:10:54 -04:00
commit 673f623c7b
11 changed files with 33 additions and 30 deletions

View File

@ -4,6 +4,7 @@
<chain name="main"> <chain name="main">
<ibiblio name="central" root="https://repo1.maven.org/maven2" m2compatible="true"/> <ibiblio name="central" root="https://repo1.maven.org/maven2" m2compatible="true"/>
<ibiblio name="maven.restlet.org" root="http://maven.restlet.com" m2compatible="true" /> <ibiblio name="maven.restlet.org" root="http://maven.restlet.com" m2compatible="true" />
<ibiblio name="license4j.com" root="http://www.license4j.com/maven/" m2compatible="true" />
</chain> </chain>
</resolvers> </resolvers>
<property name="packaging.type" value="jar" /> <property name="packaging.type" value="jar" />

View File

@ -323,6 +323,7 @@
</test-type> </test-type>
</test-dependencies> </test-dependencies>
<public-packages> <public-packages>
<package>com.basistech.df.cybertriage.autopsy.ctoptions.subpanel</package>
<package>net.sf.sevenzipjbinding</package> <package>net.sf.sevenzipjbinding</package>
<package>net.sf.sevenzipjbinding.impl</package> <package>net.sf.sevenzipjbinding.impl</package>
<package>net.sf.sevenzipjbinding.simple</package> <package>net.sf.sevenzipjbinding.simple</package>

View File

@ -24,11 +24,9 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
/** /**
* * An exception thrown due to an error that occurs while making a CT Cloud REST
* @author rishwanth * API request.
*/ */
public class CTCloudException extends Exception{ public class CTCloudException extends Exception{
private final ErrorCode errorCode; private final ErrorCode errorCode;

View File

@ -65,7 +65,7 @@ import org.apache.http.impl.client.WinHttpClients;
import org.sleuthkit.autopsy.coreutils.Version; import org.sleuthkit.autopsy.coreutils.Version;
/** /**
* Actually makes the http requests to CT cloud. * Makes the http requests to CT cloud.
*/ */
public class CTCloudHttpClient { public class CTCloudHttpClient {
@ -293,12 +293,10 @@ public class CTCloudHttpClient {
} }
/** /**
* Creates and returns a CloseableHttpClient SYSTEM and MANUAL looks up from * Creates a connection to CT Cloud with the given arguments.
* runtime proxy config settings. These are updated accordingly from the * @param proxySettings The network proxy settings.
* Proxy Config UI. This allows us to keep the CreateConnection call fairly * @param sslContext The ssl context or null.
* simple and not have to deal with the System Proxy settings and such. * @return The connection to CT Cloud.
*
* @return
*/ */
private static CloseableHttpClient createConnection(ProxySettingArgs proxySettings, SSLContext sslContext) { private static CloseableHttpClient createConnection(ProxySettingArgs proxySettings, SSLContext sslContext) {
HttpClientBuilder builder = getHttpClientBuilder(proxySettings); HttpClientBuilder builder = getHttpClientBuilder(proxySettings);

View File

@ -20,6 +20,9 @@ package com.basistech.df.cybertriage.autopsy.ctapi;
import java.net.URI; import java.net.URI;
/**
* Constants regarding connections to cyber triage cloud.
*/
final public class Constants { final public class Constants {
public static final String CYBER_TRIAGE = "CyberTriage"; public static final String CYBER_TRIAGE = "CyberTriage";

View File

@ -18,8 +18,6 @@
*/ */
package com.basistech.df.cybertriage.autopsy.ctapi; package com.basistech.df.cybertriage.autopsy.ctapi;
import java.net.*; import java.net.*;
import java.util.*; import java.util.*;
import java.util.logging.Level; import java.util.logging.Level;

View File

@ -41,6 +41,7 @@ public class DecryptedLicenseResponse {
private final String limitType; private final String limitType;
private final String timezone; private final String timezone;
private final String customerEmail; private final String customerEmail;
private final String customerName;
@JsonCreator @JsonCreator
public DecryptedLicenseResponse( public DecryptedLicenseResponse(
@ -55,7 +56,8 @@ public class DecryptedLicenseResponse {
@JsonProperty("product") String product, @JsonProperty("product") String product,
@JsonProperty("limitType") String limitType, @JsonProperty("limitType") String limitType,
@JsonProperty("timezone") String timezone, @JsonProperty("timezone") String timezone,
@JsonProperty("customerEmail") String customerEmail @JsonProperty("customerEmail") String customerEmail,
@JsonProperty("customerName") String customerName
) { ) {
this.boostLicenseId = boostLicenseId; this.boostLicenseId = boostLicenseId;
this.licenseHostId = licenseHostId; this.licenseHostId = licenseHostId;
@ -67,6 +69,7 @@ public class DecryptedLicenseResponse {
this.limitType = limitType; this.limitType = limitType;
this.timezone = timezone; this.timezone = timezone;
this.customerEmail = customerEmail; this.customerEmail = customerEmail;
this.customerName = customerName;
} }
public String getBoostLicenseId() { public String getBoostLicenseId() {
@ -108,4 +111,8 @@ public class DecryptedLicenseResponse {
public String getCustomerEmail() { public String getCustomerEmail() {
return customerEmail; return customerEmail;
} }
public String getCustomerName() {
return customerName;
}
} }

View File

@ -26,8 +26,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DateTimeException; import java.time.DateTimeException;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
@ -37,7 +35,6 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeFormatterBuilder;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.util.Date;
import java.util.Locale; import java.util.Locale;
import java.util.function.Function; import java.util.function.Function;
@ -58,7 +55,6 @@ public class ObjectMapperUtil {
public ObjectMapper getDefaultObjectMapper() { public ObjectMapper getDefaultObjectMapper() {
ObjectMapper defaultMapper = new ObjectMapper(); ObjectMapper defaultMapper = new ObjectMapper();
// defaultMapper.configure(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
defaultMapper.registerModule(new JavaTimeModule()); defaultMapper.registerModule(new JavaTimeModule());
return defaultMapper; return defaultMapper;
} }

View File

@ -35,7 +35,7 @@ import org.openide.util.Lookup;
import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel; import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel;
/** /**
* Options panel for CyberTriage. * Options panel for Cyber Triage.
*/ */
public class CTOptionsPanel extends IngestModuleGlobalSettingsPanel { public class CTOptionsPanel extends IngestModuleGlobalSettingsPanel {
@ -46,7 +46,8 @@ public class CTOptionsPanel extends IngestModuleGlobalSettingsPanel {
private final List<CTOptionsSubPanel> subPanels; private final List<CTOptionsSubPanel> subPanels;
/** /**
* Creates new form CTOptions * Creates new form CTOptions loading any CTOptionsSubPanel instances to be
* displayed.
*/ */
public CTOptionsPanel() { public CTOptionsPanel() {
initComponents(); initComponents();

View File

@ -48,7 +48,8 @@ import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.core.UserPreferences;
/** /**
* Options panel for CyberTriage options for importing a CyberTriage incident * Options panel to be displayed in the CTOptionsPanel for settings regarding
* Cyber Triage Malware Scanner settings and license setup.
*/ */
@ServiceProvider(service = CTOptionsSubPanel.class) @ServiceProvider(service = CTOptionsSubPanel.class)
public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel { public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
@ -75,7 +76,7 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
private volatile AuthTokenFetcher authTokenFetcher = null; private volatile AuthTokenFetcher authTokenFetcher = null;
/** /**
* Creates new form CTIncidentImportOptionsPanel * Main constructor.
*/ */
public CTMalwareScannerOptionsPanel() { public CTMalwareScannerOptionsPanel() {
initComponents(); initComponents();
@ -461,15 +462,15 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
} else { } else {
this.licenseInfoExpiresLabel.setVisible(true); this.licenseInfoExpiresLabel.setVisible(true);
this.licenseInfoExpiresLabel.setText(Bundle.CTMalwareScannerOptionsPanel_licenseInfo_expires( this.licenseInfoExpiresLabel.setText(Bundle.CTMalwareScannerOptionsPanel_licenseInfo_expires(
this.licenseInfo.getDecryptedLicense().getExpirationDate() == null this.licenseInfo.getDecryptedLicense().getExpirationDate() == null
? "" ? ""
: LICENSE_EXPIRES_FORMAT.format(this.licenseInfo.getDecryptedLicense().getExpirationDate()))); : LICENSE_EXPIRES_FORMAT.format(this.licenseInfo.getDecryptedLicense().getExpirationDate())));
this.licenseInfoIdLabel.setVisible(true); this.licenseInfoIdLabel.setVisible(true);
this.licenseInfoIdLabel.setText(Bundle.CTMalwareScannerOptionsPanel_licenseInfo_id(this.licenseInfo.getDecryptedLicense().getBoostLicenseId())); this.licenseInfoIdLabel.setText(Bundle.CTMalwareScannerOptionsPanel_licenseInfo_id(StringUtils.defaultString(this.licenseInfo.getDecryptedLicense().getBoostLicenseId())));
this.licenseInfoUserLabel.setVisible(true); this.licenseInfoUserLabel.setVisible(true);
this.licenseInfoUserLabel.setText(Bundle.CTMalwareScannerOptionsPanel_licenseInfo_userInfo( this.licenseInfoUserLabel.setText(Bundle.CTMalwareScannerOptionsPanel_licenseInfo_userInfo(
"TBD", StringUtils.defaultString(this.licenseInfo.getDecryptedLicense().getCustomerName()),
this.licenseInfo.getDecryptedLicense().getCustomerEmail())); StringUtils.defaultString(this.licenseInfo.getDecryptedLicense().getCustomerEmail())));
} }
this.malwareScansPanel.setVisible(StringUtils.isNotBlank(this.authTokenMessage) || authTokenResponse != null); this.malwareScansPanel.setVisible(StringUtils.isNotBlank(this.authTokenMessage) || authTokenResponse != null);

View File

@ -34,8 +34,7 @@ import org.apache.commons.io.IOUtils;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
/** /**
* * Dialog for displaying the Cyber Triage EULA before the license is saved.
* @author gregd
*/ */
public class EULADialog extends javax.swing.JDialog { public class EULADialog extends javax.swing.JDialog {