Skip to content

Commit 537e261

Browse files
committed
corrected sig offset
1 parent 2ebf7c6 commit 537e261

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

parser.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function parseFileSig(filePath, signatures) {
6262
const match = regex.exec(hexString);
6363
if (match) {
6464
console.log(match.index);
65-
return parseFileBody(match, signature);
65+
return parseFileBody(match, signature, match[1].length);
6666
}
6767
}
6868
return null;
@@ -71,11 +71,11 @@ function parseFileSig(filePath, signatures) {
7171
function sigToRegex(signature) {
7272
// Signatures are either at the very beginning of the file or after a CRLF following the header
7373
// Signatures are NOT GUARANTEED to be at the beginning of the file
74-
return new RegExp(`(^|\r\n)${signature}`, 'g');
74+
return new RegExp(`(^|0d0a)${signature}`, 'g');
7575
}
7676

77-
function parseFileBody(match, signature) {
78-
const body = signature + match.input.substring(match.index + signature.length);
77+
function parseFileBody(match, signature, offset) {
78+
const body = signature + match.input.substring(match.index + signature.length + offset);
7979
const buffer = Buffer.from(body, 'hex');
8080
// console.log(buffer);
8181
// fs.writeFileSync("test.png", buffer);

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h1>HTTP Cache File Signature Search</h1>
1414
<h2>Configure</h2>
1515
<form>
1616
<label for="directoryPath">Enter directory path:</label><br>
17-
<input class="mb" id="pathInput" type="text" name="directoryPath" placeholder="e.g. %LocalAppData%\Mozilla\Firefox\Profiles\toy7mtpb.default-release\cache2\entries" required><br>
17+
<input class="mb" id="pathInput" type="text" name="directoryPath" placeholder="e.g. C:\Users\username\AppData\Local\Mozilla\Firefox\Profiles\toy7mtpb.default-release\cache2\entries" required><br>
1818

1919
<label for="">Timeframe:</label><br>
2020
<div class="mb" id="timeframes-container">

0 commit comments

Comments
 (0)