...
Code Block | ||
---|---|---|
| ||
lazenca0x0@ubuntu:~/ASM$ gcc -o shellshellcode -fno-stack-protector -z execstack --no-pie -m32 testshellcode.c test.c:5:15: warning: array 'code' assumed to have one element unsigned char code[]; ^ lazenca0x0@ubuntu:~/ASM$ ./shell Shellcode len : 2 Segmentation fault (core dumped) lazenca0x0@ubuntu:~/ASM$ |
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include<stdio.h> #include<string.h> unsigned char shellcode [] = "\xeb\x15\x59\x31\xc0\xb0\x04\x31\xdb\xb3\x01\x31\xd2\xb2\x0f\xcd\x80\xb0\x01\x31\xdb\xcd\x80\xe8\xe6\xff\xff\xffHello, world!\n\r"; unsigned char code[] = ""; void main() { int len = strlen(shellcode); printf("Shellcode len : %d\n",len); strcpy(code,shellcode); (*(void(*)()) code)(); } |
...
Code Block | ||
---|---|---|
| ||
lazenca0x0@ubuntu:~/ASM$ gcc -o shellshellcode2 -fno-stack-protector -z execstack --no-pie -m32 testshellcode2.c lazenca0x0@ubuntu:~/ASM$ ./shellshellcode2 Shellcode len : 43 Hello, world! lazenca0x0@ubuntu:~/ASM$ |
...