INSHack2018(not) so deep
分离图片,看到一张png
好像有摩斯码,回过头010检查发现PNG后面还有段数据,另存一下:
用trid看一下是什么:
也是种音频文件,修改后缀为.ogg
,Audacity打开看到莫斯码:
.. -. ... .- -.--. -- ----- .-. ..... ...-- ..--.- .-- .---- .-.. .-....--.- -. ...-- ...- ...-- .-. ..--.- ....- --. ...-- -.-.-- -.--.-
可在线,也可脚本(自写):
# 编码表
morse_table = {'a': '01', 'b': '1000', 'c': '1010', 'd': '100', 'e': '0', 'f': '0010', 'g': '110',
'h': '0000', 'i': '00', 'j': '0111', 'k': '101', 'l': '0100', 'm': '11', 'n': '10',
'o': '111', 'p': '0110', 'q': '1101', 'r': '010', 's': '000', 't': '1', 'u': '001',
'v': '0001', 'w': '011', 'x': '1001', 'y': '1011', 'z': '1100',
'0': '11111', '1': '01111', '2': '00111', '3': '00011', '4': '00001',
'5': '00000', '6': '10000', '7': '11000', '8': '11100', '9': '11110',
',': '110011', '.': '010101', ':': '111000', ';': '101010', '?': '001100',
'=': '10001', "'": '011110', '/': '10010', '!': '101011', '-': '100001',
'_': '001101', '(': '10110', ')': '101101', '$': '0001001', '&': '01000', '@': '011010',
' ':''
}
# 解码表
morse_table2 = dict(map(lambda t:(t[1],t[0]),morse_table.items()))
# 编码
def encode(content, long_symbol, short_symbol, separator):
result = []
for c in content:
result.append(morse_table[c])
tmp = separator.join(result)
tmp = tmp.replace("1",long_symbol)
tmp = tmp.replace("0",short_symbol)
return tmp
# 解码
def decode(content, long_symbol, short_symbol, separator):
content = content.replace(long_symbol,"1")
content = content.replace(short_symbol,"0")
tmp = content.split(separator)
result = ""
for c in tmp:
result += morse_table2[c]
return result
if __name__ == "__main__":
long_symbol = '-'
short_symbol = '.'
separator = ' '
content = "hello world!"
# encode
print(encode(content, long_symbol, short_symbol, separator))
content = ".. -. ... .- -.--. -- ----- .-. ..... ...-- ..--.- .-- .---- .-.. .-.. ..--.- -. ...-- ...- ...-- .-. ..--.- ....- --. ...-- -.-.-- -.--.-"
# decode
result = decode(content, long_symbol, short_symbol, separator)
print(result,result.upper())
破译:
insa(m0r53_w1ll_n3v3r_4g3!) INSA(M0R53_W1LL_N3V3R_4G3!)