diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/browsers/chrome/CacheIndexParser.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/browsers/chrome/CacheIndexParser.java index f82150346b..01d50900f8 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/browsers/chrome/CacheIndexParser.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/browsers/chrome/CacheIndexParser.java @@ -46,7 +46,9 @@ public class CacheIndexParser extends AbstractParser { public static final String CACHE_URL = METADATA_PREFIX + ":chromeCacheUrl"; private static final String CACHE_ENTRY_NAME = METADATA_PREFIX + ":cacheEntryName"; + public static final String CACHE_ENTRY_CREATED = METADATA_PREFIX + ":created"; public static final String CACHE_ENTRY_COUNT = METADATA_PREFIX + ":numEntries"; + @Override public Set getSupportedTypes(ParseContext context) { return SUPPORTED_TYPES; @@ -122,6 +124,7 @@ public void parse(InputStream indexFile, ContentHandler handler, Metadata metada entryMeta.set(IS_CACHE_INDEX_ENTRY, Boolean.TRUE.toString()); entryMeta.set(CACHE_ENTRY_NAME, ce.getName()); entryMeta.set(CACHE_URL, ce.getRequestURL()); + entryMeta.set(TikaCoreProperties.CREATED, ce.getCreationTime()); for (Map.Entry entry : httpResponse.entrySet()) { entryMeta.set(entry.getKey(), entry.getValue()); diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/discord/cache/CacheEntry.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/discord/cache/CacheEntry.java index 174fb7c0d3..6c443db550 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/discord/cache/CacheEntry.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/discord/cache/CacheEntry.java @@ -3,6 +3,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.Arrays; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,7 +33,7 @@ public class CacheEntry { private int reuseCount; private int refetchCount; private int state; - private long creationTime; + private Date creationTime; private int keyDataSize; private CacheAddr longKeyAddressCacheAddress; private long longKeyAddress; @@ -66,7 +67,7 @@ public int getRefetchCount() { return refetchCount; } - public long getCreationTime() { + public Date getCreationTime() { return creationTime; } @@ -124,7 +125,8 @@ public CacheEntry(InputStream is, List dataFiles, List reuseCount = Index.read4bytes(is); refetchCount = Index.read4bytes(is); state = Index.read4bytes(is); - creationTime = Index.read8bytes(is); + + creationTime = Index.readDate(is); keyDataSize = Index.read4bytes(is); longKeyAddress = Index.readUnsignedInt(is); longKeyAddressCacheAddress = new CacheAddr(longKeyAddress); diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/discord/cache/Index.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/discord/cache/Index.java index d62156894c..3d92f59599 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/discord/cache/Index.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/discord/cache/Index.java @@ -5,8 +5,11 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import org.apache.poi.hpsf.Filetime; +import org.apache.poi.util.LittleEndianByteArrayInputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -247,4 +250,11 @@ public static long read8bytes(InputStream is) throws IOException { return ByteBuffer.wrap(b).getLong() & 0xffffffffffffffffL; } + public static Date readDate(InputStream is) throws IOException { + byte[] buf = new byte[8]; + is.read(buf); + long timestamp = new LittleEndianByteArrayInputStream(buf).readLong(); + return Filetime.filetimeToDate(timestamp * 10); + } + }