Reduced RecentActivity API via making veriables private and reducing scope of classes. Also removed dead enums

This commit is contained in:
Brian Carrier 2014-01-15 23:43:23 -05:00
parent 2fcce87869
commit 4692715fc2
12 changed files with 23 additions and 147 deletions

View File

@ -3,5 +3,3 @@ Changes to make to API when we are ready to make backward incompatible changes:
- HTMLReport has special API for more context on columns and special handling in REportGenerator. Change all reports to the new API. - HTMLReport has special API for more context on columns and special handling in REportGenerator. Change all reports to the new API.
- Content.getUniquePath() should not thrown TskException. We should deal with it in the method. - Content.getUniquePath() should not thrown TskException. We should deal with it in the method.
- Make the list of events that Case fires off to be part of an enum to group them together (like IngestManager does). - Make the list of events that Case fires off to be part of an enum to group them together (like IngestManager does).
- Sub-modules in RecentActivity have a bunch of public/protected variables that do not need to be. (i.e. ExtractRegistry.rrFullFound).
- Delete BrowserType enum and BrowserActivityType in RecentActivity.

View File

@ -1,61 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012 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 org.sleuthkit.autopsy.recentactivity;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
*
* No one seems to be using this
*/
@Deprecated
public enum BrowserActivityType {
Cookies(0),
Url(1),
Bookmarks(2);
private static final Map<Integer,BrowserActivityType> lookup
= new HashMap<Integer,BrowserActivityType>();
static {
for(BrowserActivityType bat : values())
lookup.put(bat.type, bat);
}
private int type;
private BrowserActivityType(int type)
{
this.type = type;
}
public int getType() { return type; }
public static BrowserActivityType get(int type) {
switch(type) {
case 0: return Cookies;
case 1: return Url;
case 2: return Bookmarks;
}
return null;
}
}

View File

@ -1,60 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012 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 org.sleuthkit.autopsy.recentactivity;
import java.util.HashMap;
import java.util.Map;
/**
*
* No one is using this. It should go away
*/
@Deprecated
public enum BrowserType {
IE(0), //Internet Explorer
FF(1), //Firefox
CH(2); //Chrome
private static final Map<Integer,BrowserType> lookup
= new HashMap<Integer,BrowserType>();
static {
for(BrowserType bt : values())
lookup.put(bt.type, bt);
}
private int type;
private BrowserType(int type)
{
this.type = type;
}
public int getType() { return type; }
public static BrowserType get(int type) {
switch(type) {
case 0: return IE;
case 1: return FF;
case 2: return CH;
}
return null;
}
}

View File

