Ky eshte boti IRC me i vogel qe une kam pare. Hidhini nje sy megjithese IRC eshte nje humbje kohe e madhe per mendimin tim. Por jam i sigurt se shume nga ju merren me kete pune prndaj ja ju e keni...gezojuni dhe modifikojeni...lol
Bye


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; aIRCBot 1.0 by iken ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; .FiRST: 23/01/2001 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; .LaST: 23/10/2001 (release only) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; .uRL: http://acipton.cjb.net/ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; .eMaiL: acipton@lacasilla.com.ar ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;

.386
.model flat, stdcall
option casemap :none ; case sensitive

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\wsock32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\wsock32.lib

.data?
vwsadata WSADATA <>
sckt_handle dd ?
socadd sockaddr_in <>
available_data dd ?
hMemory dd ?
buffer dd ?
actual_data_read dd ?
IP dd ? ; defino a mano los 16 bytes que necesito
dd ?
dd ?
dd ?

.code

aIRCBot:
push offset szKernel32
call GetModuleHandleA

push offset szRegServProc
push eax
call GetProcAddress

push 1
push 0
call eax

call GetCommandLine
ea:
inc eax
cmp byte ptr [eax],' '
jnz ea
inc eax
push eax
push offset IP
call lstrcpy

mov ebx,101h ; VERSION1_1

push offset vwsadata ; altamente optimizado
push ebx ; ebx no se modifica al retornar
call WSAStartup ; de la llamada a WSAStartup

cmp bx,word ptr [vwsadata.wVersion]
jne error

push 0
push SOCK_STREAM
push AF_INET
call socket
cmp eax,-1
je error
mov sckt_handle,eax

mov ax,AF_INET
mov socadd.sin_family,ax
push 6667 ; port
call htons
mov socadd.sin_port,ax
push offset IP
call inet_addr
mov socadd.sin_addr,eax
push 16
push offset socadd
push [sckt_handle]
call connect
cmp ax,-1
je fail
push 0
push sizeof msgNick+sizeof msgUser
push offset msgNick
push [sckt_handle]
call send
cmp ax,-1
je fail
for_ever:
push 10000 ; a no agoviar el procesador, palmamos 10 segs
call Sleep

push offset available_data
push FIONREAD
push [sckt_handle]
call ioctlsocket
cmp eax,0
jnz for_ever
invoke GlobalAlloc,GHND,available_data ; el invoke nada mas
mov hMemory,eax ; que para el tema de la peticion de memoria
invoke GlobalLock,eax ; simplemente para ocupar menos lineas
mov buffer,eax

push 0
push available_data
push buffer
push [sckt_handle]
call recv
mov actual_data_read,eax
cmp eax,0
jz for_ever

mov esi,buffer
cmp word ptr [esi],'IP' ; PING ?
jnz parsear
push 0
push sizeof msgPONG
push offset msgPONG
push [sckt_handle]
call send ; PONG !
jmp seguir
parsear:
mov edi,[buffer]
mov edx,edi
add edx,actual_data_read
next:
cmp edi,edx
jz seguir
inc edi
cmp word ptr [edi],'Q>' ; >Q comando quit
jz quit
cmp word ptr [edi],'R>' ; >R comando raw
jnz next
inc edi
inc edi
sub edx,edi
push 0
push edx
push edi
push [sckt_handle]
call send ; escribe al server
seguir:
invoke GlobalUnlock,buffer
invoke GlobalFree,hMemory
jmp for_ever

quit:
push 0
push sizeof msgQuit
push offset msgQuit
push [sckt_handle]
call send
pop ebx ; beh... prolijidad..................

fail:
push [sckt_handle]
call closesocket

push MB_OK
push offset dlgTitle
push offset dlgMsg
push 0
call MessageBox ; a-vi-saaa...

error:
call WSACleanup

push 0
call ExitProcess

dlgTitle db "aIRCBot 1.0",0
dlgMsg db "uRL: http://acipton.cjb.net/",10,13
db "eMaiL: acipton@lacasilla.com.ar",10,13
db "CoDeD By: iken",10,13
db "DaTe: 23/01/2001",10,13
db "SiZe: 2560 bytes (Smallest Binary IRC Bot for Windows)",10,13
db "SiNTaX: aIRCBot.exe ",10,13
db "CoMMaNDS: >R,>Q",0

msgNick db "nick aIRCBot",10,13
msgUser db "user Coded_by_iken iken acipton@lacasilla.com.ar http://acipton.cjb.net/",10,13
msgQuit db "quit :aIRCBot 1.0 by iken - http://acipton.cjb.net/",10,13
msgPONG db "PONG",10,13

szKernel32 db 'KERNEL32',0
szRegServProc db 'RegisterServiceProcess',0

end aIRCBot