Download Jar. Libraryless. Click here for Pure Java version (5963L/42K).
!7 p-exp { byte[] data = loadBinaryFile(userDir(".mozilla/firefox/peppermint.default/sessionstore-backups/recovery.jsonlz4")); print("Have data: " + l(data)); if (empty(data)) ret; print(bytesToHex(subByteArray(data, 0, 16))); int lDecompressed = intFromBytes_littleEndian(data, 8); print("lDecompressed=" + lDecompressed); // see http://fastcompression.blogspot.com/2011/05/lz4-explained.html int i = 12, n = l(data), iOut = 0; byte[] out = new byte[lDecompressed]; while (i < n) { int lLiteral = (data[i] >> 4) & 0x0F; int lMatches = (data[i] & 0x0F)+4; i++; print("lLiteral=" + lLiteral + ", lMatches=" + lMatches); if (lLiteral == 15) { int more; do { more = data[i++] & 0xFF; lLiteral += more; print("lLiteral >> " + lLiteral); } while (more == 255); } print("Have literal: " + quote(fromUtf8_subArray(data, i, lLiteral))); arraycopy(data, i, out, iOut, lLiteral); iOut += lLiteral; i += lLiteral; if (i >= n) break; int offset = data[i] & 0xFF | (data[i+1] & 0xFF) << 8; print("offset=" + offset); i += 2; if (offset == 0) break with print("bad offset"); if (lMatches == 19) { int more; do { more = data[i++] & 0xFF; lMatches += more; print("lMatches >> " + lLiteral); } while (more == 255); } int j = lMatches; while (j-- > 0) { out[iOut] = out[iOut-offset]; iOut++; } print("Got match: " + quote(fromUtf8_subArray(out, iOut-lMatches, lMatches))); //break; } saveProgramTextFile("uncompressed.json", fromUtf8(out)); }
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019807 |
Snippet name: | Get tabs from Firefox Spike 1 [OK] |
Eternal ID of this version: | #1019807/15 |
Text MD5: | 9651a8c9dc514f2f896bae4041ba4cf5 |
Transpilation MD5: | b721441105d00d8cc71107b8ee74dd30 |
Author: | stefan |
Category: | javax / firefox |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-26 23:51:00 |
Source code size: | 1700 bytes / 56 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 395 / 967 |
Version history: | 14 change(s) |
Referenced in: | #1019811 - decompressMozillaJSONLZ4File #1019813 - Get tabs from Firefox Spike 2 [OK on Windows & Linux - just lags a few seconds until Firefox writes session to disk] |