-
-
[原创]第六题:消失的岛屿 writeup
-
2019-6-11 17:26 2156
-
1.函数逻辑如图
分析知道是修改的base64
keygen
#include <iostream> #include <stdio.h> #include <string> #include <map> #include <vector> using namespace std; string base64 = "tuvwxTUlmnopqrs7YZabcdefghij8yz0123456VWXkABCDEFGHIJKLMNOPQRS9+/" ; map<char, int> dbase64; char chdecrypt(char n) { if ((0x9b - n) >= 0x41 && (0x9b -n) <= 0x5a) return dbase64[0x9b - n] ; else if ((n+ 0x40) > 0x60 && (n + 0x40) < 0x7a) return dbase64[n + 0x40] ; else if ((n - 0x32) > 0x2f && ((n-0x32) <= 0x39)) return dbase64[n - 0x32] ; else { if (n == 'w') return dbase64['+']; else if (n == 'y') return dbase64['/']; else return dbase64[n]; } } int main() { string test = "test"; string t = "!NGV%,$h1f4S3%2P(hkQ94=="; vector<unsigned char> res; int i=0; for ( i = 0; i < base64.size(); i++) dbase64[base64[i]] = i; for (i = 0; i < t.size(); i++) { if (t[i] == '=') res.push_back(0); else res.push_back(chdecrypt(t[i])); } for (i = 0; i < res.size(); i+=4) { char x0 = (res[i] << 2) | ((res[i + 1] >> 4) & 3); char x1 = (res[i + 1] << 4) | ((res[i + 2] >> 2) ); char x2 = (res[i + 2] << 6) | ((res[i + 3] &0x3f)); printf("%c%c%c", x0, x1, x2); } }
key:
KanXue2019ctf_st
[CTF入门培训]顶尖高校博士及硕士团队亲授《30小时教你玩转CTF》,视频+靶场+题目!助力进入CTF世界
最后于 2019-6-11 17:26
被linuxfuns编辑
,原因:
赞赏
他的文章
看原图