Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6c25796

Browse filesBrowse files
committed
now it works
1 parent c0b5e05 commit 6c25796
Copy full SHA for 6c25796

File tree

4 files changed

+20
-12
lines changed
Filter options

4 files changed

+20
-12
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ This script helps automate the shellcode testing process. It takes an Assembly f
66

77
## Usage
88

9-
Shellcoder most probably should be used on Windows because of the MSVC requirement.
9+
Shellcoder script most probably should be used on Windows because of the MSVC requirement.
1010

11-
```powershell
12-
# Run script
13-
python shellcoder.py
14-
```
11+
1. Write your shellcode in `shellcode.asm`
12+
2. Run `python shellcoder.py`
13+
3. Execute output `.exe` file in `out/` directory!
14+
15+
> **IMPORTANT**: Indicate that you are using 64-bit mode at the beginning of the assembly file. Add `[bits 64]` to the `shellcode.asm`.
1516
1617
## External dependencies
1718

‎loader.c

Copy file name to clipboard
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#include <windows.h>
2+
#include <stdio.h>
3+
unsigned char payload[] = ":PAYLOAD:";
4+
unsigned int payload_len = sizeof(payload);
25

36
void main() {
47
void* exec;
@@ -7,12 +10,13 @@ void main() {
710
DWORD oldprotect = 0;
811

912
// Shellcode
10-
unsigned char payload[] = ":PAYLOAD:";
11-
unsigned int payload_len = 205;
1213
exec = VirtualAlloc(0, payload_len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
1314
RtlMoveMemory(exec, payload, payload_len);
1415
rv = VirtualProtect(exec, payload_len, PAGE_EXECUTE_READ, &oldprotect);
16+
17+
printf("[+] Exec...");
1518
th = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)exec, 0, 0, 0);
1619
WaitForSingleObject(th, -1);
20+
printf("[+] End...");
1721

1822
}

‎shellcode.asm

Copy file name to clipboardExpand all lines: shellcode.asm
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
; Compile & get shellcode from Kali:
2-
; nasm -f win64 popcalc.asm -o popcalc.o
3-
; for i in $(objdump -D popcalc.o | grep "^ " | cut -f2); do echo -n "\x$i" ; done
4-
; Get kernel32.dll base address
1+
[bits 64]
2+
53
xor rdi, rdi ; RDI = 0x0
64
mul rdi ; RAX&RDX =0x0
75
mov rbx, gs:[rax+0x60] ; RBX = Address_of_PEB

‎shellcoder.py

Copy file name to clipboardExpand all lines: shellcoder.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
# - NASM (Netwide Assembler)
1717
# - Visual Studio 2022
1818

19+
"""
20+
[ ] Sprawdz czy zwykly shellcode dziala
21+
[ ] Moze NASM trzeba jakos inaczej kompilowac / pobierac?
22+
"""
23+
1924
import subprocess
2025
import os
2126
import sys
@@ -65,7 +70,7 @@ def assert_cmd(cmd: str):
6570

6671
# Compile Assembly
6772
subprocess.run(
68-
["nasm", "-f", "win64", SHELLCODE_INPUT_FILE, "-o", SHELLCODE_OUTPUT_FILE], check=True
73+
["nasm", "-f", "bin", SHELLCODE_INPUT_FILE, "-o", SHELLCODE_OUTPUT_FILE], check=True
6974
)
7075

7176
print(f"[+] NASM: {SHELLCODE_INPUT_FILE} -> {SHELLCODE_OUTPUT_FILE}")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.