55.[GUET-CTF2019]KO
Brainfuck/Ook! Obfuscation/Encoding [splitbrain.org] 解密网站
下载完就是一txt 文件,发现是brainfuck 加密
解密后拿到flag
flag{welcome to CTF}
56.[GXYCTF2019]gakki
下载压缩包,里面是一张作者老婆图片 xx野结衣
用Notepad ++ 打开里面搜索flag 发现有flag.txt 文件
改后缀为zip 解压需要密码
但是没有线索得到密码
用binwalk 分析该图片,发现是rar ,用rar工具暴力破解
得到密码 8864
解压后发现有大量的字符
也不是加密,搜索flag 也搜索不到
猜测应该是统计字符多少
# -*- coding:utf-8 -*-
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+- =\\{\\}[]"
strings = open('./flag.txt').read()
result = {}
for i in alphabet:
counts = strings.count(i)
i = '{0}'.format(i)
result[i] = counts
res = sorted(result.items(),key=lambda item:item[1],reverse=True)
for data in res:
print(data)
for i in res:
flag = str(i[0])
print(flag[0],end="")
用脚本跑
得到flag
GXY{gaki_IsMyw1fe}
57.[ACTF新生赛2020]base64隐写
打开压缩包里面是一个文档和一个图片
尝试解密 base64 Base64 在线编码解码 | Base64 加密解密 - Base64.us
解密之后,发现是一段C语言代码
但是解密之后的代码有乱码
#include<iostream> #include<string> #include<cstring> #include<cstdio> #define maxn 999 using nanespace std; char$ca[maxn], cb[maxn]; int cmp(string a, string h銻 ȩf(kze() > b.size()) )ࢀreturn 1; else if(a.size() < b.size()) return -1; else { for(int i = 0; i < a.size(); i++) 蠠 &늠 ` $ if(a[i] < b[i]) &ࡀ &࠲eturn&� ` $ if(a[i] >`b[i]) (I呕ɸỊ } +ࣀreturn 0; } } void reseta(string a) { `memset(ca,0,sizeof(ca)); 覯r(int i = 0; i < a.size(Ỡi++) { ca[i] = a[a.size()-1-i] - '0'; } } void resetb(string b) { `memset(cb,0,sizeof(cb)); for(int i = 0; i < b.size(); i++) { ` $cb[靠= f[b.size().1-i] - '0'; ` $//printf("%d",cb[i]); } } string edd(string a, string b)//加法 { reseta(a);//把每一位存的字符变成数字,并且把数组反过来便于后面不同位数相加 resetb(b); for(int i#= 0; i <#maxn; i++) { ca[i] = ca[i] + cb[i]; if(ca[i] >= 2){ # ࠠ ca[i+1] +=#1; ca[i] -= 2; } } bool flag = true; ȳtring c = ""; for(int i = maxn - 1; i >= 0; i--) { if(flag && ca[i] == 0) continue; if(ca[i] != 0) *ࢀ flag = false; 蠠 &㠫= (ca[i] + '0'); //printf("%d",ca[i]); } if(flag) ` $return "0"; else +ࣀreturn c; } string minu(string a, string b)//减法 { int sign = 0; if(cmp(a, b) == -1)//a中应该存较大的那个数 { sign = 1; string temp = a; a = b; b = temp; } reseta(a); resetb(b); for(int i = 0; i < maxn; i++) { if(ca[i] < cb[i]){ ca[i+1] -= 1; ca[i] += 2; } ca[i] = ca[i] - cb[i]; } bool flag = true; string d = ""; for(int i = maxn - 1; i >= 0; i--) { if(flag && ca[i] == 0) continue; if(ca[i] != 0) flag = false; d += (ca[i] + '0'); //printf("%d",ca[i]); } if(flag) return "0"; else return d; } string mul(string x, string y)//s为符号位 { int lenx = x.size(); int leny = y.size(); if(lenx == 1) { //cout<<x<<" "<<y<<endl; if(x == "1" && y == "1") return "1"; else return "0" ; } //printf("%d--%d\n",lenx,leny); string a, b, c,d; a = x.substr(0, lenx/2); b = x.substr(lenx/2, lenx/2); c = y.substr(0, leny/2); d = y.substr(leny/2, leny/2); printf("%d--%d--%d--%d--------------------------------------------%d-%d\n",a.size(), b.size(), c.size(), d.size(), x.size(), y.size()); //cout<<x<<":"<<a<<" "<<b<<" "<<c<<" "<<d<<endl; string ac = mul(a, c); string bd = mul(b, d); //cout<<x<<":"<<ac<<" "<<bd<<endl; string ab = minu(a, b);//a-b string cd = minu(d, c); //cout<<x<<":"<<ab<<" "<<cd<<endl; string abcd = mul(ab, cd); //cout<<x<<":"<<abcd<<endl; string first = ac; for(int i = 0; i < (lenx); i++) first += "0"; //cout<<ac<<" -----ac---- "<<first<<endl; string second = add(abcd, ac); second = add(second, bd); for(int i = 0; i < (lenx/2); i++) second += "0"; string fin = add(first, second); return add(fin, bd); } int main(void) { string x, y; printf("请输入两个二进制数字: "); cin>>x>>y; string ans = mul(x, y); cout<<ans; }
网上发现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()
ACTF{6aseb4_f33!}