使用pycharm时,如果想把代码撤销到之前的状态可以用 Ctrl+z
如果不小心撤销多了,可以用 Ctrl+Shift+Z 还原, 别傻傻的重新敲了
BUUCTF在线评测 (buuoj.cn)
查看字符串,想到base64的变表
这里用的c++的标准程序库中的string,头文件是#include<string>
这是base64的加密函数
std::string __cdecl base64Encode(std::string *p_decode)
{
std::string *v1; // rdx
char *v2; // rax
int v3; // ebx
char *v4; // rax
int v5; // ebx
char *v6; // rax
_BYTE *v7; // rax
char *v8; // rax
_BYTE *v9; // rax
char *v10; // rax
int v11; // ebx
char *v12; // rax
_BYTE *v13; // rax
__int64 v15; // [rsp+0h] [rbp-80h] BYREF
int pos_0; // [rsp+30h] [rbp-50h]
int pos; // [rsp+34h] [rbp-4Ch]
int len; // [rsp+38h] [rbp-48h]
int i; // [rsp+3Ch] [rbp-44h]
std::string *p_decodea; // [rsp+68h] [rbp-18h]
p_decodea = v1;
std::allocator<char>::allocator(&v15 + 47);
std::string::string(p_decode, &unk_489084);
std::allocator<char>::~allocator();
len = std::string::length(p_decodea);
for ( i = 0; len / 3 > i; ++i )
{
v2 = std::string::operator[](p_decodea, 3 * i);
std::string::operator[](&baseKey, *v2 >> 2);
std::string::operator+=(p_decode);
v3 = 16 * (*std::string::operator[](p_decodea, 3 * i) & 3);
v4 = std::string::operator[](p_decodea, 3 * i + 1);
std::string::operator[](&baseKey, v3 | (*v4 >> 4));
std::string::operator+=(p_decode);
v5 = 4 * (*std::string::operator[](p_decodea, 3 * i + 1) & 0xF);
v6 = std::string::operator[](p_decodea, 3 * i + 2);
std::string::operator[](&baseKey, v5 | (*v6 >> 6));
std::string::operator+=(p_decode);
v7 = std::string::operator[](p_decodea, 3 * i + 2);
std::string::operator[](&baseKey, *v7 & 0x3F);
std::string::operator+=(p_decode);
}
if ( len % 3 == 1 )
{
pos = 3 * (len / 3);
v8 = std::string::operator[](p_decodea, pos);
std::string::operator[](&baseKey, *v8 >> 2);
std::string::operator+=(p_decode);
v9 = std::string::operator[](p_decodea, pos);
std::string::operator[](&baseKey, 16 * (*v9 & 3));
std::string::operator+=(p_decode);
std::string::operator+=(p_decode, "==");
}
if ( len % 3 == 2 )
{
pos_0 = 3 * (len / 3);
v10 = std::string::operator[](p_decodea, pos_0);
std::string::operator[](&baseKey, *v10 >> 2);
std::string::operator+=(p_decode);
v11 = 16 * (*std::string::operator[](p_decodea, pos_0) & 3);
v12 = std::string::operator[](p_decodea, pos_0 + 1);
std::string::operator[](&baseKey, v11 | (*v12 >> 4));
std::string::operator+=(p_decode);
v13 = std::string::operator[](p_decodea, pos_0 + 1);
std::string::operator[](&baseKey, 4 * (*v13 & 0xF));
std::string::operator+=(p_decode);
std::string::operator+=(p_decode, "=");
}
return p_decode;
}
脚本直接出
一个base64的简单变表,但是是用string标准库函数写的