53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#include "resource.h"
|
|
#include <boost/beast/core.hpp>
|
|
#include <boost/beast/core/detail/base64.hpp>
|
|
#include <iostream>
|
|
|
|
CResource::CResource()
|
|
{
|
|
}
|
|
|
|
std::string base64_decode(const std::string& in)
|
|
{
|
|
static const std::string base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
"abcdefghijklmnopqrstuvwxyz"
|
|
"0123456789+/";
|
|
|
|
std::string out;
|
|
int val = 0, valb = -8;
|
|
for (unsigned char c : in) {
|
|
if (base64_chars.find(c) == std::string::npos) {
|
|
if (c != '=') {
|
|
std::cout << "Invalid Base64 input" << std::endl;
|
|
}
|
|
continue;
|
|
}
|
|
val = (val << 6) + base64_chars.find(c);
|
|
valb += 6;
|
|
if (valb >= 0) {
|
|
out.push_back(char((val >> valb) & 0xFF));
|
|
valb -= 8;
|
|
}
|
|
}
|
|
return out;
|
|
}
|
|
|
|
std::string CResource::getShellTemplate()
|
|
{
|
|
std::string s =
|
|
"IyEvYmluL2Jhc2gKU0NSSVBUX0RJUj0kKGNkICIkKGRpcm5hbWUgIiQwIikiICYmIHB3ZC"
|
|
"kKY2QgIiRTQ1JJUFRfRElSIiB8fCBleGl0CmV4cG9ydCBMRF9MSUJSQVJZX1BBVEg9JExE"
|
|
"X0xJQlJBUllfUEFUSDoiJFNDUklQVF9ESVIiCiIkU0NSSVBUX0RJUi9yZXBsYWNlX3N0ci"
|
|
"IgIiRAIgo=";
|
|
return base64_decode(s);
|
|
}
|
|
|
|
std::string CResource::getDesktopTemplate()
|
|
{
|
|
std::string s =
|
|
"W0Rlc2t0b3AgRW50cnldCk5hbWU9cmVfbmFtZQpDb21tZW50PXJlX2Rlc2NyaWJlCkV4ZW"
|
|
"M9cmVfcGF0aApJY29uPXJlX2ljb24KVGVybWluYWw9ZmFsc2UKVHlwZT1BcHBsaWNhdGlv"
|
|
"bgpDYXRlZ29yaWVzPXJlX2NhdGVnb3J5Owo=";
|
|
return base64_decode(s);
|
|
}
|