This commit is contained in:
Ann Priestman 2016-08-03 07:48:54 -04:00
parent c2005d2e61
commit 8ab3245188
3 changed files with 4 additions and 61 deletions

View File

@ -46,6 +46,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
import org.sleuthkit.autopsy.ingest.ModuleContentEvent; import org.sleuthkit.autopsy.ingest.ModuleContentEvent;
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.EncodedFileStream;
import org.sleuthkit.datamodel.ReadContentInputStream; import org.sleuthkit.datamodel.ReadContentInputStream;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
@ -591,8 +592,7 @@ class ImageExtractor {
* specified location. * specified location.
*/ */
private void writeExtractedImage(String outputPath, byte[] data) { private void writeExtractedImage(String outputPath, byte[] data) {
//try (FileOutputStream fos = new FileOutputStream(outputPath)) { try (EncodedFileStream fos = new EncodedFileStream(new FileOutputStream(outputPath))) {
try (xorTest fos = new xorTest(new FileOutputStream(outputPath))) {
fos.write(data); fos.write(data);
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Could not write to the provided location: " + outputPath, ex); //NON-NLS logger.log(Level.WARNING, "Could not write to the provided location: " + outputPath, ex); //NON-NLS

View File

@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.modules.embeddedfileextractor;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
@ -29,7 +28,6 @@ import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.Base64;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import net.sf.sevenzipjbinding.ArchiveFormat; import net.sf.sevenzipjbinding.ArchiveFormat;
@ -61,6 +59,7 @@ import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.DerivedFile; import org.sleuthkit.datamodel.DerivedFile;
import org.sleuthkit.datamodel.EncodedFileStream;
import org.sleuthkit.datamodel.ReadContentInputStream; import org.sleuthkit.datamodel.ReadContentInputStream;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData; import org.sleuthkit.datamodel.TskData;
@ -625,10 +624,7 @@ class SevenZipExtractor {
UnpackStream(String localAbsPath) { UnpackStream(String localAbsPath) {
this.localAbsPath = localAbsPath; this.localAbsPath = localAbsPath;
try { try {
//output = Base64.getEncoder().wrap( output = new EncodedFileStream(new FileOutputStream(localAbsPath));
// new BufferedOutputStream(new FileOutputStream(localAbsPath)));
output = new xorTest(new BufferedOutputStream(new FileOutputStream(localAbsPath)));
//output = new BufferedOutputStream(new FileOutputStream(localAbsPath));
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.SEVERE, "Error writing extracted file: " + localAbsPath, ex); //NON-NLS logger.log(Level.SEVERE, "Error writing extracted file: " + localAbsPath, ex); //NON-NLS
} }

View File

@ -1,53 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.sleuthkit.autopsy.modules.embeddedfileextractor;
import java.io.BufferedOutputStream;
import java.io.OutputStream;
import java.io.IOException;
/**
*
*/
public class xorTest extends BufferedOutputStream{
final private String HEADER = "XOR_AUTOPSY_HEADER_xxxxxxxxxxxxx";
final private int HEADER_LENGTH = HEADER.length();
public xorTest(OutputStream out) throws IOException{
super(out);
writeHeader();
}
public xorTest(OutputStream out, int size) throws IOException{
super(out, size);
writeHeader();
}
private void writeHeader() throws IOException{
write(HEADER.getBytes(), 0, HEADER_LENGTH);
}
private byte encode(byte b){
return ((byte)(b ^ 0xa5));
}
@Override
public void write(int b) throws IOException{
super.write((int)encode((byte)b));
}
@Override
public void write(byte[] b,
int off,
int len)
throws IOException{
byte[] encodedData = b.clone(); // Could be more efficient
for(int i = 0;i < b.length;i++){
encodedData[i] = encode(b[i]);
}
super.write(encodedData, off, len);
}
}