mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
Merge branch 'develop' of https://github.com/sleuthkit/autopsy into vmdk
This commit is contained in:
@@ -355,11 +355,11 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
|
||||
return;
|
||||
}
|
||||
|
||||
if(currentRoot != null && !propertiesAcc.isEmpty()) {
|
||||
storeProperties(currentRoot);
|
||||
}
|
||||
storeState();
|
||||
|
||||
// set the new root as current
|
||||
currentRoot = root;
|
||||
List<Node.Property<?>> props = loadProperties(currentRoot);
|
||||
List<Node.Property<?>> props = loadState();
|
||||
|
||||
/*
|
||||
* OutlineView makes the first column be the result of
|
||||
@@ -432,23 +432,44 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
|
||||
}
|
||||
}
|
||||
|
||||
// Store the column arrangements of the given Node.
|
||||
private void storeProperties(Node root) {
|
||||
// Store the state of current root Node.
|
||||
private void storeState() {
|
||||
if(currentRoot == null || propertiesAcc.isEmpty())
|
||||
return;
|
||||
|
||||
TableFilterNode tfn;
|
||||
if(currentRoot instanceof TableFilterNode)
|
||||
tfn = (TableFilterNode) currentRoot;
|
||||
else
|
||||
return;
|
||||
|
||||
List<Node.Property<?>> props = new ArrayList<>(propertiesAcc);
|
||||
for (int i = 0; i < props.size(); i++) {
|
||||
Property<?> prop = props.get(i);
|
||||
NbPreferences.forModule(this.getClass()).put(getUniqueName(root, prop), String.valueOf(i));
|
||||
NbPreferences.forModule(this.getClass()).put(getUniqueColName(prop, tfn.getItemType()), String.valueOf(i));
|
||||
}
|
||||
}
|
||||
|
||||
// Load the column arrangement stored for the given node if exists.
|
||||
private List<Node.Property<?>> loadProperties(Node root) {
|
||||
// Load the state of current root Node if exists.
|
||||
private List<Node.Property<?>> loadState() {
|
||||
propertiesAcc.clear();
|
||||
this.getAllChildPropertyHeadersRec(root, 100);
|
||||
this.getAllChildPropertyHeadersRec(currentRoot, 100);
|
||||
List<Node.Property<?>> props = new ArrayList<>(propertiesAcc);
|
||||
|
||||
// If node is not table filter node, use default order for columns
|
||||
TableFilterNode tfn;
|
||||
if(currentRoot instanceof TableFilterNode) {
|
||||
tfn = (TableFilterNode) currentRoot;
|
||||
}
|
||||
else {
|
||||
Logger.getLogger(DataResultViewerTable.class.getName()).log(Level.INFO,
|
||||
"Node {0} is not TableFilterNode, columns are going to be in default order", currentRoot.getName());
|
||||
return props;
|
||||
}
|
||||
|
||||
List<Node.Property<?>> orderedProps = new ArrayList<>(propertiesAcc);
|
||||
for (Property<?> prop : props) {
|
||||
Integer value = Integer.valueOf(NbPreferences.forModule(this.getClass()).get(getUniqueName(root, prop), "-1"));
|
||||
Integer value = Integer.valueOf(NbPreferences.forModule(this.getClass()).get(getUniqueColName(prop, tfn.getItemType()), "-1"));
|
||||
if (value >= 0) {
|
||||
/**
|
||||
* The original contents of orderedProps do not matter when setting the new ordered values. The reason
|
||||
@@ -465,16 +486,7 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
|
||||
}
|
||||
|
||||
// Get unique name for node and it's property.
|
||||
private String getUniqueName(Node root, Property<?> prop) {
|
||||
String type = "Generic";
|
||||
if(root instanceof TableFilterNode) {
|
||||
TableFilterNode filterNode = (TableFilterNode) root;
|
||||
type = filterNode.getItemType();
|
||||
}
|
||||
else {
|
||||
Logger.getLogger(DataResultViewerTable.class.getName()).log(Level.SEVERE, "Node is not TableFilterNode");
|
||||
}
|
||||
|
||||
private String getUniqueColName(Property<?> prop, String type) {
|
||||
return Case.getCurrentCase().getName() + "." + type + "."
|
||||
+ prop.getName().replaceAll("[^a-zA-Z0-9_]", "") + ".columnOrder";
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TableFilterNode extends FilterNode {
|
||||
public TableFilterNode(Node arg, boolean crChild) {
|
||||
super(arg, TableFilterChildren.createInstance(arg, crChild));
|
||||
this.createChild = crChild;
|
||||
this.itemType = "Generic";
|
||||
this.itemType = "";
|
||||
}
|
||||
|
||||
public TableFilterNode(Node arg, boolean crChild, String itemType) {
|
||||
|
||||
@@ -9,8 +9,6 @@ indir: the path to input directory
|
||||
outdir: the path to output directory
|
||||
global_csv: path to global csv file
|
||||
golddir: the path to gold directory
|
||||
jenkins: can be set to True or False. If enabled, check for diffdir
|
||||
diffdir: (only if jenkins tag is true) the diff directory
|
||||
timing: can be set to True or False. If enabled, record the timing.
|
||||
|
||||
NOTE: Make sure to use windows style for paths!
|
||||
|
||||
@@ -415,8 +415,6 @@ class TestRunner(object):
|
||||
test_data.ant.append("-Dnsrl_path=" + test_config.nsrl_path)
|
||||
test_data.ant.append("-Dgold_path=" + test_config.gold)
|
||||
test_data.ant.append("-Dout_path=" + make_local_path(test_data.output_path))
|
||||
if test_config.jenkins:
|
||||
test_data.ant.append("-Ddiff_dir="+ test_config.diff_dir)
|
||||
test_data.ant.append("-Dignore_unalloc=" + "%s" % test_config.args.unallocated)
|
||||
test_data.ant.append("-Dtest.timeout=" + str(test_config.timeout))
|
||||
|
||||
@@ -728,12 +726,6 @@ class TestConfiguration(object):
|
||||
self.global_csv = make_local_path(self.global_csv)
|
||||
if parsed_config.getElementsByTagName("golddir"):
|
||||
self.gold = parsed_config.getElementsByTagName("golddir")[0].getAttribute("value").encode().decode("utf_8")
|
||||
if parsed_config.getElementsByTagName("jenkins"):
|
||||
self.jenkins = parsed_config.getElementsByTagName("jenkins")[0].getAttribute("value").encode().decode("utf_8")
|
||||
if self.jenkins and parsed_config.getElementsByTagName("diffdir"):
|
||||
self.diff_dir = parsed_config.getElementsByTagName("diffdir")[0].getAttribute("value").encode().decode("utf_8")
|
||||
else:
|
||||
self.jenkins = False
|
||||
if parsed_config.getElementsByTagName("timing"):
|
||||
self.timing = parsed_config.getElementsByTagName("timing")[0].getAttribute("value").encode().decode("utf_8")
|
||||
self._init_imgs(parsed_config)
|
||||
@@ -1297,7 +1289,7 @@ class Logs(object):
|
||||
log.close()
|
||||
common_log.write("\n")
|
||||
common_log.close()
|
||||
srtcmdlst = ["sort", "--ignore-case", test_data.common_log_path, "-o", test_data.common_log_path]
|
||||
srtcmdlst = ["sort", test_data.common_log_path, "-o", test_data.common_log_path]
|
||||
subprocess.call(srtcmdlst)
|
||||
except (OSError, IOError) as e:
|
||||
Errors.print_error("Error: Unable to generate the common log.")
|
||||
@@ -1974,31 +1966,6 @@ def find_file_in_dir(dir, name, ext):
|
||||
raise DirNotFoundException(dir)
|
||||
|
||||
|
||||
def copyErrorFiles(attachments, test_config):
|
||||
"""Move email attachments to the location specified in the config file.
|
||||
Used for Jenkins build.
|
||||
|
||||
Args:
|
||||
attachments: a listof_String, the files to be moved
|
||||
test_config: TestConfiguration, used to determine where to move the files to
|
||||
"""
|
||||
call = ['pwd']
|
||||
subprocess.call(call)
|
||||
|
||||
# remove old diff files
|
||||
filelist = [f for f in os.listdir(test_config.diff_dir) if (f.endswith(".txt") or f.endswith(".html"))]
|
||||
for f in filelist:
|
||||
if os.path.isfile(test_config.diff_dir + "/" + f):
|
||||
os.remove(test_config.diff_dir + "/" + f)
|
||||
|
||||
# move in the new diff files
|
||||
for file in attachments:
|
||||
filename = ntpath.basename(file)
|
||||
destination = os.path.join(test_config.diff_dir, filename)
|
||||
call = ['cp', file, destination]
|
||||
subprocess.call(call)
|
||||
|
||||
|
||||
class OS:
|
||||
LINUX, MAC, WIN, CYGWIN = range(4)
|
||||
|
||||
|
||||
@@ -87,9 +87,16 @@ class TskDbDiff(object):
|
||||
self._dump = os.path.join(self.output_dir, "DBDump.txt")
|
||||
self._dump_diff = os.path.join(self.output_dir, "DBDump-Diff.txt")
|
||||
|
||||
if self.gold_bb_dump is None:
|
||||
self.gold_bb_dump = TskDbDiff._get_tmp_file("GoldBlackboardDump", ".txt")
|
||||
self.gold_dump = TskDbDiff._get_tmp_file("GoldDBDump", ".txt")
|
||||
# Sorting gold before comparing (sort behaves differently in different environments)
|
||||
new_bb = TskDbDiff._get_tmp_file("GoldBlackboardDump", ".txt")
|
||||
new_db = TskDbDiff._get_tmp_file("GoldDBDump", ".txt")
|
||||
if self.gold_bb_dump is not None:
|
||||
srtcmdlst = ["sort", self.gold_bb_dump, "-o", new_bb]
|
||||
subprocess.call(srtcmdlst)
|
||||
srtcmdlst = ["sort", self.gold_dump, "-o", new_db]
|
||||
subprocess.call(srtcmdlst)
|
||||
self.gold_bb_dump = new_bb
|
||||
self.gold_dump = new_db
|
||||
|
||||
|
||||
def _cleanup_diff(self):
|
||||
@@ -251,7 +258,7 @@ class TskDbDiff(object):
|
||||
conn.close()
|
||||
|
||||
# Now sort the file
|
||||
srtcmdlst = ["sort", "--ignore-case", unsorted_dump, "-o", bb_dump_file]
|
||||
srtcmdlst = ["sort", unsorted_dump, "-o", bb_dump_file]
|
||||
subprocess.call(srtcmdlst)
|
||||
|
||||
|
||||
@@ -286,7 +293,7 @@ class TskDbDiff(object):
|
||||
db_log.write('%s\n' % line)
|
||||
# Now sort the file
|
||||
|
||||
srtcmdlst = ["sort", "--ignore-case", dump_file, "-o", dump_file]
|
||||
srtcmdlst = ["sort", dump_file, "-o", dump_file]
|
||||
subprocess.call(srtcmdlst)
|
||||
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user