Invest in hints
根据题目可以发现每一行的长度均为73,根据提示发现每一行中的1的数量与Hint中字符的长度对应,因此我们可以合理猜测这些1的位置为Flag中的已知位。
首先需要找到最优解,用贪心算法查询,找到解锁最少hint的方案
接着进行替换,0替换成 ? 表示未知,1替换成相应的字符
最后将字符串进行合并,得到Flag
hints = [
"00001100101001111010000000010010001110100000000000000000001101111000100", # 51
"01101000111011000000000101000100001001101100000000010010001110011000000", # 52
"10100100000001011000110001001101000010001101011101010110001000000000000", # 53
"00001010000010010000100110000100000010000100101100111000001011100000111", # 54
"01110010100100100000000000000000011010110011000001111000101100000001000", # 55
"01110100001001000010010111101111011101001000100010011001000010011100000", # 56
"10000101010000000011000001100101001010110100000110110010001000100011000", # 57
"00000111101000001001000001100100100000110000110000101000001101110100000", # 58
"01001101001001000000001001001110100000000000001011000100010000101010101", # 59
"10010010100110011011100010011001100100100001110010010101001000100001111", # 60
"01001000100011000001000000000011010001110001000000101100001000100010100", # 61
"00101000010000111000101110000010001000000001000111100010001101001001101", # 62
"01000010111010000000010100001010001011000100100010000000000000001000000", # 63
"01110110110011000000010000011000000010000000000000111000000010000010001", # 64
"01100000000011000110000000010001000000000011001100000110010001011010000", # 65
"01110011001000101001100001011000011010000001100010100000011010000001000", # 66
"00111011000011000000100100101000100100101000010001100111001000100001000", # 67
"01000110010101011100110101110010001111100011010000000101010100000010010", # 68
"11111010111000110100010000000010001101111010011010001100000011000001001", # 69
"00000010110101100100100011001011011001100000100010011111000011000001101", # 70
"00001100001110101000010111001100011100100010011100001010000000001000010", # 71
"01100000000011001001011100000101000110111000101100010101111000001010100", # 72
"00001000001010010000001101010110110000110111011011100101011110010110000", # 73
"01010010100000000111011110001000010110100001000111001101010100000010000", # 74
"11010000011000010100001010000111011010100001111010100100100000111110110", # 75
]
# 对原数据进行Reverse操作
hints = [hint[::-1] for hint in hints]
# 获取每个hint中所有位置为'1'的索引
coverages = []
for hint in hints:
covered_positions = {i for i, bit in enumerate(hint) if bit == '1'}
coverages.append(covered_positions)
# 贪心算法,选择尽可能覆盖更多未覆盖位置的hint
all_positions = set(range(71))
covered_positions = set()
selected_hints = []
while covered_positions != all_positions:
best_hint_index = None
best_new_cover = 0
for i, coverage in enumerate(coverages):
new_cover = len(coverage - covered_positions)
if new_cover > best_new_cover:
best_new_cover = new_cover
best_hint_index = i
selected_hints.append(best_hint_index)
covered_positions.update(coverages[best_hint_index])
# 解锁Hint的最优解
print(f"The Best Hint Combination: {[index + 1 for index in selected_hints]}")
# 将对应的hint存储为hints_plus
selected_hints_binary = [hints[i] for i in selected_hints]
hints_plus = selected_hints_binary
# 将对应的data存储为datas_plus
datas_plus = [
"hgamgko9CLgQSyzti1Dlu8r2mD5wda}", # 10
"{AuYoACLQa2zq3i691hNlCxrALma42", # 6
"e{uYMkfo9i7L0gSCKWy3t69DNCbmDLH", # 23
"megk9CiLrKWyAqi9hN8rELm}", # 7
"hm5Y9AL0gCaWy2zq6xRmCLEwdHa42}", # 19
"mMk3ACi7SCWyAq3C5wda42", # 5
]
# 输出 hints_plus 和 datas_plus
for idx, (hint, data) in zip(selected_hints, zip(hints_plus, datas_plus)):
if len(data) < len(hint):
data = data.ljust(len(hint), '?')
result = []
data_index = 0
for bit in hint:
if bit == '1':
result.append(data[data_index])
data_index += 1
else:
result.append('?')
final_string = ''.join(result)
print(f"Hint {idx + 51} | {hint} | {final_string}")
# 合并得到Flag
final_known_string = ['?'] * 71
for idx, (hint, data) in zip(selected_hints, zip(hints_plus, datas_plus)):
data_index = 0
for i, bit in enumerate(hint):
if bit == '1':
if final_known_string[i] == '?':
final_known_string[i] = data[data_index]
data_index += 1
final_string = ''.join(final_known_string)
print(f"The Final Flag: {final_string}")
得到的结果为
The Best Hint Combination: [10, 6, 23, 7, 19, 5]
Hint 60 | 11110000100010010101001001110000100100110011001000111011001100101001001 | hgam????g???k??o?9?C??L??gQS????y??z??ti??1D??l???u8r?2m??D5??w?d??a??}
Hint 56 | 00000111001000010011001000100010010111011110111101001000010010000101110 | ?????{Au??Y????o??AC??L???Q???a??2?zq3?i691?hNlC?x??r????A??L????m?a42?
Hint 73 | 00001101001111010100111011011101100001101101010110000001001010000010000 | ????e{?u??YMkf?o?9??i7L?0g?SCK?Wy????3t?69?D?N?Cb??????m??D?L?????H????
Hint 57 | 00011000100010001001101100000101101010010100110000011000000001010100001 | ???me???g???k???9??Ci?Lr?????K?Wy?A?q??i?9??hN?????8r????????E?L?m????}
Hint 69 | 10010000011000000110001011001011110110001000000001000101100011101011111 | h??m?????5Y??????9A???L?0g??C?aWy2?zq???6????????x???R?mC???LEw?d?Ha42}
Hint 55 | 00010000000110100011110000011001101011000000000000000000100100101001110 | ???m???????Mk?3???ACi7?????SC??Wy?A?q3??????????????????C??5??w?d??a42?
The Final Flag: hgame{Aug5YMkf3o99ACi7Lr0gQSCKaWy2Azq3ti691DhNlCbxu8rR2mCAD5LEwLdmHa42}
Computer cleaner plus
起仿真后查看进程发现ps被修改,但是直接泄露了可疑的程序
得到Flag
hgame{B4ck_D0_oR}