Skip to content

通过 Metasploit::Framework::Compiler 编译解码 Base64

L edited this page May 23, 2022 · 1 revision

如何使用 Metasploit::Framework::Compiler 解码 Base64

Metasploit C 编译器内置支持 Base64 编码和解码, 实现为 base64.h.

代码示例

#include <Windows.h>
#include <String.h>
#include <base64.h>

// Rex::Text.encode_base64() 编码的 "Hello World"
#define BASE64STR "aGVsbG8gd29ybGQ="

int main() {
  int base64StrLen = strlen(BASE64STR);
  LPVOID lpBuf = VirtualAlloc(NULL, sizeof(int) * base64StrLen, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
  memset(lpBuf, '\0', base64StrLen);
  base64decode(lpBuf, BASE64STR, base64StrLen);
  MessageBox(NULL, (char*) lpBuf, "Base64 Test", MB_OK);
  return 0;
}

要编译, 请使用 Metasploit::Framework::Compiler::Windows.compile_c.

Clone this wiki locally