file_store

点击此处获得更好的阅读体验


WriteUp来源

来自颖奇L'Amore

题目描述

Store your files with safety.

题目考点

  • 哈夫曼编码

解题思路

哈夫曼编码,给了字符集,调试dump+构造输入测试得到字典,带入字典得到结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
c = list(open("flag.bin", "rb").read())
k = [
0xCB, 0x76, 0x27, 0x4C, 0x0A, 0xE8, 0x9F, 0x6F, 0xC5, 0x75, 0xB3, 0xEB, 0x2E, 0xAA, 0xB1, 0x76,
0xF3, 0xD1, 0x8B, 0xC8, 0xEC, 0xD7, 0x90, 0xE3, 0x14, 0x4B, 0xFA, 0xEE, 0x57, 0x56, 0x04, 0x1C,
0x2D, 0xF7, 0x0B, 0x7E, 0xB5, 0x38, 0x99, 0xD6, 0xFC, 0x63, 0xC4, 0xFC, 0xC1, 0xCD, 0xB9, 0x3B,
0x6D, 0x87, 0xCD, 0x50, 0x67, 0x36, 0xAA, 0x41, 0x0E, 0xC5, 0x62, 0x8A, 0xA1, 0xF1, 0xC5, 0xEB,
0xC0, 0xF7, 0xF5, 0x69, 0x6C, 0xBD, 0x11, 0x1B, 0x4F, 0x00, 0xD4, 0xD8, 0x5A, 0xB9, 0x33, 0x3A,
0xD0, 0xB9, 0xD8, 0x38, 0x38, 0xD2, 0x53, 0x5C, 0x1E, 0x62, 0xB0, 0xC4, 0x8D, 0xCF, 0x95, 0x66,
0xAD, 0x1D, 0x99, 0xF7, 0xF9, 0xCF, 0x91, 0x3B, 0x08, 0xAE, 0x60, 0xB9, 0xB1, 0x03, 0x5E, 0xD2,
0x07, 0x30, 0x0F, 0x97, 0x6C, 0xA6, 0xB0, 0xFF, 0xF8, 0x43, 0xD1, 0x06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 0x9A, 0x9D,
0x9A, 0x65, 0xD3, 0x60, 0x8F, 0xB7, 0x65, 0x75, 0xE9, 0x5E, 0xBE, 0xE4, 0xB7, 0xE1, 0xD8, 0xD8,
0xE0, 0xD4, 0xD0, 0x1B, 0xEC, 0xA7, 0x17, 0xCC, 0x3D, 0xA6, 0x53, 0x99, 0xC2, 0x67, 0x00, 0xAA,
0xF2, 0xF0, 0x41, 0x77, 0x67, 0xDB, 0xE0, 0x83, 0x1D, 0xF9, 0xFD, 0x1A, 0x6C, 0x74, 0x40, 0x85,
0xA3, 0x84, 0xE5, 0x04, 0xC3, 0xD0, 0xDA, 0xF6, 0xE6, 0xEB, 0x47, 0x42, 0x86, 0x40, 0x83, 0x06,
0xDA, 0xA8, 0xC5, 0x46, 0x2A, 0x26, 0x6A, 0x15, 0xAC, 0x9E, 0x20, 0xCC, 0x50, 0x80, 0xA2, 0x0F,
0x34, 0x5A, 0x7B, 0x0A, 0x75, 0x65, 0x84, 0xB9, 0x3C, 0x7F, 0x66, 0xCA, 0x40, 0xD1, 0xBC, 0x97,
0x23, 0x64, 0x40, 0x79, 0x00, 0x8E, 0x1A, 0x76, 0x84, 0x03, 0x63, 0xC8, 0x75, 0x28, 0x21, 0xBD,
0x67, 0xF5, 0x98, 0xA0, 0x63, 0xC0, 0x68, 0xC9
]
for i in range(len(c)):
c[i] ^= k[i]

s = ""
for i in c:
s += bin(i)[2:].rjust(8, '0')

d = dict([
['111', b' '], ['001', b'e'], ['1100', b'a'], ['1010', b't'],
['0111', b'r'], ['0110', b'o'], ['0100', b'n'], ['0001', b'i'],
['11011', b's'], ['11010', b'h'], ['10010', b'd'], ['10000', b'l'],
['01010', b'f'], ['101111', b'c'], ['101101', b'm'], ['101100', b'w'],
['100011', b'g'], ['010111', b'u'], ['010110', b'y'], ['1011100', b','],
['1011101', b'.'], ['1001100', b'H'], ['1001101', b'p'], ['1000100', b'S'],
['1000101', b'v'], ['0000111', b'b'], ['0000101', b'-'], ['0000001', b'1'],
['00001101', b'3'], ['10011100', b'A'], ['00000001', b'6'], ['00001100', b'k'],
['100111110', b'\n'], ['100111011', b'\n'], ['100111100', b'5'], ['100111010', b'8'],
['100111111', b'B'], ['000000001', b'T'], ['000010001', b"'"], ['000010000', b'2'],
['000001111', b'4'], ['000010010', b'7'], ['000001110', b'G'], ['10011110110', b'(' ],
['10011110111', b')' ], ['0000011011', b'9' ], ['1001111010', b':' ], ['0000010100', b';' ],
['0000010101', b'C' ], ['000010011', b'W'], ['0000011000', b'F' ], ['0000011001', b'J' ],
['0000010000', b'L' ], ['0000010011', b'M' ], ['0000010001', b'R' ], ['0000011010', b'q' ],
['0000010111', b'x' ], ['0000010110', b'{' ], ['0000010010', b'}' ]
])


res = b""
while len(s) >= 0:
found = 0
for key in d.keys():
if s.startswith(key):
found = 1
res += d[key]
s = s[len(key):]
break
if found == 0:
break
print(res.decode())

Flag

1
flag{thisissoeasy1e7383d39ac23}