Skip to content

Commit 5af6d53

Browse files
committed
readme: Add primitive example and update summary
1 parent 09a4d0c commit 5af6d53

1 file changed

Lines changed: 38 additions & 2 deletions

File tree

README.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
## What is this repo?
66

7-
This repo allows you to concatenate shellcodes, running from different address spaces and links between them.
8-
Each shellcode will ensure the next will run, and will constitute from various primitives.
7+
Allows you to write PIC and fast shellcodes in C! keeping your logic simple, easy to expand, test and maintain.
8+
Shellcodes are seperated to "primitives", each one provides a behavior, and to create a full grown shellcode you can concatenate multiple primitives, or to create one primtives doing all of your logic.
99

1010
Supported architectures:
1111

@@ -15,6 +15,42 @@ Supported architectures:
1515

1616
Adding another architecture is very simple!
1717

18+
## What does this mean?
19+
20+
For example, see our implementation of goto:
21+
22+
```c
23+
void start(void) {
24+
void (*goto_address)() = (void (*)())(GOTO_ADDRESS);
25+
26+
goto_address();
27+
}
28+
```
29+
30+
Our implementation of memcpy:
31+
32+
```c
33+
void __attribute__((noreturn)) start(void) {
34+
u8 *src = (u8 *)MEMCPY_SOURCE_ADDRESS;
35+
u8 *dst = (u8 *)MEMCPY_DEST_ADDRESS;
36+
u32 len = (u32)MEMCPY_LEN;
37+
38+
u8 *end = src + len;
39+
40+
while (src < end - 1) {
41+
*dst = *src;
42+
src++;
43+
dst++;
44+
}
45+
46+
*dst = *src;
47+
48+
__builtin_unreachable();
49+
}
50+
```
51+
52+
Super easy and to write even more complex code!
53+
1854
## Shellcode primitives
1955

2056
- Memcpy (Src Addr, Dst Addr, Len)

0 commit comments

Comments
 (0)