.586 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\include\masm32.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc include \masm32\include\msvcrt.inc include \masm32\include\ws2_32.inc includelib \masm32\lib\masm32.lib includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib includelib \masm32\lib\msvcrt.lib includelib \masm32\lib\ws2_32.lib .data? wsadata WSADATA <> pOutText dd ? hSocket dd ? sin sockaddr_in <> exFlg dd ? szStrBuff db 100 dup (?) strSize dd ? .data targetIp db "www.wasm.ru", 0 szTemplate db "%s",0dh, 0ah,0 szWhois db 'whois.arin.net',0 szError db "Error ",0 szrefer db "ReferralServer",0 szerwe db "whois://",0 portc dd 43 .code start: invoke WSAStartup, 202h,addr wsadata invoke gethostbyname, addr targetIp .if eax != 0 mov eax, [eax+0Ch] mov eax, [eax] mov eax, [eax] mov sin.sin_addr, eax .else jmp @@EXITf .endif invoke inet_ntoa, eax invoke wsprintfA, addr szStrBuff, addr szTemplate, eax ;addr targetIp mov strSize, eax invoke malloc, 4000 mov pOutText, eax lea edi, szWhois @@begin: invoke socket, AF_INET, SOCK_STREAM, 0 .if eax != -1 mov hSocket, eax mov sin.sin_family, AF_INET invoke htons, portc mov sin.sin_port,ax invoke gethostbyname, edi .if eax != 0 mov eax, [eax+0Ch] mov eax, [eax] mov eax, [eax] mov sin.sin_addr, eax .else jmp @@EXITf .endif .endif invoke connect, hSocket, addr sin, sizeof sin .if eax != -1 invoke send, hSocket, addr szStrBuff, strSize, 0 .if eax == -1 jmp @@EXITf .endif mov esi, pOutText invoke memfill, pOutText, 1000, 0 .while (1) invoke recv, hSocket, esi, 1000, 0 .if (eax != -1) && (eax!= 0) add esi, eax .else .break .endif .endw invoke InString, 1, pOutText, addr szrefer .if eax == 0 mov exFlg, 1 .endif .else jmp @@EXITf .endif .if exFlg != 1 invoke InString, 1, pOutText, addr szerwe dec eax mov edi, pOutText add eax, edi add eax, sizeof szerwe-1 mov ecx, eax mov edi, eax xor edx, edx .while (1) .if byte ptr [ecx] == 20h mov [ecx], byte ptr 0 .break .endif .if byte ptr [ecx] == ':' mov [ecx], byte ptr 0 inc ecx mov edx, ecx .while (1) .if byte ptr [ecx] == 0ah mov [ecx], byte ptr 0 .break .endif .if byte ptr [ecx] == 0dh mov [ecx], byte ptr 0 .break .endif .if byte ptr [ecx] == 20h mov [ecx], byte ptr 0 .break .endif inc ecx .endw invoke atoi, edx mov portc, eax .break .endif .if byte ptr [ecx] == 0ah mov [ecx], byte ptr 0 .break .endif .if byte ptr [ecx] == 0dh mov [ecx], byte ptr 0 .break .endif inc ecx .endw invoke closesocket, hSocket jmp @@begin .endif @@EXITf: .if exFlg == 1 invoke MessageBox, 0, pOutText, addr targetIp, 0 .else invoke MessageBox, 0, addr szError, addr targetIp, 0 .endif invoke free, pOutText invoke closesocket, hSocket invoke ExitProcess, 0 ;############################################################## end start