@ -55,7 +55,7 @@ import org.sleuthkit.datamodel.TskData;
/** /**
* Chrome recent activity extraction * Chrome recent activity extraction
*/ */
public class Chrome extends Extract { class Chrome extends Extract {
private static final String historyQuery = "SELECT urls.url, urls.title, urls.visit_count, urls.typed_count, " private static final String historyQuery = "SELECT urls.url, urls.title, urls.visit_count, urls.typed_count, "
+ "last_visit_time, urls.hidden, visits.visit_time, (SELECT urls.url FROM urls WHERE urls.id=visits.url) as from_visit, visits.transition FROM urls, visits WHERE urls.id = visits.url"; + "last_visit_time, urls.hidden, visits.visit_time, (SELECT urls.url FROM urls WHERE urls.id=visits.url) as from_visit, visits.transition FROM urls, visits WHERE urls.id = visits.url";
@ -65,8 +65,8 @@ public class Chrome extends Extract {
private static final String downloadQueryVersion30 = "SELECT current_path as full_path, url, start_time, received_bytes FROM downloads, downloads_url_chains WHERE downloads.id=downloads_url_chains.id"; private static final String downloadQueryVersion30 = "SELECT current_path as full_path, url, start_time, received_bytes FROM downloads, downloads_url_chains WHERE downloads.id=downloads_url_chains.id";
private static final String loginQuery = "select origin_url, username_value, signon_realm from logins"; private static final String loginQuery = "select origin_url, username_value, signon_realm from logins";
private final Logger logger = Logger.getLogger(this.getClass().getName()); private final Logger logger = Logger.getLogger(this.getClass().getName());
public int ChromeCount = 0; private int ChromeCount = 0;
final public static String MODULE_VERSION = "1.0"; final private static String MODULE_VERSION = "1.0";
private IngestServices services; private IngestServices services;
//hide public constructor to prevent from instantiation by ingest module loader //hide public constructor to prevent from instantiation by ingest module loader

View File

@ -33,14 +33,14 @@ import org.sleuthkit.autopsy.ingest.IngestModuleDataSource;
import org.sleuthkit.autopsy.report.SQLiteDBConnect; import org.sleuthkit.autopsy.report.SQLiteDBConnect;
import org.sleuthkit.datamodel.*; import org.sleuthkit.datamodel.*;
abstract public class Extract extends IngestModuleDataSource{ abstract class Extract extends IngestModuleDataSource{
protected Case currentCase = Case.getCurrentCase(); // get the most updated case protected Case currentCase = Case.getCurrentCase(); // get the most updated case
protected SleuthkitCase tskCase = currentCase.getSleuthkitCase(); protected SleuthkitCase tskCase = currentCase.getSleuthkitCase();
public final Logger logger = Logger.getLogger(this.getClass().getName()); public final Logger logger = Logger.getLogger(this.getClass().getName());
protected final ArrayList<String> errorMessages = new ArrayList<>(); private final ArrayList<String> errorMessages = new ArrayList<>();
protected String moduleName = ""; String moduleName = "";
protected boolean dataFound = false; boolean dataFound = false;
//hide public constructor to prevent from instantiation by ingest module loader //hide public constructor to prevent from instantiation by ingest module loader
Extract() { Extract() {

View File

@ -68,7 +68,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleDataSource;
import org.sleuthkit.autopsy.ingest.IngestModuleInit; import org.sleuthkit.autopsy.ingest.IngestModuleInit;
import org.sleuthkit.datamodel.*; import org.sleuthkit.datamodel.*;
public class ExtractIE extends Extract { class ExtractIE extends Extract {
private static final Logger logger = Logger.getLogger(ExtractIE.class.getName()); private static final Logger logger = Logger.getLogger(ExtractIE.class.getName());
private IngestServices services; private IngestServices services;
@ -77,7 +77,7 @@ public class ExtractIE extends Extract {
private String PASCO_LIB_PATH; private String PASCO_LIB_PATH;
private String JAVA_PATH; private String JAVA_PATH;
final public static String MODULE_VERSION = "1.0"; final private static String MODULE_VERSION = "1.0";
private static final SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); private static final SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
private ExecUtil execPasco; private ExecUtil execPasco;

View File

@ -57,14 +57,14 @@ import org.xml.sax.SAXException;
* and the second is a set that were customized for Autopsy to produce a more structured * and the second is a set that were customized for Autopsy to produce a more structured
* output of XML so that we can parse and turn into blackboard artifacts. * output of XML so that we can parse and turn into blackboard artifacts.
*/ */
public class ExtractRegistry extends Extract { class ExtractRegistry extends Extract {
public Logger logger = Logger.getLogger(this.getClass().getName()); private Logger logger = Logger.getLogger(this.getClass().getName());
private String RR_PATH; private String RR_PATH;
private String RR_FULL_PATH; private String RR_FULL_PATH;
boolean rrFound = false; // true if we found the Autopsy-specific version of regripper private boolean rrFound = false; // true if we found the Autopsy-specific version of regripper
boolean rrFullFound = false; // true if we found the full version of regripper private boolean rrFullFound = false; // true if we found the full version of regripper
final public static String MODULE_VERSION = "1.0"; final private static String MODULE_VERSION = "1.0";
private ExecUtil execRR; private ExecUtil execRR;
//hide public constructor to prevent from instantiation by ingest module loader //hide public constructor to prevent from instantiation by ingest module loader

View File

@ -40,7 +40,7 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil;
* Loads a file that maps USB IDs to names of makes and models. Uses Linux USB info. * Loads a file that maps USB IDs to names of makes and models. Uses Linux USB info.
* This should be renamed because it isn't extracting. It's just mapping IDs to names. * This should be renamed because it isn't extracting. It's just mapping IDs to names.
*/ */
public class ExtractUSB { class ExtractUSB {
private static final Logger logger = Logger.getLogger(ExtractUSB.class.getName()); private static final Logger logger = Logger.getLogger(ExtractUSB.class.getName());
private HashMap<String, USBInfo> devices; private HashMap<String, USBInfo> devices;
private static final String DataFile = "USB_DATA.txt"; private static final String DataFile = "USB_DATA.txt";

View File

@ -50,7 +50,7 @@ import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Firefox recent activity extraction * Firefox recent activity extraction
*/ */
public class Firefox extends Extract { class Firefox extends Extract {
private static final String historyQuery = "SELECT moz_historyvisits.id,url,title,visit_count,(visit_date/1000000) as visit_date,from_visit,(SELECT url FROM moz_places WHERE id=moz_historyvisits.from_visit) as ref FROM moz_places, moz_historyvisits WHERE moz_places.id = moz_historyvisits.place_id AND hidden = 0"; private static final String historyQuery = "SELECT moz_historyvisits.id,url,title,visit_count,(visit_date/1000000) as visit_date,from_visit,(SELECT url FROM moz_places WHERE id=moz_historyvisits.from_visit) as ref FROM moz_places, moz_historyvisits WHERE moz_places.id = moz_historyvisits.place_id AND hidden = 0";
private static final String cookieQuery = "SELECT name,value,host,expiry,(lastAccessed/1000000) as lastAccessed,(creationTime/1000000) as creationTime FROM moz_cookies"; private static final String cookieQuery = "SELECT name,value,host,expiry,(lastAccessed/1000000) as lastAccessed,(creationTime/1000000) as creationTime FROM moz_cookies";
@ -59,8 +59,7 @@ public class Firefox extends Extract {
private static final String downloadQuery = "SELECT target, source,(startTime/1000000) as startTime, maxBytes FROM moz_downloads"; private static final String downloadQuery = "SELECT target, source,(startTime/1000000) as startTime, maxBytes FROM moz_downloads";
private static final String downloadQueryVersion24 = "SELECT url, content as target, (lastModified/1000000) as lastModified FROM moz_places, moz_annos WHERE moz_places.id = moz_annos.place_id AND moz_annos.anno_attribute_id = 3"; private static final String downloadQueryVersion24 = "SELECT url, content as target, (lastModified/1000000) as lastModified FROM moz_places, moz_annos WHERE moz_places.id = moz_annos.place_id AND moz_annos.anno_attribute_id = 3";
public int FireFoxCount = 0; final private static String MODULE_VERSION = "1.0";
final public static String MODULE_VERSION = "1.0";
private IngestServices services; private IngestServices services;
//hide public constructor to prevent from instantiation by ingest module loader //hide public constructor to prevent from instantiation by ingest module loader

View File

@ -51,7 +51,7 @@ public final class RAImageIngestModule extends IngestModuleDataSource {
private StringBuilder subCompleted = new StringBuilder(); private StringBuilder subCompleted = new StringBuilder();
private ArrayList<Extract> modules; private ArrayList<Extract> modules;
private List<Extract> browserModules; private List<Extract> browserModules;
final public static String MODULE_VERSION = Version.getVersion(); final private static String MODULE_VERSION = Version.getVersion();
//public constructor is required //public constructor is required
//as multiple instances are created for processing multiple images simultenously //as multiple instances are created for processing multiple images simultenously

View File

@ -62,14 +62,14 @@ import org.xml.sax.SAXException;
* To add search engines, edit SearchEngines.xml under RecentActivity * To add search engines, edit SearchEngines.xml under RecentActivity
* *
*/ */
public class SearchEngineURLQueryAnalyzer extends Extract { class SearchEngineURLQueryAnalyzer extends Extract {
private IngestServices services; private IngestServices services;
public static final String MODULE_NAME = "Search Engine URL Query Analyzer"; private static final String MODULE_NAME = "Search Engine URL Query Analyzer";
public final static String MODULE_VERSION = "1.0"; private final static String MODULE_VERSION = "1.0";
public static final String XMLFILE = "SEUQAMappings.xml"; private static final String XMLFILE = "SEUQAMappings.xml";
private static final String XSDFILE = "SearchEngineSchema.xsd"; private static final String XSDFILE = "SearchEngineSchema.xsd";

View File

@ -50,7 +50,7 @@ import org.sleuthkit.datamodel.TskCoreException;
* *
* @author Alex * @author Alex
*/ */
public class Util { class Util {
private static Logger logger = Logger.getLogger(Util.class.getName()); private static Logger logger = Logger.getLogger(Util.class.getName());