Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --continue, improve and rename persistentID #937

Merged
merged 30 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bbacbf9
#941: checking code to warn if id is used before possibly being restored
lfcnassif Jan 25, 2022
630146d
#941: do not use id in ExportFileTask, it could be reassigned
lfcnassif Jan 25, 2022
11a47b9
#792: add numCarved counter per parent and add carvedId to carved items
lfcnassif Jan 25, 2022
9abaeab
#784/#792 improve globalID formula, throw exception if something is bad
lfcnassif Jan 25, 2022
1c97a00
#784: always throw exception if parentGlobalID is not set in items:
lfcnassif Jan 25, 2022
daf13ab
#784: store parentGlobalID for all items produced by FolderTreeReader
lfcnassif Jan 25, 2022
53d443b
#784: store parentGlobalID for all items from SleuthkitReader and also:
lfcnassif Jan 25, 2022
093e630
#941: do not use id in UFDRReader before possibly updating its value
lfcnassif Jan 25, 2022
ee738c7
#941 use ID in ParsingTask after posible update, set meta removed before
lfcnassif Jan 25, 2022
d599e31
#784: remove parentIdInDataSource setters & getters, not needed anymore
lfcnassif Jan 25, 2022
0e9228b
simplify FolderTreeReader parent tracking
lfcnassif Jan 25, 2022
ce4d107
#179: fix a NPE and other exception: doc values aren't reusable anymore
lfcnassif Jan 25, 2022
6b352c9
#784: additional minor checking for null invalid item paths
lfcnassif Jan 25, 2022
b0eb4f3
#784: rename globalID (previous persistentID) to trackID
lfcnassif Jan 25, 2022
33584b0
#784: compute and store a real globalID unique across cases
lfcnassif Jan 25, 2022
aa5484b
#792: skip non last text frags when looking for parents with lost child
lfcnassif Jan 25, 2022
ba97468
#792: don't use ID_IN_SOURCE in trackID of carved/subitems:
lfcnassif Jan 25, 2022
7eee8e1
#784: fix processing of recursive disks after commit 53d443b
lfcnassif Jan 25, 2022
3a37b98
#792: skip seen containers enqueued twice (b98dc52 regression)
lfcnassif Jan 26, 2022
e3d1e4f
fix #942: fix ConcurrentModificationException iterating over a new array
lfcnassif Jan 26, 2022
3859c57
minor change to show just one ElasticSearch commit msg for all workers
lfcnassif Jan 26, 2022
e604805
#792: reset num carved/frags counters to avoid processing parents again,
lfcnassif Jan 27, 2022
d5f39ba
minor change to display commit messages in processing window
lfcnassif Jan 27, 2022
6949699
#792: fix 3a37b98: don't ignore parents being processed in later queues
lfcnassif Jan 27, 2022
379c10a
#784: fix trackID computation for file fragments
lfcnassif Jan 28, 2022
8323dda
Revert "#179: fix a NPE and other exception: doc values aren't reusab…
lfcnassif Jan 28, 2022
1657d33
Merge branch 'master' into #784_simplify_persistentID
lfcnassif Jan 28, 2022
8d9fa3a
#102: makes some static variables specific for each image being decoded
lfcnassif Jan 28, 2022
37124e4
#948: just delete TSK IDs if evidence is root, update startIDs/lastIDs
lfcnassif Jan 28, 2022
0c724c8
fix #948 NPE due to TskServers not started when reading items from index
lfcnassif Jan 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions iped-api/src/main/java/iped3/IItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ public interface IItem extends IItemBase {

ISeekableInputStreamFactory getInputStreamFactory();

String getParentIdInDataSource();

/**
* @return nome e caminho relativo ao caso com que o arquivo de evidência em si
* foi exportado
Expand Down Expand Up @@ -505,8 +503,6 @@ public interface IItem extends IItemBase {

void setIdInDataSource(String string);

void setParentIdInDataSource(String string);

void setThumb(byte[] thumb);

void setImageSimilarityFeatures(byte[] imageSimilarityFeatures);
Expand Down
6 changes: 3 additions & 3 deletions iped-app/resources/config/conf/metadataTypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3374,8 +3374,9 @@ og:type = java.lang.String
og:url = java.lang.String
ontent-Type" = java.lang.String
p2pHistoryEntries = java.lang.Integer
containerGlobalId = java.lang.String
parentGlobalId = java.lang.String
containerTrackId = java.lang.String
parentTrackId = java.lang.String
trackId = java.lang.String
parentViewPosition = java.lang.String
parserException = java.lang.String
pdf:ADBE_ProducerDetails = java.lang.String
Expand Down Expand Up @@ -4055,7 +4056,6 @@ pdf:xmpMM:History:InstanceID = java.lang.String
pdf:xmpMM:History:SoftwareAgent = java.lang.String
pdf:xmpMM:History:When = java.util.Date
pdf:xmpTPg:NPages = java.lang.Integer
globalId = java.lang.String
phoneNumber = java.lang.String
property_ = java.lang.String
property_1 = java.lang.Integer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AttachmentFileType.EmailAttach=Email Attachment
CaseData.Case=Case
ExportCSVTask.CsvColNames="Name","Link","Size","Extension","Bookmark","Category","MD5","SHA1","Deleted","Carved","Accessed","Modified","Created","Path","GlobalId"\r\n
ExportCSVTask.CsvColNames="Name","Link","Size","Extension","Bookmark","Category","MD5","SHA1","Deleted","Carved","Accessed","Modified","Created","Path","TrackId"\r\n
ExportCSVTask.CsvSeparator=,
ExportCSVTask.CsvName=FileList.csv
ExportCSVTask.LinkFunction=HYPERLINK
Expand Down Expand Up @@ -44,6 +44,8 @@ Manager.CreatingViewMap=Creating file preview map...
Manager.DeletingTreeNodes=Deleting empty tree nodes
Manager.FilteringKeywords=Filtering Keywords...
Manager.Optimizing=Optimizing index...
Manager.CommitStarted=Starting commit...
Manager.CommitFinished=Commit finished.
OriginalEmailFileType.ParentEmail=Parent Email
P2PBookmarker.P2PBookmarkPrefix=Probably Shared By
ProgressConsole.files=\ files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AttachmentFileType.EmailAttach=E-Mail Anhang
CaseData.Case=Fall
ExportCSVTask.CsvColNames="Name";"Link";"Size";"Extension";"Bookmark";"Category";"MD5";"SHA1";"Deleted";"Carved";"Accessed";"Modified";"Created";"Path";"GlobalId"\r\n
ExportCSVTask.CsvColNames="Name";"Link";"Size";"Extension";"Bookmark";"Category";"MD5";"SHA1";"Deleted";"Carved";"Accessed";"Modified";"Created";"Path";"TrackId"\r\n
ExportCSVTask.CsvSeparator=;
ExportCSVTask.CsvName=FileList.csv
ExportCSVTask.LinkFunction=HYPERLINK
Expand Down Expand Up @@ -44,6 +44,8 @@ Manager.CreatingViewMap=Erstelle Datei-Vorschau-Übersicht...
Manager.DeletingTreeNodes=Lösche leere Baumknoten
Manager.FilteringKeywords=Filtere Schlüsselwörter...
Manager.Optimizing=Optimiere Index...
Manager.CommitStarted=Starting commit...
Manager.CommitFinished=Commit finished.
OriginalEmailFileType.ParentEmail=Übergeordnete E-Mail
P2PBookmarker.P2PBookmarkPrefix=Wahrscheinlich geteilt von
ProgressConsole.files=\ Dateien
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AttachmentFileType.EmailAttach=Anexo de Email
CaseData.Case=Caso
ExportCSVTask.CsvColNames="Nome";"Atalho";"Tamanho";"Ext";"Marcador";"Categoria";"MD5";"SHA1";"Deletado";"Recuperado";"Acesso";"Modificação";"Criação";"Caminho";"GlobalId"\r\n
ExportCSVTask.CsvColNames="Nome";"Atalho";"Tamanho";"Ext";"Marcador";"Categoria";"MD5";"SHA1";"Deletado";"Recuperado";"Acesso";"Modificação";"Criação";"Caminho";"TrackId"\r\n
ExportCSVTask.CsvSeparator=;
ExportCSVTask.CsvName=Lista de Arquivos.csv
ExportCSVTask.LinkFunction=HIPERLINK
Expand Down Expand Up @@ -44,6 +44,8 @@ Manager.CreatingViewMap=Obtendo mapeamento de versões de visualização para or
Manager.DeletingTreeNodes=Excluindo nós da árvore vazios
Manager.FilteringKeywords=Filtrando palavras-chave...
Manager.Optimizing=Otimizando Índice...
Manager.CommitStarted=Iniciando commit...
Manager.CommitFinished=Commit finalizado.
OriginalEmailFileType.ParentEmail=E-mail de Origem
P2PBookmarker.P2PBookmarkPrefix=Provavelmente Compartilhados via
ProgressConsole.files=\ arquivos
Expand Down
2 changes: 2 additions & 0 deletions iped-engine/src/main/java/dpf/sp/gpinf/carver/CarverTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ private void safeProcess(IItem evidence) {
type = MediaTypes.getParentType(type);
}

clearExtraAttributes(evidence);

findSig(tis);

} catch (Exception t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import dpf.sp.gpinf.indexer.CmdLineArgs;
import dpf.sp.gpinf.indexer.config.ConfigurationManager;
import dpf.sp.gpinf.indexer.config.FileSystemConfig;
import dpf.sp.gpinf.indexer.process.IndexItem;
import dpf.sp.gpinf.indexer.util.Util;
import gpinf.dev.data.DataSource;
import gpinf.dev.data.Item;
Expand Down Expand Up @@ -101,23 +102,12 @@ public void read(File file, Item parent) throws Exception {

rootFile = file;

List<Integer> parents;
List<String> paths;
if (parent != null) {
parents = parent.getParentIds();
parents.add(parent.getId());

StringTokenizer stringTokenizer = new StringTokenizer(parent.getPath(), File.separator);
paths = stringTokenizer.getTokenList();
} else {
parents = Collections.emptyList();
paths = Collections.emptyList();
}
transverse(file, parents, paths);
transverse(file, parent);
}

private void transverse(File file, List<Integer> parents, List<String> paths) throws IOException {
new FolderVisitor(parents, paths).walk(file);
private void transverse(File file, Item parent)
throws IOException {
new FolderVisitor(parent).walk(file);
}

private IItem getEvidence(Path path, BasicFileAttributes attr) {
Expand All @@ -133,10 +123,8 @@ private IItem getEvidence(Path path, BasicFileAttributes attr) {
item.setIdInDataSource(path.toString());
if (file.equals(rootFile)) {
item.setName(evidenceName);
item.setParentIdInDataSource("");
} else {
item.setName(file.getName());
item.setParentIdInDataSource(path.getParent().toString());
}
try {
String relativePath = Util.getRelativePath(output, file);
Expand All @@ -162,13 +150,13 @@ private IItem getEvidence(Path path, BasicFileAttributes attr) {

class FolderVisitor implements FileVisitor<Path> {

private LinkedList<Integer> parentIds;
private LinkedList<String> paths;
private LinkedList<IItem> parents = new LinkedList<>();

public FolderVisitor(List<Integer> parentIds, List<String> paths) {
public FolderVisitor(IItem parent) {
super();
this.parentIds = new LinkedList<>(parentIds);
this.paths = new LinkedList<>(paths);
if (parent != null) {
this.parents.add(parent);
}
}

public void walk(File file) throws IOException {
Expand All @@ -184,20 +172,19 @@ public FileVisitResult visitFile(Path path, BasicFileAttributes attr) {

IItem item = getEvidence(path, attr);
if (item != null) {
if (!parentIds.isEmpty()) {
item.setParentId(parentIds.getLast());
item.addParentIds(parentIds);
if (!parents.isEmpty()) {
item.setParent(parents.getLast());

if (parentIds.size() == 2) {
if (parents.size() == 2) {
item.setExtraAttribute(ExtraProperties.DATASOURCE_READER, this.getClass().getSimpleName());
}
} else {
item.setRoot(true);
}

String fileName = item.getName();
String evidencePath = paths.isEmpty() ? fileName
: paths.stream().collect(Collectors.joining(File.separator)) + File.separator + fileName;
String evidencePath = parents.isEmpty() ? fileName
: parents.getLast().getPath() + File.separator + fileName;
item.setPath(evidencePath);

if (attr.isDirectory()) {
Expand All @@ -219,8 +206,7 @@ public FileVisitResult visitFile(Path path, BasicFileAttributes attr) {
if (attr.isDirectory()) {
// must getId() after caseData.addItem(), it could set item id to previous id
// with --continue
parentIds.addLast(item.getId());
paths.addLast(fileName);
parents.addLast(item);
}
}

Expand All @@ -239,8 +225,7 @@ public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attr) th
}

if (attr.isSymbolicLink() || attr.isOther()) { // pula links simbólicos e NTFS junctions
parentIds.pollLast();
paths.pollLast();
parents.pollLast();
return FileVisitResult.SKIP_SUBTREE;
}

Expand All @@ -250,8 +235,7 @@ public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attr) th
@Override
public FileVisitResult postVisitDirectory(Path path, IOException exception) throws IOException {

parentIds.pollLast();
paths.pollLast();
parents.pollLast();

if (exception != null) {
System.err.println(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ public void read(Set<HashValue> parentsWithLostSubitems, Manager manager) throws
indexDir = ipedCase.getIndex();

BooleanQuery.Builder parents = new BooleanQuery.Builder();
for (HashValue globalId : parentsWithLostSubitems) {
TermQuery tq = new TermQuery(new Term(IndexItem.GLOBAL_ID, globalId.toString().toLowerCase()));
for (HashValue trackID : parentsWithLostSubitems) {
TermQuery tq = new TermQuery(new Term(IndexItem.TRACK_ID, trackID.toString().toLowerCase()));
parents.add(tq, Occur.SHOULD);
}
BooleanQuery.Builder subitems = new BooleanQuery.Builder();
Expand Down
Loading