summaryrefslogtreecommitdiffstats
path: root/md/writeup/linux_shellcode.md
blob: ee582f0b5ce5dd18bea99a3bf85aa944ee0c8000 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
title:Linux ShellCode
keywords:linux,shellcode,c,assembler

# Linux ShellCode
First shell code written from example. Shell code is very interesting
way how to execute some code.asm source:

```asm
use32              
xor eax, eax
inc eax
xor ebx, ebx
int 80h
```

```sh
fasm code.asm code.bin
```
bin2hex output:

```text
\x31\xc0\x40\x31\xdb\xcd\x80
```

C source:
```c
#include <stdio.h>
char code[] = "\x31\xc0\x40\x31\xdb\xcd\x80";
int main()
{
  void (*ret)();
  ret = (void (*)())code;
  ret();
  printf("Nope it not working\n");
}
```
```sh
gcc main.c -o main
```
run
```sh
./main
```
nothing happens. That exactly that code do exits from programm



## Downloads
linux_shell_code.zip - 
4KiB - http://archive.main.lv/files/writeup/linux_shellcode_1/linux_shell_code.zip