The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: Farabi on June 04, 2010, 01:43:38 AM

Title: IP tracking
Post by: Farabi on June 04, 2010, 01:43:38 AM
I know this is trivial but sometime it could be usefull.


fInetSendData proc uses esi edi lpWebAddress:dword,lpObjectPage:dword,lpData:dword,nData:dword
LOCAL hOpen,hCon,hReq,brcv:dword
LOCAL filesz,mem_handle:dword
LOCAL buff[256]:dword
LOCAL buff2[256]:dword
LOCAL ibf :INTERNET_BUFFERS
LOCAL m:dword
LOCAL f:fInetData
LOCAL data,fsz,fl:dword


invoke InternetOpen,CADD("Farabi"),INTERNET_OPEN_TYPE_PRECONFIG,0,0,0
mov hOpen,eax
.if eax==0
invoke MessageBox,0,CADD("InternetOpen Failed"),0,0
invoke PostQuitMessage,0
.endif

invoke InternetConnect,hOpen,lpWebAddress,INTERNET_DEFAULT_HTTP_PORT,0,0,INTERNET_SERVICE_HTTP,0,1
.if eax==0
invoke MessageBox,0,CADD("InternetConnect"),0,0
invoke PostQuitMessage,0
.endif
mov hCon,eax
invoke HttpOpenRequest,hCon,CADD("POST"),lpObjectPage,CADD("HTTP/1.1"),CADD("Farabi Poll Application"),0,0,1
.if eax==0
invoke MessageBox,0,CADD("HttpOpenRequest Failed"),0,0
invoke PostQuitMessage,0
.endif
mov hReq,eax



invoke HttpSendRequest,hReq,CADD("Content-Type: application/x-www-form-urlencoded"),-1,lpData,nData
.if eax==0
invoke MessageBox,0,CADD("Send request failed"),0,0
.endif

invoke memfill,addr buff,1024,0
invoke InternetReadFile,hReq,addr buff,1024,addr filesz
invoke MessageBox,0,addr buff,0,0

;invoke HttpEndRequest,hReq,0,0,0


invoke InternetCloseHandle,hCon
invoke InternetCloseHandle,hOpen
invoke InternetCloseHandle,hReq



ret
fInetSendData endp


Use it like this

invoke fInetSendData,CADD("www.ip-adress.com"),CADD('/ip_tracer/'),CADD("QRY=125.166.168.32"),18


The data sent back to you will tell you every info they got from the IP you put. You can modify above code for you convenient.