mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge https://github.com/sleuthkit/autopsy into Reporting
This commit is contained in:
commit
ce0e1af724
@ -332,7 +332,7 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.getDirFlag() == TSK_FS_NAME_FLAG_ENUM.UNALLOC) {
|
if (file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,71 +18,62 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.datamodel;
|
package org.sleuthkit.autopsy.datamodel;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import org.openide.nodes.Sheet;
|
import org.openide.nodes.Sheet;
|
||||||
import org.sleuthkit.datamodel.FsContent;
|
import org.sleuthkit.datamodel.FsContent;
|
||||||
|
import org.sleuthkit.datamodel.TskData.TSK_FS_META_FLAG_ENUM;
|
||||||
import org.sleuthkit.datamodel.TskData.TSK_FS_META_MODE_ENUM;
|
import org.sleuthkit.datamodel.TskData.TSK_FS_META_MODE_ENUM;
|
||||||
|
import org.sleuthkit.datamodel.TskData.TSK_FS_NAME_FLAG_ENUM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class that implements the commonality between File and Directory
|
* Abstract class that implements the commonality between File and Directory
|
||||||
* Nodes (same properties).
|
* Nodes (same properties).
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractFsContentNode<T extends FsContent> extends AbstractAbstractFileNode<T> {
|
public abstract class AbstractFsContentNode<T extends FsContent> extends AbstractAbstractFileNode<T> {
|
||||||
|
|
||||||
// Note: this order matters for the search result, changed it if the order of property headers on the "KeywordSearchNode"changed
|
|
||||||
|
|
||||||
|
// Note: this order matters for the search result, changed it if the order of property headers on the "KeywordSearchNode"changed
|
||||||
public static enum FsContentPropertyType {
|
public static enum FsContentPropertyType {
|
||||||
|
|
||||||
NAME {
|
NAME {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Name";
|
return "Name";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LOCATION {
|
LOCATION {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Location";
|
return "Location";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MOD_TIME {
|
MOD_TIME {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Mod. Time";
|
return "Mod. Time";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CHANGED_TIME {
|
CHANGED_TIME {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Change Time";
|
return "Change Time";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ACCESS_TIME {
|
ACCESS_TIME {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Access Time";
|
return "Access Time";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CREATED_TIME {
|
CREATED_TIME {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Created Time";
|
return "Created Time";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SIZE {
|
SIZE {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Size";
|
return "Size";
|
||||||
@ -95,80 +86,66 @@ public abstract class AbstractFsContentNode<T extends FsContent> extends Abstrac
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
FLAGS_META {
|
FLAGS_META {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Flags(Meta)";
|
return "Flags(Meta)";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MODE {
|
MODE {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Mode";
|
return "Mode";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
USER_ID {
|
USER_ID {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "UserID";
|
return "UserID";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GROUP_ID {
|
GROUP_ID {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "GroupID";
|
return "GroupID";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
META_ADDR {
|
META_ADDR {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Meta Addr.";
|
return "Meta Addr.";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ATTR_ADDR {
|
ATTR_ADDR {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Attr. Addr.";
|
return "Attr. Addr.";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TYPE_DIR {
|
TYPE_DIR {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Type(Dir)";
|
return "Type(Dir)";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TYPE_META {
|
TYPE_META {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Type(Meta)";
|
return "Type(Meta)";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
KNOWN {
|
KNOWN {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Known";
|
return "Known";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MD5HASH {
|
MD5HASH {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "MD5 Hash";
|
return "MD5 Hash";
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean directoryBrowseMode;
|
private boolean directoryBrowseMode;
|
||||||
public static final String HIDE_PARENT = "hide_parent";
|
public static final String HIDE_PARENT = "hide_parent";
|
||||||
@ -176,21 +153,21 @@ public abstract class AbstractFsContentNode<T extends FsContent> extends Abstrac
|
|||||||
AbstractFsContentNode(T fsContent) {
|
AbstractFsContentNode(T fsContent) {
|
||||||
this(fsContent, true);
|
this(fsContent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
*
|
||||||
* @param fsContent the fsContent
|
* @param fsContent the fsContent
|
||||||
* @param directoryBrowseMode how the user caused this node
|
* @param directoryBrowseMode how the user caused this node to be created:
|
||||||
* to be created: if by browsing the image contents, it is true. If by
|
* if by browsing the image contents, it is true. If by selecting a file
|
||||||
* selecting a file filter (e.g. 'type' or 'recent'), it is false
|
* filter (e.g. 'type' or 'recent'), it is false
|
||||||
*/
|
*/
|
||||||
AbstractFsContentNode(T fsContent, boolean directoryBrowseMode) {
|
AbstractFsContentNode(T fsContent, boolean directoryBrowseMode) {
|
||||||
super(fsContent);
|
super(fsContent);
|
||||||
this.setDisplayName(AbstractFsContentNode.getFsContentName(fsContent));
|
this.setDisplayName(AbstractFsContentNode.getFsContentName(fsContent));
|
||||||
this.directoryBrowseMode = directoryBrowseMode;
|
this.directoryBrowseMode = directoryBrowseMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDirectoryBrowseMode() {
|
public boolean getDirectoryBrowseMode() {
|
||||||
return directoryBrowseMode;
|
return directoryBrowseMode;
|
||||||
}
|
}
|
||||||
@ -215,7 +192,7 @@ public abstract class AbstractFsContentNode<T extends FsContent> extends Abstrac
|
|||||||
final String propString = propType.toString();
|
final String propString = propType.toString();
|
||||||
ss.put(new NodeProperty(propString, propString, NO_DESCR, map.get(propString)));
|
ss.put(new NodeProperty(propString, propString, NO_DESCR, map.get(propString)));
|
||||||
}
|
}
|
||||||
if(directoryBrowseMode) {
|
if (directoryBrowseMode) {
|
||||||
ss.put(new NodeProperty(HIDE_PARENT, HIDE_PARENT, HIDE_PARENT, HIDE_PARENT));
|
ss.put(new NodeProperty(HIDE_PARENT, HIDE_PARENT, HIDE_PARENT, HIDE_PARENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,21 +201,23 @@ public abstract class AbstractFsContentNode<T extends FsContent> extends Abstrac
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill map with FsContent properties
|
* Fill map with FsContent properties
|
||||||
*
|
*
|
||||||
* @param map map with preserved ordering, where property names/values are put
|
* @param map map with preserved ordering, where property names/values are
|
||||||
|
* put
|
||||||
* @param content to extract properties from
|
* @param content to extract properties from
|
||||||
*/
|
*/
|
||||||
public static void fillPropertyMap(Map<String, Object> map, FsContent content) {
|
public static void fillPropertyMap(Map<String, Object> map, FsContent content) {
|
||||||
|
|
||||||
map.put(FsContentPropertyType.NAME.toString(), getFsContentName(content));
|
map.put(FsContentPropertyType.NAME.toString(), getFsContentName(content));
|
||||||
map.put(FsContentPropertyType.LOCATION.toString(), DataConversion.getformattedPath(ContentUtils.getDisplayPath(content), 0, 1));
|
map.put(FsContentPropertyType.LOCATION.toString(), DataConversion.getformattedPath(ContentUtils.getDisplayPath(content), 0, 1));
|
||||||
map.put(FsContentPropertyType.MOD_TIME.toString(), ContentUtils.getStringTime(content.getMtime(), content));
|
map.put(FsContentPropertyType.MOD_TIME.toString(), ContentUtils.getStringTime(content.getMtime(), content));
|
||||||
map.put(FsContentPropertyType.CHANGED_TIME.toString(), ContentUtils.getStringTime(content.getCtime(), content));
|
map.put(FsContentPropertyType.CHANGED_TIME.toString(), ContentUtils.getStringTime(content.getCtime(), content));
|
||||||
map.put(FsContentPropertyType.ACCESS_TIME.toString(), ContentUtils.getStringTime(content.getAtime(), content));
|
map.put(FsContentPropertyType.ACCESS_TIME.toString(), ContentUtils.getStringTime(content.getAtime(), content));
|
||||||
map.put(FsContentPropertyType.CREATED_TIME.toString(), ContentUtils.getStringTime(content.getCrtime(), content));
|
map.put(FsContentPropertyType.CREATED_TIME.toString(), ContentUtils.getStringTime(content.getCrtime(), content));
|
||||||
map.put(FsContentPropertyType.SIZE.toString(), content.getSize());
|
map.put(FsContentPropertyType.SIZE.toString(), content.getSize());
|
||||||
map.put(FsContentPropertyType.FLAGS_DIR.toString(), content.getDirFlag().toString());
|
map.put(FsContentPropertyType.FLAGS_DIR.toString(), content.getDirFlagAsString());
|
||||||
map.put(FsContentPropertyType.FLAGS_META.toString(), Integer.toString(content.getMetaFlagsInt()));
|
map.put(FsContentPropertyType.FLAGS_META.toString(), content.getMetaFlagsAsString());
|
||||||
map.put(FsContentPropertyType.MODE.toString(), TSK_FS_META_MODE_ENUM.toString(content.getModes(), content.getMetaType()));
|
map.put(FsContentPropertyType.MODE.toString(), content.getModesAsString());
|
||||||
map.put(FsContentPropertyType.USER_ID.toString(), content.getUid());
|
map.put(FsContentPropertyType.USER_ID.toString(), content.getUid());
|
||||||
map.put(FsContentPropertyType.GROUP_ID.toString(), content.getGid());
|
map.put(FsContentPropertyType.GROUP_ID.toString(), content.getGid());
|
||||||
map.put(FsContentPropertyType.META_ADDR.toString(), content.getMetaAddr());
|
map.put(FsContentPropertyType.META_ADDR.toString(), content.getMetaAddr());
|
||||||
@ -248,12 +227,12 @@ public abstract class AbstractFsContentNode<T extends FsContent> extends Abstrac
|
|||||||
map.put(FsContentPropertyType.KNOWN.toString(), content.getKnown().getName());
|
map.put(FsContentPropertyType.KNOWN.toString(), content.getKnown().getName());
|
||||||
map.put(FsContentPropertyType.MD5HASH.toString(), content.getMd5Hash() == null ? "" : content.getMd5Hash());
|
map.put(FsContentPropertyType.MD5HASH.toString(), content.getMd5Hash() == null ? "" : content.getMd5Hash());
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getFsContentName(FsContent fsContent) {
|
static String getFsContentName(FsContent fsContent) {
|
||||||
String name = fsContent.getName();
|
String name = fsContent.getName();
|
||||||
if(name.equals("..")) {
|
if (name.equals("..")) {
|
||||||
name = DirectoryNode.DOTDOTDIR;
|
name = DirectoryNode.DOTDOTDIR;
|
||||||
} else if(name.equals(".")) {
|
} else if (name.equals(".")) {
|
||||||
name = DirectoryNode.DOTDIR;
|
name = DirectoryNode.DOTDIR;
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
@ -39,7 +39,7 @@ public class DirectoryNode extends AbstractFsContentNode<Directory> {
|
|||||||
super(dir, directoryBrowseMode);
|
super(dir, directoryBrowseMode);
|
||||||
|
|
||||||
// set name, display name, and icon
|
// set name, display name, and icon
|
||||||
if (dir.getDirFlag() == TSK_FS_NAME_FLAG_ENUM.UNALLOC) {
|
if (dir.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC)) {
|
||||||
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-deleted.png");
|
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-deleted.png");
|
||||||
} else {
|
} else {
|
||||||
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png");
|
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png");
|
||||||
|
@ -39,7 +39,7 @@ public class FileNode extends AbstractFsContentNode<File> {
|
|||||||
super(file, directoryBrowseMode);
|
super(file, directoryBrowseMode);
|
||||||
|
|
||||||
// set name, display name, and icon
|
// set name, display name, and icon
|
||||||
if (file.getDirFlag() == TSK_FS_NAME_FLAG_ENUM.UNALLOC) {
|
if (file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC)) {
|
||||||
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-icon-deleted.png");
|
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-icon-deleted.png");
|
||||||
} else {
|
} else {
|
||||||
this.setIconBaseWithExtension(getIconForFileType(file));
|
this.setIconBaseWithExtension(getIconForFileType(file));
|
||||||
|
@ -24,6 +24,7 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -44,9 +45,9 @@ import org.sleuthkit.datamodel.ContentVisitor;
|
|||||||
import org.sleuthkit.datamodel.Directory;
|
import org.sleuthkit.datamodel.Directory;
|
||||||
import org.sleuthkit.datamodel.FileSystem;
|
import org.sleuthkit.datamodel.FileSystem;
|
||||||
import org.sleuthkit.datamodel.Image;
|
import org.sleuthkit.datamodel.Image;
|
||||||
import org.sleuthkit.datamodel.VirtualDirectory;
|
|
||||||
import org.sleuthkit.datamodel.LayoutFile;
|
import org.sleuthkit.datamodel.LayoutFile;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
import org.sleuthkit.datamodel.VirtualDirectory;
|
||||||
import org.sleuthkit.datamodel.Volume;
|
import org.sleuthkit.datamodel.Volume;
|
||||||
import org.sleuthkit.datamodel.VolumeSystem;
|
import org.sleuthkit.datamodel.VolumeSystem;
|
||||||
|
|
||||||
@ -168,22 +169,23 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
private List<UnallocStruct> lus = new ArrayList<UnallocStruct>();
|
private List<UnallocStruct> lus = new ArrayList<UnallocStruct>();
|
||||||
private File currentlyProcessing;
|
private File currentlyProcessing;
|
||||||
private int totalSizeinMegs;
|
private int totalSizeinMegs;
|
||||||
|
long totalBytes = 0;
|
||||||
|
|
||||||
ExtractUnallocWorker(UnallocStruct us) {
|
ExtractUnallocWorker(UnallocStruct us) {
|
||||||
this.lus.add(us);
|
|
||||||
//Getting the total megs this worker is going to be doing
|
//Getting the total megs this worker is going to be doing
|
||||||
if (!lockedVols.contains(us.getFileName())) {
|
if (!lockedVols.contains(us.getFileName())) {
|
||||||
totalSizeinMegs = toMb(us.sizeInBytes());
|
this.lus.add(us);
|
||||||
|
totalBytes = us.getSizeInBytes();
|
||||||
|
totalSizeinMegs = toMb(totalBytes);
|
||||||
lockedVols.add(us.getFileName());
|
lockedVols.add(us.getFileName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtractUnallocWorker(List<UnallocStruct> lst) {
|
ExtractUnallocWorker(List<UnallocStruct> lst) {
|
||||||
//Getting the total megs this worker is going to be doing
|
//Getting the total megs this worker is going to be doing
|
||||||
long totalBytes = 0;
|
|
||||||
for (UnallocStruct lu : lst) {
|
for (UnallocStruct lu : lst) {
|
||||||
if (!lockedVols.contains(lu.getFileName())) {
|
if (!lockedVols.contains(lu.getFileName())) {
|
||||||
totalBytes += lu.sizeInBytes();
|
totalBytes += lu.getSizeInBytes();
|
||||||
lockedVols.add(lu.getFileName());
|
lockedVols.add(lu.getFileName());
|
||||||
this.lus.add(lu);
|
this.lus.add(lu);
|
||||||
}
|
}
|
||||||
@ -196,7 +198,7 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
if (bytes > 1024 && (bytes / 1024.0) <= Double.MAX_VALUE) {
|
if (bytes > 1024 && (bytes / 1024.0) <= Double.MAX_VALUE) {
|
||||||
double Mb = ((bytes / 1024.0) / 1024.0);//Bytes -> Megabytes
|
double Mb = ((bytes / 1024.0) / 1024.0);//Bytes -> Megabytes
|
||||||
if (Mb <= Integer.MAX_VALUE) {
|
if (Mb <= Integer.MAX_VALUE) {
|
||||||
return (int) Math.floor(Mb);
|
return (int) Math.ceil(Mb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -222,27 +224,32 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
|
|
||||||
//Begin the actual File IO
|
//Begin the actual File IO
|
||||||
progress.start(totalSizeinMegs);
|
progress.start(totalSizeinMegs);
|
||||||
int kbs = 0; //Each completion of the while loop adds one to kbs. 8kb * 128 = 1mb.
|
int kbs = 0; //Each completion of the while loop adds one to kbs. 16kb * 64 = 1mb.
|
||||||
int mbs = 0; //Increments every 128th tick of kbs
|
int mbs = 0; //Increments every 128th tick of kbs
|
||||||
for (UnallocStruct u : this.lus) {
|
for (UnallocStruct u : this.lus) {
|
||||||
currentlyProcessing = u.getFile();
|
currentlyProcessing = u.getFile();
|
||||||
logger.log(Level.INFO, "Writing Unalloc file to " + currentlyProcessing.getPath());
|
logger.log(Level.INFO, "Writing Unalloc file to " + currentlyProcessing.getPath());
|
||||||
FileOutputStream fos = new FileOutputStream(currentlyProcessing);
|
OutputStream dos = new FileOutputStream(currentlyProcessing);
|
||||||
int count = 1;
|
long bytes = 0;
|
||||||
for (LayoutFile f : u.getLayouts()) {
|
int i = 0;
|
||||||
long offset = 0L;
|
while(i < u.getLayouts().size() && bytes != u.getSizeInBytes()){
|
||||||
while (offset != f.getSize() && !canceled) {
|
LayoutFile f = u.getLayouts().get(i);
|
||||||
offset += f.read(buf, offset, MAX_BYTES); //Offset + Bytes read
|
long offsetPerFile = 0L;
|
||||||
fos.write(buf);
|
int bytesRead;
|
||||||
|
while(offsetPerFile != f.getSize() && !canceled){
|
||||||
if (++kbs % 128 == 0) {
|
if (++kbs % 128 == 0) {
|
||||||
mbs++;
|
mbs++;
|
||||||
progress.progress("processing " + mbs + " of " + totalSizeinMegs + " MBs", mbs);
|
progress.progress("processing " + mbs + " of " + totalSizeinMegs + " MBs", mbs-1);
|
||||||
}
|
}
|
||||||
|
bytesRead = f.read(buf, offsetPerFile, MAX_BYTES);
|
||||||
|
offsetPerFile+= bytesRead;
|
||||||
|
dos.write(buf, 0, bytesRead);
|
||||||
}
|
}
|
||||||
count++;
|
bytes+=f.getSize();
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
fos.flush();
|
dos.flush();
|
||||||
fos.close();
|
dos.close();
|
||||||
|
|
||||||
if (canceled) {
|
if (canceled) {
|
||||||
u.getFile().delete();
|
u.getFile().delete();
|
||||||
@ -420,9 +427,9 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (o1.getId() > o2.getId()) {
|
if (o1.getId() > o2.getId()) {
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return 1;
|
return 1;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,6 +441,7 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
private class UnallocStruct {
|
private class UnallocStruct {
|
||||||
|
|
||||||
private List<LayoutFile> llf;
|
private List<LayoutFile> llf;
|
||||||
|
private long SizeInBytes;
|
||||||
private long VolumeId;
|
private long VolumeId;
|
||||||
private long ImageId;
|
private long ImageId;
|
||||||
private String ImageName;
|
private String ImageName;
|
||||||
@ -453,6 +461,7 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
this.ImageName = img.getName();
|
this.ImageName = img.getName();
|
||||||
this.FileName = this.ImageName + "-Unalloc-" + this.ImageId + "-" + 0 + ".dat";
|
this.FileName = this.ImageName + "-Unalloc-" + this.ImageId + "-" + 0 + ".dat";
|
||||||
this.FileInstance = new File(Case.getCurrentCase().getCaseDirectory() + File.separator + "Export" + File.separator + this.FileName);
|
this.FileInstance = new File(Case.getCurrentCase().getCaseDirectory() + File.separator + "Export" + File.separator + this.FileName);
|
||||||
|
this.SizeInBytes = calcSizeInBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -474,6 +483,7 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
this.FileInstance = new File(Case.getCurrentCase().getCaseDirectory() + File.separator + "Export" + File.separator + this.FileName);
|
this.FileInstance = new File(Case.getCurrentCase().getCaseDirectory() + File.separator + "Export" + File.separator + this.FileName);
|
||||||
this.llf = getUnallocFiles(volu);
|
this.llf = getUnallocFiles(volu);
|
||||||
Collections.sort(llf, new SortObjId());
|
Collections.sort(llf, new SortObjId());
|
||||||
|
this.SizeInBytes = calcSizeInBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Getters
|
//Getters
|
||||||
@ -481,13 +491,17 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
return llf.size();
|
return llf.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
long sizeInBytes() {
|
private long calcSizeInBytes() {
|
||||||
long size = 0L;
|
long size = 0L;
|
||||||
for (LayoutFile f : llf) {
|
for (LayoutFile f : llf) {
|
||||||
size += f.getSize();
|
size += f.getSize();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long getSizeInBytes(){
|
||||||
|
return this.SizeInBytes;
|
||||||
|
}
|
||||||
|
|
||||||
long getVolumeId() {
|
long getVolumeId() {
|
||||||
return this.VolumeId;
|
return this.VolumeId;
|
||||||
|
@ -123,7 +123,7 @@ public class ReportBodyFile implements ReportModule {
|
|||||||
out.write("|");
|
out.write("|");
|
||||||
out.write(Long.toString(file.getMetaAddr()));
|
out.write(Long.toString(file.getMetaAddr()));
|
||||||
out.write("|");
|
out.write("|");
|
||||||
String modeString = TSK_FS_META_MODE_ENUM.toString(file.getModes(), file.getMetaType());
|
String modeString = file.getModesAsString();
|
||||||
if(modeString != null) {
|
if(modeString != null) {
|
||||||
out.write(modeString);
|
out.write(modeString);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,6 @@ build.xml.script.CRC32=87b97b04
|
|||||||
build.xml.stylesheet.CRC32=a56c6a5b@1.46.2
|
build.xml.stylesheet.CRC32=a56c6a5b@1.46.2
|
||||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
nbproject/build-impl.xml.data.CRC32=8f39548f
|
nbproject/build-impl.xml.data.CRC32=8af8eb1a
|
||||||
nbproject/build-impl.xml.script.CRC32=fe1f48d2
|
nbproject/build-impl.xml.script.CRC32=fe1f48d2
|
||||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.50.1
|
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.50.1
|
||||||
|
@ -25,17 +25,15 @@ import java.awt.event.ItemEvent;
|
|||||||
import java.awt.event.ItemListener;
|
import java.awt.event.ItemListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
|
import javax.swing.SizeRequirements;
|
||||||
import javax.swing.SwingWorker;
|
import javax.swing.SwingWorker;
|
||||||
import javax.swing.text.AbstractDocument;
|
|
||||||
import javax.swing.text.AttributeSet;
|
|
||||||
import javax.swing.text.Element;
|
import javax.swing.text.Element;
|
||||||
import javax.swing.text.StyleConstants;
|
|
||||||
import javax.swing.text.View;
|
import javax.swing.text.View;
|
||||||
import javax.swing.text.ViewFactory;
|
import javax.swing.text.ViewFactory;
|
||||||
import javax.swing.text.html.HTML;
|
import javax.swing.text.html.InlineView;
|
||||||
|
import javax.swing.text.html.ParagraphView;
|
||||||
import javax.swing.text.html.HTMLEditorKit;
|
import javax.swing.text.html.HTMLEditorKit;
|
||||||
import javax.swing.text.html.HTMLEditorKit.HTMLFactory;
|
import javax.swing.text.html.HTMLEditorKit.HTMLFactory;
|
||||||
import org.netbeans.api.progress.ProgressHandle;
|
import org.netbeans.api.progress.ProgressHandle;
|
||||||
@ -62,25 +60,50 @@ class ExtractedContentPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
private void customizeComponents() {
|
private void customizeComponents() {
|
||||||
extractedTextPane.setEditorKit(new HTMLEditorKit() {
|
extractedTextPane.setEditorKit(new HTMLEditorKit() {
|
||||||
ViewFactory viewFactory = new HTMLFactory() {
|
|
||||||
@Override
|
|
||||||
public View create(Element elem) {
|
|
||||||
AttributeSet attrs = elem.getAttributes();
|
|
||||||
Object elementName = attrs.getAttribute(AbstractDocument.ElementNameAttribute);
|
|
||||||
Object o = (elementName != null) ? null : attrs.getAttribute(StyleConstants.NameAttribute);
|
|
||||||
if (o instanceof HTML.Tag) {
|
|
||||||
HTML.Tag kind = (HTML.Tag) o;
|
|
||||||
if (kind == HTML.Tag.IMPLIED) {
|
|
||||||
return new javax.swing.text.html.ParagraphView(elem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.create(elem);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ViewFactory getViewFactory() {
|
public ViewFactory getViewFactory() {
|
||||||
return this.viewFactory;
|
|
||||||
|
return new HTMLFactory() {
|
||||||
|
public View create(Element e) {
|
||||||
|
View v = super.create(e);
|
||||||
|
if (v instanceof InlineView) {
|
||||||
|
return new InlineView(e) {
|
||||||
|
public int getBreakWeight(int axis, float pos, float len) {
|
||||||
|
return GoodBreakWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public View breakView(int axis, int p0, float pos, float len) {
|
||||||
|
if (axis == View.X_AXIS) {
|
||||||
|
checkPainter();
|
||||||
|
int p1 = getGlyphPainter().getBoundedPosition(this, p0, pos, len);
|
||||||
|
if (p0 == getStartOffset() && p1 == getEndOffset()) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return createFragment(p0, p1);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else if (v instanceof ParagraphView) {
|
||||||
|
return new ParagraphView(e) {
|
||||||
|
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) {
|
||||||
|
if (r == null) {
|
||||||
|
r = new SizeRequirements();
|
||||||
|
}
|
||||||
|
float pref = layoutPool.getPreferredSpan(axis);
|
||||||
|
float min = layoutPool.getMinimumSpan(axis);
|
||||||
|
// Don't include insets, Box.getXXXSpan will include them.
|
||||||
|
r.minimum = (int) min;
|
||||||
|
r.preferred = Math.max(r.minimum, (int) pref);
|
||||||
|
r.maximum = Integer.MAX_VALUE;
|
||||||
|
r.alignment = 0.5f;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
build.xml.data.CRC32=bcfe7e87
|
build.xml.data.CRC32=11199bf7
|
||||||
build.xml.script.CRC32=d323407a
|
build.xml.script.CRC32=d323407a
|
||||||
build.xml.stylesheet.CRC32=a56c6a5b@2.50.1
|
build.xml.stylesheet.CRC32=a56c6a5b@2.50.1
|
||||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
nbproject/build-impl.xml.data.CRC32=bcfe7e87
|
nbproject/build-impl.xml.data.CRC32=11199bf7
|
||||||
nbproject/build-impl.xml.script.CRC32=aef16a21
|
nbproject/build-impl.xml.script.CRC32=aef16a21
|
||||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.50.1
|
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.50.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user