.data .equ socket_call, 102 .equ socket_call_socket, 0x1 .equ AF_INET, 2 .equ SOCK_STREAM, 1 .equ IPPROTO_TCP, 6 .equ port, 25 /* htons(6400) */ .equ addr, 0x0100007f /* localhost */ .bss .lcomm sock, 10 .lcomm len, 10 /* struct hostent */ .equ struct_hostent, 0 .lcomm h_name, 4 .lcomm h_aliases, 4 .lcomm h_addrtype, 4 .lcomm h_lenght, 4 .lcomm h_addr_list, 4 .equ h_addr, h_addr_list .equ hostent_len, .-struct_hostent /* struct sock_addr_in */ .equ struct_sock_addr_in, 0 .lcomm sin_family, 4 .lcomm sin_port, 4 .lcomm sin_addr, 4 # sruct sin_addr.s_addr .lcomm sin_zero, 2 # padding .equ sock_addr_in_len, .-struct_sock_addr_in .text .globl _start _start: nop subl $0x20,%esp movl $socket_call,%eax movl $socket_call_socket, %ebx movl $AF_INET,(%esp) movl $SOCK_STREAM,0x4(%esp) movl $IPPROTO_TCP,0x8(%esp) movl %esp,%ecx int $0x80 movl %eax, sock # save socket movl $1, %eax movl $0, %ebx int $0x80