Download Jar. Libraryless. Click here for Pure Java version (5963L/42K).
1 | !7 |
2 | |
3 | p-exp { |
4 | byte[] data = loadBinaryFile(userDir(".mozilla/firefox/peppermint.default/sessionstore-backups/recovery.jsonlz4")); |
5 | print("Have data: " + l(data)); |
6 | if (empty(data)) ret; |
7 | |
8 | print(bytesToHex(subByteArray(data, 0, 16))); |
9 | |
10 | int lDecompressed = intFromBytes_littleEndian(data, 8); |
11 | print("lDecompressed=" + lDecompressed); |
12 | |
13 | // see http://fastcompression.blogspot.com/2011/05/lz4-explained.html |
14 | |
15 | int i = 12, n = l(data), iOut = 0; |
16 | byte[] out = new byte[lDecompressed]; |
17 | while (i < n) { |
18 | int lLiteral = (data[i] >> 4) & 0x0F; |
19 | int lMatches = (data[i] & 0x0F)+4; |
20 | i++; |
21 | print("lLiteral=" + lLiteral + ", lMatches=" + lMatches); |
22 | if (lLiteral == 15) { |
23 | int more; |
24 | do { |
25 | more = data[i++] & 0xFF; |
26 | lLiteral += more; |
27 | print("lLiteral >> " + lLiteral); |
28 | } while (more == 255); |
29 | } |
30 | print("Have literal: " + quote(fromUtf8_subArray(data, i, lLiteral))); |
31 | arraycopy(data, i, out, iOut, lLiteral); |
32 | iOut += lLiteral; |
33 | i += lLiteral; |
34 | if (i >= n) break; |
35 | int offset = data[i] & 0xFF | (data[i+1] & 0xFF) << 8; |
36 | print("offset=" + offset); |
37 | i += 2; |
38 | if (offset == 0) break with print("bad offset"); |
39 | if (lMatches == 19) { |
40 | int more; |
41 | do { |
42 | more = data[i++] & 0xFF; |
43 | lMatches += more; |
44 | print("lMatches >> " + lLiteral); |
45 | } while (more == 255); |
46 | } |
47 | int j = lMatches; |
48 | while (j-- > 0) { |
49 | out[iOut] = out[iOut-offset]; |
50 | iOut++; |
51 | } |
52 | print("Got match: " + quote(fromUtf8_subArray(out, iOut-lMatches, lMatches))); |
53 | //break; |
54 | } |
55 | saveProgramTextFile("uncompressed.json", fromUtf8(out)); |
56 | } |
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: | 394 / 966 |
Version history: | 14 change(s) |
Referenced in: | [show references] |