mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-16 09:47:42 +00:00
ExtractUnalloc now properly prevents volumes from being extracted twice at the same time.
Other misc touchups.
This commit is contained in:
parent
8c2dcf8ea8
commit
f4bd168d17
@ -54,11 +54,11 @@ import org.sleuthkit.datamodel.VolumeSystem;
|
|||||||
public final class ExtractUnallocAction extends AbstractAction {
|
public final class ExtractUnallocAction extends AbstractAction {
|
||||||
|
|
||||||
private List<UnallocStruct> LstUnallocs = new ArrayList<UnallocStruct>();
|
private List<UnallocStruct> LstUnallocs = new ArrayList<UnallocStruct>();
|
||||||
|
private static volatile List<Long> lockedVols = new ArrayList<Long>();
|
||||||
private int numDone = 0;
|
private int numDone = 0;
|
||||||
private volatile static boolean runningOnImage = false;
|
private volatile static boolean runningOnImage = false;
|
||||||
private static final Logger logger = Logger.getLogger(ExtractUnallocAction.class.getName());
|
private static final Logger logger = Logger.getLogger(ExtractUnallocAction.class.getName());
|
||||||
private boolean isImage = false;
|
private boolean isImage = false;
|
||||||
enum EVENT {WORKER_FINISHED};
|
|
||||||
|
|
||||||
public ExtractUnallocAction(String title, Volume volu){
|
public ExtractUnallocAction(String title, Volume volu){
|
||||||
super(title);
|
super(title);
|
||||||
@ -92,7 +92,7 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (UnallocStruct u : LstUnallocs) {
|
for (UnallocStruct u : LstUnallocs) {
|
||||||
if (u.llf != null && u.llf.size() > 0 && !u.isLocked()) {
|
if (u.llf != null && u.llf.size() > 0 && !lockedVols.contains(u.VolumeId)) {
|
||||||
String UnallocName = u.ImageName + "-Unalloc-" + u.ImageId + "-" + u.VolumeId + ".dat";
|
String UnallocName = u.ImageName + "-Unalloc-" + u.ImageId + "-" + u.VolumeId + ".dat";
|
||||||
//Format for single Unalloc File is ImgName-Unalloc-ImgObjectID-VolumeID.dat
|
//Format for single Unalloc File is ImgName-Unalloc-ImgObjectID-VolumeID.dat
|
||||||
File unalloc = new File(Case.getCurrentCase().getCaseDirectory() + File.separator + "Export" + File.separator + UnallocName);
|
File unalloc = new File(Case.getCurrentCase().getCaseDirectory() + File.separator + "Export" + File.separator + UnallocName);
|
||||||
@ -146,11 +146,8 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
if(isImage){
|
if(isImage){
|
||||||
runningOnImage = true;
|
runningOnImage = true;
|
||||||
}
|
}
|
||||||
System.out.println("Default Us is locked? Should be false. Is: " + us.isLocked());
|
lockedVols.add(us.VolumeId);
|
||||||
us.setLocked(true);
|
|
||||||
System.out.println("Default Us is locked? Should be true. Is: " + us.isLocked());
|
|
||||||
this.us = us;
|
this.us = us;
|
||||||
System.out.println("This Us is locked? Should be true. Is: " + this.us.isLocked());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,12 +203,11 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void done(){
|
protected void done(){
|
||||||
System.out.println("numDone = " + numDone);
|
lockedVols.remove(us.VolumeId);
|
||||||
if(++numDone == LstUnallocs.size()){
|
if(++numDone == LstUnallocs.size()){
|
||||||
runningOnImage = false;
|
runningOnImage = false;
|
||||||
numDone = 0;
|
numDone = 0;
|
||||||
}
|
}
|
||||||
System.out.println("numDone after ++ = " + numDone);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,9 +218,6 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
*/
|
*/
|
||||||
private boolean hasVolumeSystem(Image img){
|
private boolean hasVolumeSystem(Image img){
|
||||||
try{
|
try{
|
||||||
for(Content c : img.getChildren()){
|
|
||||||
System.out.println(c.getClass());
|
|
||||||
}
|
|
||||||
return (img.getChildren().get(0) instanceof VolumeSystem);
|
return (img.getChildren().get(0) instanceof VolumeSystem);
|
||||||
} catch(TskCoreException tce){
|
} catch(TskCoreException tce){
|
||||||
logger.log(Level.WARNING, "Unable to determine if image has a volume system, extraction may be incomplete", tce);
|
logger.log(Level.WARNING, "Unable to determine if image has a volume system, extraction may be incomplete", tce);
|
||||||
@ -248,7 +241,6 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
} catch (TskCoreException tce) {
|
} catch (TskCoreException tce) {
|
||||||
logger.log(Level.WARNING, "Could not get volume information from image. Extraction may be incomplete", tce);
|
logger.log(Level.WARNING, "Could not get volume information from image. Extraction may be incomplete", tce);
|
||||||
}
|
}
|
||||||
System.out.println("lstVol size " + lstVol.size());
|
|
||||||
return lstVol;
|
return lstVol;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +359,6 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
private long VolumeId;
|
private long VolumeId;
|
||||||
private long ImageId;
|
private long ImageId;
|
||||||
private String ImageName;
|
private String ImageName;
|
||||||
private boolean locked = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contingency constructor in event no VolumeSystem exists on an Image.
|
* Contingency constructor in event no VolumeSystem exists on an Image.
|
||||||
@ -382,7 +373,6 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for extracting info from Volumes.
|
* Default constructor for extracting info from Volumes.
|
||||||
*
|
|
||||||
* @param volu Volume file to be analyzed
|
* @param volu Volume file to be analyzed
|
||||||
*/
|
*/
|
||||||
UnallocStruct(Volume volu) {
|
UnallocStruct(Volume volu) {
|
||||||
@ -409,9 +399,6 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
long getImageId(){
|
long getImageId(){
|
||||||
return this.ImageId;
|
return this.ImageId;
|
||||||
}
|
}
|
||||||
boolean isLocked(){
|
|
||||||
return this.locked;
|
|
||||||
}
|
|
||||||
String getImageName(){
|
String getImageName(){
|
||||||
return this.ImageName;
|
return this.ImageName;
|
||||||
}
|
}
|
||||||
@ -419,10 +406,6 @@ public final class ExtractUnallocAction extends AbstractAction {
|
|||||||
return this.llf;
|
return this.llf;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Setter
|
|
||||||
void setLocked(boolean lock){
|
|
||||||
this.locked = lock;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user