Merge branch 'develop' of github.com:sleuthkit/autopsy into develop

This commit is contained in:
Brian Carrier 2014-06-05 23:24:03 -04:00
commit 26e01a6cb0
15 changed files with 114 additions and 46 deletions

View File

@ -345,7 +345,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
} }
static Map<Long, String> getImagePaths(SleuthkitCase db) { //TODO: clean this up static Map<Long, String> getImagePaths(SleuthkitCase db) { //TODO: clean this up
Map<Long, String> imgPaths = new HashMap<Long, String>(); Map<Long, String> imgPaths = new HashMap<>();
try { try {
Map<Long, List<String>> imgPathsList = db.getImagePaths(); Map<Long, List<String>> imgPathsList = db.getImagePaths();
for (Map.Entry<Long, List<String>> entry : imgPathsList.entrySet()) { for (Map.Entry<Long, List<String>> entry : imgPathsList.entrySet()) {
@ -721,7 +721,20 @@ public class Case implements SleuthkitCase.ErrorObserver {
return xmlcm.getExportDir(); return xmlcm.getExportDir();
} }
} }
/**
* Gets the full path to the log directory for this case.
*
* @return The log directory path.
*/
public String getLogDirectoryPath() {
if (xmlcm == null) {
return "";
} else {
return xmlcm.getLogDir();
}
}
/** /**
* get the created date of this case * get the created date of this case
* *

View File

@ -66,7 +66,7 @@ public class CoreComponentControl {
// find the data content top component // find the data content top component
TopComponent contentWin = DataContentTopComponent.findInstance(); TopComponent contentWin = DataContentTopComponent.findInstance();
Mode m = WindowManager.getDefault().findMode("output"); Mode m = WindowManager.getDefault().findMode("output"); //NON-NLS
if (m != null) { if (m != null) {
m.dockInto(contentWin); // redock into the output mode m.dockInto(contentWin); // redock into the output mode
} else { } else {

View File

@ -18,8 +18,12 @@
*/ */
package org.sleuthkit.autopsy.coreutils; package org.sleuthkit.autopsy.coreutils;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.logging.*; import java.util.logging.*;
import org.sleuthkit.autopsy.casemodule.Case;
/** /**
* Autopsy specialization of the Java Logger class with custom file handlers. * Autopsy specialization of the Java Logger class with custom file handlers.
@ -27,18 +31,47 @@ import java.util.logging.*;
public final class Logger extends java.util.logging.Logger { public final class Logger extends java.util.logging.Logger {
private static final String LOG_ENCODING = PlatformUtil.getLogFileEncoding(); private static final String LOG_ENCODING = PlatformUtil.getLogFileEncoding();
private static final String LOG_DIR = PlatformUtil.getLogDirectory();
private static final int LOG_SIZE = 0; // In bytes, zero is unlimited private static final int LOG_SIZE = 0; // In bytes, zero is unlimited
private static final int LOG_FILE_COUNT = 10; private static final int LOG_FILE_COUNT = 10;
private static final String LOG_WITHOUT_STACK_TRACES = "autopsy.log"; //NON-NLS private static final String LOG_WITHOUT_STACK_TRACES = "autopsy.log"; //NON-NLS
private static final String LOG_WITH_STACK_TRACES = "autopsy_traces.log"; //NON-NLS private static final String LOG_WITH_STACK_TRACES = "autopsy_traces.log"; //NON-NLS
private static final FileHandler userFriendlyLogFile = createFileHandler(LOG_WITHOUT_STACK_TRACES); private static final CaseChangeListener caseChangeListener = new CaseChangeListener();
private static final FileHandler developersLogFile = createFileHandler(LOG_WITH_STACK_TRACES);
private static final Handler console = new java.util.logging.ConsoleHandler(); private static final Handler console = new java.util.logging.ConsoleHandler();
private static FileHandler userFriendlyLogFile = createFileHandler(PlatformUtil.getLogDirectory(), LOG_WITHOUT_STACK_TRACES);
private static FileHandler developersLogFile = createFileHandler(PlatformUtil.getLogDirectory(), LOG_WITH_STACK_TRACES);
private static FileHandler createFileHandler(String fileName) { static {
Case.addPropertyChangeListener(caseChangeListener);
}
private static class CaseChangeListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) {
// Write to logs in the Logs directory of the current case, or
// to logs in the user directory when there is no case.
if (event.getNewValue() != null) {
String logDirectoryPath = ((Case) event.getNewValue()).getLogDirectoryPath();
if (!logDirectoryPath.isEmpty()) {
userFriendlyLogFile.close();
userFriendlyLogFile = createFileHandler(logDirectoryPath, LOG_WITHOUT_STACK_TRACES);
developersLogFile.close();
developersLogFile = createFileHandler(logDirectoryPath, LOG_WITH_STACK_TRACES);
}
} else {
userFriendlyLogFile.close();
userFriendlyLogFile = createFileHandler(PlatformUtil.getLogDirectory(), LOG_WITHOUT_STACK_TRACES);
developersLogFile.close();
developersLogFile = createFileHandler(PlatformUtil.getLogDirectory(), LOG_WITH_STACK_TRACES);
}
}
}
}
private static FileHandler createFileHandler(String logDirectory, String fileName) {
try { try {
FileHandler f = new FileHandler(LOG_DIR + fileName, LOG_SIZE, LOG_FILE_COUNT); FileHandler f = new FileHandler(logDirectory + File.separator + fileName, LOG_SIZE, LOG_FILE_COUNT);
f.setEncoding(LOG_ENCODING); f.setEncoding(LOG_ENCODING);
f.setFormatter(new SimpleFormatter()); f.setFormatter(new SimpleFormatter());
return f; return f;
@ -113,9 +146,9 @@ public final class Logger extends java.util.logging.Logger {
private void logUserFriendlyOnly(Level level, String message, Throwable thrown) { private void logUserFriendlyOnly(Level level, String message, Throwable thrown) {
removeHandler(developersLogFile); removeHandler(developersLogFile);
super.log(level, "{0}\nException: {1}", new Object[]{message, thrown.toString()}); //NON-NLS super.log(level, "{0}\nException: {1}", new Object[]{message, thrown.toString()}); //NON-NLS
addHandler(developersLogFile); addHandler(developersLogFile);
} }
@Override @Override
public void throwing(String sourceClass, String sourceMethod, Throwable thrown) { public void throwing(String sourceClass, String sourceMethod, Throwable thrown) {
removeHandler(userFriendlyLogFile); removeHandler(userFriendlyLogFile);

View File

@ -27,7 +27,7 @@ final class FileExtMismatchDetectorModuleSettings implements IngestModuleIngestJ
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private boolean skipFilesWithNoExtension = true; private boolean skipFilesWithNoExtension = true;
private boolean skipFilesWithTextPlainMimeType = false; private boolean skipFilesWithTextPlainMimeType = true;
FileExtMismatchDetectorModuleSettings() { FileExtMismatchDetectorModuleSettings() {
} }

View File

@ -223,7 +223,9 @@
<ext>jpe</ext> <ext>jpe</ext>
<ext>jpeg</ext> <ext>jpeg</ext>
<ext>jpg</ext> <ext>jpg</ext>
<ext>jpg:ms-thumbnail</ext>
<ext>png</ext> <ext>png</ext>
<ext>tile</ext>
</signature> </signature>
<signature mimetype="image/png"> <signature mimetype="image/png">
<ext>gif</ext> <ext>gif</ext>
@ -264,6 +266,7 @@
<ext>adm</ext> <ext>adm</ext>
<ext>admx</ext> <ext>admx</ext>
<ext>aff</ext> <ext>aff</ext>
<ext>appcontent-ms</ext>
<ext>arff</ext> <ext>arff</ext>
<ext>ashx</ext> <ext>ashx</ext>
<ext>asp</ext> <ext>asp</ext>
@ -300,6 +303,7 @@
<ext>dun</ext> <ext>dun</ext>
<ext>ecf</ext> <ext>ecf</ext>
<ext>elm</ext> <ext>elm</ext>
<ext>eml</ext>
<ext>eng</ext> <ext>eng</ext>
<ext>ent</ext> <ext>ent</ext>
<ext>enu</ext> <ext>enu</ext>
@ -398,6 +402,7 @@
<ext>sql</ext> <ext>sql</ext>
<ext>std</ext> <ext>std</ext>
<ext>stp</ext> <ext>stp</ext>
<ext>strings</ext>
<ext>sve</ext> <ext>sve</ext>
<ext>sve</ext> <ext>sve</ext>
<ext>svg</ext> <ext>svg</ext>

View File

@ -70,7 +70,7 @@ public final class HashLookupModuleSettingsPanel extends IngestModuleIngestJobSe
customizeHashSetsTable(jScrollPane2, knownBadHashTable, knownBadHashSetsTableModel); customizeHashSetsTable(jScrollPane2, knownBadHashTable, knownBadHashSetsTableModel);
alwaysCalcHashesCheckbox.setSelected(settings.shouldCalculateHashes()); alwaysCalcHashesCheckbox.setSelected(settings.shouldCalculateHashes());
hashDbManager.addPropertyChangeListener(this); hashDbManager.addPropertyChangeListener(this);
alwaysCalcHashesCheckbox.setText("<html>" + org.openide.util.NbBundle.getMessage(HashLookupModuleSettingsPanel.class, "HashLookupModuleSettingsPanel.alwaysCalcHashesCheckbox.text") + "</html>"); // NOI18N alwaysCalcHashesCheckbox.setText("<html>" + org.openide.util.NbBundle.getMessage(HashLookupModuleSettingsPanel.class, "HashLookupModuleSettingsPanel.alwaysCalcHashesCheckbox.text") + "</html>"); // NOI18N NON-NLS
} }
private void customizeHashSetsTable(JScrollPane scrollPane, JTable table, HashSetsTableModel tableModel) { private void customizeHashSetsTable(JScrollPane scrollPane, JTable table, HashSetsTableModel tableModel) {

View File

@ -238,7 +238,7 @@ class DropdownListSearchPanel extends KeywordSearchPanel {
} }
}); });
ingestIndexLabel.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N ingestIndexLabel.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N NON-NLS
ingestIndexLabel.setText(org.openide.util.NbBundle.getMessage(DropdownListSearchPanel.class, "KeywordSearchListsViewerPanel.ingestIndexLabel.text")); // NOI18N ingestIndexLabel.setText(org.openide.util.NbBundle.getMessage(DropdownListSearchPanel.class, "KeywordSearchListsViewerPanel.ingestIndexLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);

View File

@ -143,13 +143,13 @@ class DropdownToolbar extends javax.swing.JPanel {
setOpaque(false); setOpaque(false);
listsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon.png"))); // NOI18N listsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon.png"))); // NOI18N NON-NLS
listsButton.setText(org.openide.util.NbBundle.getMessage(DropdownToolbar.class, "ListBundleName")); // NOI18N listsButton.setText(org.openide.util.NbBundle.getMessage(DropdownToolbar.class, "ListBundleName")); // NOI18N
listsButton.setBorderPainted(false); listsButton.setBorderPainted(false);
listsButton.setContentAreaFilled(false); listsButton.setContentAreaFilled(false);
listsButton.setEnabled(false); listsButton.setEnabled(false);
listsButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-rollover.png"))); // NOI18N listsButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-rollover.png"))); // NOI18N NON-NLS
listsButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-pressed.png"))); // NOI18N listsButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-pressed.png"))); // NOI18N NON-NLS
listsButton.addMouseListener(new java.awt.event.MouseAdapter() { listsButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) { public void mousePressed(java.awt.event.MouseEvent evt) {
listsButtonMousePressed(evt); listsButtonMousePressed(evt);
@ -161,7 +161,7 @@ class DropdownToolbar extends javax.swing.JPanel {
} }
}); });
searchDropButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon.png"))); // NOI18N searchDropButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon.png"))); // NOI18N NON-NLS
searchDropButton.setText(org.openide.util.NbBundle.getMessage(DropdownToolbar.class, "KeywordSearchPanel.searchDropButton.text")); // NOI18N searchDropButton.setText(org.openide.util.NbBundle.getMessage(DropdownToolbar.class, "KeywordSearchPanel.searchDropButton.text")); // NOI18N
searchDropButton.setBorderPainted(false); searchDropButton.setBorderPainted(false);
searchDropButton.setContentAreaFilled(false); searchDropButton.setContentAreaFilled(false);
@ -169,8 +169,8 @@ class DropdownToolbar extends javax.swing.JPanel {
searchDropButton.setMaximumSize(new java.awt.Dimension(146, 27)); searchDropButton.setMaximumSize(new java.awt.Dimension(146, 27));
searchDropButton.setMinimumSize(new java.awt.Dimension(146, 27)); searchDropButton.setMinimumSize(new java.awt.Dimension(146, 27));
searchDropButton.setPreferredSize(new java.awt.Dimension(146, 27)); searchDropButton.setPreferredSize(new java.awt.Dimension(146, 27));
searchDropButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-rollover.png"))); // NOI18N searchDropButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-rollover.png"))); // NOI18N NON-NLS
searchDropButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-pressed.png"))); // NOI18N searchDropButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/searchbutton-icon-pressed.png"))); // NOI18N NON-NLS
searchDropButton.addMouseListener(new java.awt.event.MouseAdapter() { searchDropButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) { public void mousePressed(java.awt.event.MouseEvent evt) {
searchDropButtonMousePressed(evt); searchDropButtonMousePressed(evt);

View File

@ -113,7 +113,7 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa
}); });
jScrollPane1.setViewportView(listsTable); jScrollPane1.setViewportView(listsTable);
newListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/new16.png"))); // NOI18N newListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/new16.png"))); // NOI18N NON-NLS
newListButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "KeywordSearchListsManagementPanel.newListButton.text")); // NOI18N newListButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "KeywordSearchListsManagementPanel.newListButton.text")); // NOI18N
newListButton.addActionListener(new java.awt.event.ActionListener() { newListButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -121,7 +121,7 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa
} }
}); });
importButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/import16.png"))); // NOI18N importButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/import16.png"))); // NOI18N NON-NLS
importButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "KeywordSearchListsManagementPanel.importButton.text")); // NOI18N importButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "KeywordSearchListsManagementPanel.importButton.text")); // NOI18N
importButton.addActionListener(new java.awt.event.ActionListener() { importButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {

View File

@ -64,7 +64,7 @@ public final class KeywordSearchJobSettingsPanel extends IngestModuleIngestJobSe
displayLanguages(); displayLanguages();
displayEncodings(); displayEncodings();
keywordListsManager.addPropertyChangeListener(this); keywordListsManager.addPropertyChangeListener(this);
languagesLabel.setText("<html>" + org.openide.util.NbBundle.getMessage(KeywordSearchJobSettingsPanel.class, "KeywordSearchJobSettingsPanel.languagesLabel.text") + "</html>"); // NOI18N languagesLabel.setText("<html>" + org.openide.util.NbBundle.getMessage(KeywordSearchJobSettingsPanel.class, "KeywordSearchJobSettingsPanel.languagesLabel.text") + "</html>"); // NOI18N NON-NLS
} }
private void customizeKeywordListsTable() { private void customizeKeywordListsTable() {

View File

@ -91,7 +91,7 @@ public class Server {
TEXT { TEXT {
@Override @Override
public String toString() { public String toString() {
return "text"; return "text"; //NON-NLS
} }
}, },
CONTENT_WS { CONTENT_WS {

View File

@ -447,12 +447,14 @@ class ExtractRegistry extends Extract {
String model = dev; String model = dev;
if (dev.toLowerCase().contains("vid")) { //NON-NLS if (dev.toLowerCase().contains("vid")) { //NON-NLS
USBInfo info = extrctr.parseAndLookup(dev); USBInfo info = extrctr.parseAndLookup(dev);
if(info.getVendor()!=null) if (info.getVendor() != null) {
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DEVICE_MAKE.getTypeID(), bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DEVICE_MAKE.getTypeID(),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"ExtractRegistry.parentModuleName.noSpace"), info.getVendor())); "ExtractRegistry.parentModuleName.noSpace"), info.getVendor()));
if(info.getProduct() != null) }
if (info.getProduct() != null) {
model = info.getProduct(); model = info.getProduct();
}
} }
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DEVICE_MODEL.getTypeID(), bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DEVICE_MODEL.getTypeID(),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),

View File

@ -63,20 +63,29 @@ class UsbDeviceIdMapper {
*/ */
public USBInfo parseAndLookup(String dev) { public USBInfo parseAndLookup(String dev) {
String[] dtokens = dev.split("[_&]"); String[] dtokens = dev.split("[_&]");
String vID = dtokens[1]; String vID = dtokens[1].toUpperCase();
String pID; String pID;
if (dtokens.length < 4 || dtokens[3].length() < 4) { if (dtokens.length < 4 || dtokens[3].length() < 4) {
pID = "0000"; pID = "0000";
} else { } else {
pID = dtokens[3]; pID = dtokens[3];
} }
pID = pID.toUpperCase();
// first try the full key
String key = vID + pID; String key = vID + pID;
key = key.toUpperCase(); if (devices.containsKey(key)) {
if (!devices.containsKey(key)) {
return new USBInfo(null, null);
} else {
return devices.get(key); return devices.get(key);
} }
// try just the vendor ID -> In case database doesn't know about this specific product
key = vID + "0000";
if (devices.containsKey(key)) {
USBInfo info = devices.get(key);
return new USBInfo(info.getVendor(), "Product: " + pID);
}
return new USBInfo(null, null);
} }
/** /**
@ -152,8 +161,8 @@ class UsbDeviceIdMapper {
* Stores the vendor information about a USB device * Stores the vendor information about a USB device
*/ */
public class USBInfo { public class USBInfo {
private String vendor; private final String vendor;
private String product; private final String product;
private USBInfo(String vend, String prod) { private USBInfo(String vend, String prod) {
vendor = vend; vendor = vend;

View File

@ -142,7 +142,7 @@ class TestRunner(object):
test_data.printerror = Errors.printerror test_data.printerror = Errors.printerror
# give solr process time to die. # give solr process time to die.
time.sleep(10) time.sleep(10)
print("Total ingest time was " + test_data.total_ingest_time)
Reports.write_html_foot(test_config.html_log) Reports.write_html_foot(test_config.html_log)
if test_config.jenkins: if test_config.jenkins:
@ -1226,7 +1226,6 @@ class Logs(object):
version_line = search_logs("INFO: Application name: Autopsy, version:", test_data)[0] version_line = search_logs("INFO: Application name: Autopsy, version:", test_data)[0]
test_data.autopsy_version = get_word_at(version_line, 5).rstrip(",") test_data.autopsy_version = get_word_at(version_line, 5).rstrip(",")
test_data.heap_space = search_logs("Heap memory usage:", test_data)[0].rstrip().split(": ")[1] test_data.heap_space = search_logs("Heap memory usage:", test_data)[0].rstrip().split(": ")[1]
ingest_line = search_logs("Ingest (including enqueue)", test_data)[0] ingest_line = search_logs("Ingest (including enqueue)", test_data)[0]
test_data.total_ingest_time = get_word_at(ingest_line, 6).rstrip() test_data.total_ingest_time = get_word_at(ingest_line, 6).rstrip()
@ -1361,11 +1360,22 @@ def copy_logs(test_data):
test_data: the TestData whose logs will be copied test_data: the TestData whose logs will be copied
""" """
try: try:
log_dir = os.path.join("..", "..", "Testing","build","test","qa-functional","work","userdir0","var","log") # copy logs from autopsy case's Log folder
log_dir = os.path.join(test_data.output_path, AUTOPSY_TEST_CASE, "Log")
shutil.copytree(log_dir, test_data.logs_dir) shutil.copytree(log_dir, test_data.logs_dir)
# copy logs from userdir0/var/log
log_dir = os.path.join("..", "..", "Testing","build","test","qa-functional","work","userdir0","var","log/")
for log in os.listdir(log_dir):
if log.find("log"):
new_name = log_dir + "userdir0." + log
log = log_dir + log
shutil.move(log, new_name)
shutil.copy(new_name, test_data.logs_dir)
shutil.move(new_name, log)
except OSError as e: except OSError as e:
printerror(test_data,"Error: Failed to copy the logs.") print_error(test_data,"Error: Failed to copy the logs.")
printerror(test_data,str(e) + "\n") print_error(test_data,str(e) + "\n")
logging.warning(traceback.format_exc()) logging.warning(traceback.format_exc())
def setDay(): def setDay():
@ -1556,15 +1566,11 @@ class Args(object):
arg = sys.argv.pop(0) arg = sys.argv.pop(0)
nxtproc.append(arg) nxtproc.append(arg)
if(arg == "-f"): if(arg == "-f"):
#try: @@@ Commented out until a more specific except statement is added
arg = sys.argv.pop(0) arg = sys.argv.pop(0)
print("Running on a single file:") print("Running on a single file:")
print(path_fix(arg) + "\n") print(path_fix(arg) + "\n")
self.single = True self.single = True
self.single_file = path_fix(arg) self.single_file = path_fix(arg)
#except:
# print("Error: No single file given.\n")
# return False
elif(arg == "-r" or arg == "--rebuild"): elif(arg == "-r" or arg == "--rebuild"):
print("Running in rebuild mode.\n") print("Running in rebuild mode.\n")
self.rebuild = True self.rebuild = True
@ -1757,8 +1763,8 @@ def clear_dir(dir):
os.makedirs(dir) os.makedirs(dir)
return True; return True;
except OSError as e: except OSError as e:
printerror(test_data,"Error: Cannot clear the given directory:") print_error(test_data,"Error: Cannot clear the given directory:")
printerror(test_data,dir + "\n") print_error(test_data,dir + "\n")
print(str(e)) print(str(e))
return False; return False;
@ -1773,8 +1779,8 @@ def del_dir(dir):
shutil.rmtree(dir) shutil.rmtree(dir)
return True; return True;
except: except:
printerror(test_data,"Error: Cannot delete the given directory:") print_error(test_data,"Error: Cannot delete the given directory:")
printerror(test_data,dir + "\n") print_error(test_data,dir + "\n")
return False; return False;
def get_file_in_dir(dir, ext): def get_file_in_dir(dir, ext):

View File

@ -289,7 +289,7 @@ def replace_id(line, table):
if (files_index != -1): if (files_index != -1):
obj_id = fields_list[0] obj_id = fields_list[0]
path = table[int(obj_id)] path = table[int(obj_id)]
newLine = ('INSERT INTO "tsk_files" VALUES(' + path + ', '.join(fields_list[1:]) + ');') newLine = ('INSERT INTO "tsk_files" VALUES(' + ', '.join(fields_list[1:]) + ');')
return newLine return newLine
elif (path_index != -1): elif (path_index != -1):