Jump to content
Sign in to follow this  
DeltaRocked

Winhttp UDF Help

Recommended Posts

DeltaRocked

Hi all,

I have been searching for quite some time and unable to find the following

1: the entire source of winhttpsimplereaddataasync

The partial code is enclosed in this post

Func __WinHttpConnect($ldomain, $lpath, $lport)

Local $sChunk, $sResponseHeader, $temp_array
$pBufferAsync = DllStructGetPtr($tBufferAsync)
$hWINHTTP_STATUS_CALLBACK = DllCallbackRegister("__WINHTTP_STATUS_CALLBACK", "none", "handle;dword_ptr;dword;ptr;dword")
;Add Proxy detect and use code
Local $arr = _WinHttpGetIEProxyConfigForCurrentUser()
If $arr[2] <> '' Then
;
;~ Mozilla/5.0 (Windows NT 5.2; rv:14.0) Gecko/20100101 Firefox/14.0.1
;~ Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.15 (KHTML, like Gecko) Chrome/24.0.1295.0 Safari/537.15
$hOpen = _WinHttpOpen('Mozilla/5.0 (Windows NT 5.2; rv:14.0) Gecko/20100101 Firefox/14.0.1', $WINHTTP_ACCESS_TYPE_NAMED_PROXY, $arr[2])
Else
$hOpen = _WinHttpOpen('Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.15 (KHTML, like Gecko) Chrome/24.0.1295.0 Safari/537.15')
EndIf

If @error Then
__CWriteRes("Error initializing the usage of WinHTTP functions." & @CRLF)
__WinhttpClose()
FileWriteLine('..\error.log', $F_url) ;& @CRLF & 'result=' & $result_log)
;~ Exit 1
EndIf

_WinHttpSetTimeouts($hOpen, 5000, 5000, 5000, 5000)
_WinHttpSetStatusCallback($hOpen, $hWINHTTP_STATUS_CALLBACK)
If $lport <> 443 Then
$hConnect = _WinHttpConnect($hOpen, $ldomain, $lport)
Else
$hConnect = _WinHttpConnect($hOpen, $ldomain) ;, $lport)
EndIf
If @error Then
__CWriteRes("Error specifying the initial target server of an HTTP request." & @CRLF)
__WinhttpClose()
FileWriteLine('..\error.log', $F_url) ;& @CRLF & 'result=' & $result_log)
Return
;~ Exit 2
EndIf
$hRequest = _WinHttpOpenRequest($hConnect, 'Get', $lpath) ;path
If @error Then
__CWriteRes("Error creating an HTTP request handle." & @CRLF)
__WinhttpClose()
FileWriteLine('..\error.log', $F_url) ;& @CRLF & 'result=' & $result_log)
Return
;~ Exit 3
EndIf
_WinHttpAddRequestHeaders($hRequest, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
_WinHttpAddRequestHeaders($hRequest, "Accept-Language: en-us;q=0.5")
_WinHttpAddRequestHeaders($hRequest, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7")
_WinHttpAddRequestHeaders($hRequest, "Keep-Alive: 115")
;~ _WinHttpAddRequestHeaders($hRequest, "Accept-Encoding: gzip, deflate")
_WinHttpAddRequestHeaders($hRequest, "Connection: keep-alive")
_WinHttpSendRequest($hRequest)
If @error Then
__CWriteRes("Error sending specified request." & @CRLF)
__WinhttpClose()
FileWriteLine('..\error.log', $F_url) ;& @CRLF & 'result=' & $result_log)
Return
;~ Exit 4
EndIf
_WinHttpReceiveResponse($hRequest)
If @error Then
__CWriteRes("Error waiting for the response from the server." & @CRLF)
__WinhttpClose()
FileWriteLine('..\error.log', $F_url) ;& @CRLF & 'result=' & $result_log)
Return
;~ Exit 5
EndIf
$sResponseHeader = _WinHttpQueryHeaders($hRequest)
;~ __CWriteRes($sResponseHeader & @CRLF)
;~ ConsoleWrite($sResponseHeader & @CRLF)
If StringInStr($sResponseHeader, 'refresh:', 2) <> 0 Then
Local $ResponseINI = IniRead('phish_reg.ini', 'reg', 'response', '')
Local $Response_array = StringRegExp($sResponseHeader, $ResponseINI, 3)
$count_server += 1
;~ _ArrayDisplay($Response_array)
;~ $Response_array[0]=abrel('http://'&$ldomain&$lpath,$Response_array[0])
$temp_array = __WinCrackUrl($Response_array[0])
$domain = $temp_array[2]
$path = $temp_array[6] & $temp_array[7]
$browser_domain = $domain
__CWriteRes('Response Header Redirecting to: ' & $Response_array[0] & @CRLF)
;STOP DBUG
__WinHttpConnect($temp_array[2], $temp_array[6] & $temp_array[7], $temp_array[3])
;START DBUG
Return
;Refresh: 0;url=http://www.zealcomcapital.com/power-welcome/
EndIf
If _WinHttpQueryDataAvailable($hRequest) Then
$sData &= @CRLF & '*****' & @CRLF & $ldomain & $lpath & @CRLF & '*****' & @CRLF
While 1
$sChunk = _WinHttpReadData($hRequest)
If @error Then ExitLoop
$sData &= $sChunk
$sChunk = ''
WEnd
__WinhttpClose()
Return ;$sData
Else
__WinhttpClose()
__CWriteRes("Site is experiencing problems.")
FileWriteLine('..\error.log', $F_url) ;& @CRLF & 'result=' & $result_log)
Return
;~ Exit 6
EndIf
EndFunc ;==>__WinHttpConnect

2: asycread using SSL .

I had seen it somewhere in the forums but now unable to find it . if someone has the link please post it over here.

thanks in advance

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×