BUUCTF:[ACTF新生赛2020]base64隐写
Posted 末初mochu7
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了BUUCTF:[ACTF新生赛2020]base64隐写相关的知识,希望对你有一定的参考价值。
题目地址:https://buuoj.cn/challenges#[ACTF%E6%96%B0%E7%94%9F%E8%B5%9B2020]base64%E9%9A%90%E5%86%99
base64隐写
,利用脚本
def get_base64_diff_value(s1, s2):
base64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
res = 0
for i in xrange(len(s2)):
if s1[i] != s2[i]:
return abs(base64chars.index(s1[i]) - base64chars.index(s2[i]))
return res
def solve_stego():
with open('ComeOn!.txt', 'rb') as f:
file_lines = f.readlines()
bin_str = ''
for line in file_lines:
steg_line = line.replace('\\n', '')
norm_line = line.replace('\\n', '').decode('base64').encode('base64').replace('\\n', '')
diff = get_base64_diff_value(steg_line, norm_line)
print diff
pads_num = steg_line.count('=')
if diff:
bin_str += bin(diff)[2:].zfill(pads_num * 2)
else:
bin_str += '0' * pads_num * 2
print goflag(bin_str)
def goflag(bin_str):
res_str = ''
for i in xrange(0, len(bin_str), 8):
res_str += chr(int(bin_str[i:i + 8], 2))
return res_str
if __name__ == '__main__':
solve_stego()
PS C:\\Users\\Administrator\\Downloads\\tmp\\近在眼前> python2 .\\test.py
1
0
5
A
0
A
13
AC
1
AC
1
AC
0
ACT
4
ACT
1
ACT
2
ACTF
1
ACTF
3
ACTF
11
ACTF
0
ACTF
0
ACTF
13
ACTF
0
ACTF
0
ACTF
2
ACTF6
1
ACTF6
8
ACTF6
1
ACTF6a
7
ACTF6a
0
ACTF6a
13
ACTF6as
0
ACTF6as
2
ACTF6as
1
ACTF6as
0
ACTF6as
1
ACTF6ase
1
ACTF6ase
2
ACTF6ase
0
ACTF6ase
0
ACTF6ase
0
ACTF6ase
2
ACTF6aseb
0
ACTF6aseb
0
ACTF6aseb
3
ACTF6aseb
1
ACTF6aseb
0
ACTF6aseb4
0
ACTF6aseb4
1
ACTF6aseb4
1
ACTF6aseb4
0
ACTF6aseb4
3
ACTF6aseb4
3
ACTF6aseb4_
1
ACTF6aseb4_
2
ACTF6aseb4_
6
ACTF6aseb4_f
0
ACTF6aseb4_f
3
ACTF6aseb4_f
0
ACTF6aseb4_f
0
ACTF6aseb4_f
0
ACTF6aseb4_f
3
ACTF6aseb4_f3
0
ACTF6aseb4_f3
0
ACTF6aseb4_f3
0
ACTF6aseb4_f3
0
ACTF6aseb4_f3
3
ACTF6aseb4_f3
0
ACTF6aseb4_f3
0
ACTF6aseb4_f3
0
ACTF6aseb4_f3
0
ACTF6aseb4_f3
0
ACTF6aseb4_f3
12
ACTF6aseb4_f33
2
ACTF6aseb4_f33
0
ACTF6aseb4_f33
0
ACTF6aseb4_f33
0
ACTF6aseb4_f33
1
ACTF6aseb4_f33!
7
ACTF6aseb4_f33!
13
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
0
ACTF6aseb4_f33!
PS C:\\Users\\Administrator\\Downloads\\tmp\\近在眼前>
flag6aseb4_f33!
以上是关于BUUCTF:[ACTF新生赛2020]base64隐写的主要内容,如果未能解决你的问题,请参考以下文章