@@ -1137,7 +1137,7 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
1137
1137
$sCredName = $aStrSplit [0 ]
1138
1138
$sCredPass = $aStrSplit [1 ]
1139
1139
EndIf
1140
- $sAdditionalHeaders = StringReplace ($sAdditionalHeaders , $aCred [0 ], " " , 1 )
1140
+ $sAdditionalHeaders = StringReplace ($sAdditionalHeaders , $aCred [0 ], " " , 1 , 0 )
1141
1141
EndIf
1142
1142
EndIf
1143
1143
; Get page source
@@ -1218,7 +1218,7 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
1218
1218
$sMethod = __WinHttpAttribVal($sAttributes , " method" )
1219
1219
; Requested form is found. Set $fSend flag to true
1220
1220
$fSend = True
1221
- $sHTML = StringReplace ($sHTML , $sForm , " >" )
1221
+ $sHTML = StringReplace ($sHTML , $sForm , " >" , 0 , 1 )
1222
1222
Local $sSpr1 = Chr (27 ), $sSpr2 = Chr (26 )
1223
1223
__WinHttpNormalizeForm($sForm , $sSpr1 , $sSpr2 )
1224
1224
$aInput = StringRegExp ($sForm , " (?si)<\h*(?:input|textarea|label|fieldset|legend|select|optgroup|option|button)\h*(.*?)/*\h*>" , 3 )
@@ -1241,8 +1241,8 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
1241
1241
For $i = 0 To UBound ($aInput ) - 1 ; for all input elements
1242
1242
__WinHttpFormAttrib($aInputIds , $i , $aInput [$i ])
1243
1243
If $aInputIds [1 ][$i ] Then ; if there is 'name' field then add it
1244
- $aInputIds [1 ][$i ] = __WinHttpURLEncode(StringReplace ($aInputIds [1 ][$i ], $sSpr1 , " " ), $sEnctype )
1245
- $aInputIds [2 ][$i ] = __WinHttpURLEncode(StringReplace (StringReplace ($aInputIds [2 ][$i ], $sSpr2 , " >" ), $sSpr1 , " " ), $sEnctype )
1244
+ $aInputIds [1 ][$i ] = __WinHttpURLEncode(StringReplace ($aInputIds [1 ][$i ], $sSpr1 , " " , 0 , 1 ), $sEnctype )
1245
+ $aInputIds [2 ][$i ] = __WinHttpURLEncode(StringReplace (StringReplace ($aInputIds [2 ][$i ], $sSpr2 , " >" , 0 , 1 ), $sSpr1 , " " , 0 , 1 ), $sEnctype )
1246
1246
$sAddData &= $aInputIds [1 ][$i ] & " =" & $aInputIds [2 ][$i ] & " &"
1247
1247
If $aInputIds [3 ][$i ] = " submit" Then $sSubmit &= $aInputIds [1 ][$i ] & " =" & $aInputIds [2 ][$i ] & $sGrSep ; add to overall "submit" string
1248
1248
If $aInputIds [3 ][$i ] = " radio" Then $sRadio &= $aInputIds [1 ][$i ] & " =" & $aInputIds [2 ][$i ] & $sGrSep ; add to overall "radio" string
@@ -1288,12 +1288,12 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
1288
1288
If $sPassedData = $aInputIds [2 ][$j ] Then
1289
1289
For $sChunkSub In StringSplit ($sRadio , $sGrSep , 3 ) ; go tru all "radio" controls
1290
1290
If $sChunkSub == $aInputIds [1 ][$j ] & " =" & $sPassedData Then
1291
- $sAddData = StringRegExpReplace (StringReplace ($sAddData , " &" , " &&" ), " (?:&|\A)\Q" & $aInputIds [1 ][$j ] & " \E(.*?)(?:&|\Z)" , " &" )
1292
- $sAddData = StringReplace (StringReplace ($sAddData , " &&" , " &" ), " &&" , " &" )
1291
+ $sAddData = StringRegExpReplace (StringReplace ($sAddData , " &" , " &&" , 0 , 1 ), " (?:&|\A)\Q" & $aInputIds [1 ][$j ] & " \E(.*?)(?:&|\Z)" , " &" )
1292
+ $sAddData = StringReplace (StringReplace ($sAddData , " &&" , " &" , 0 , 1 ), " &&" , " &" , 0 , 1 )
1293
1293
If StringLeft ($sAddData , 1 ) = " &" Then $sAddData = StringTrimLeft ($sAddData , 1 )
1294
1294
$sAddData &= " &" & $sChunkSub
1295
- $sRadio = StringRegExpReplace (StringReplace ($sRadio , $sGrSep , $sGrSep & $sGrSep ), " (?:" & $sGrSep & " |\A)\Q" & $aInputIds [1 ][$j ] & " \E(.*?)(?:" & $sGrSep & " |\Z)" , $sGrSep )
1296
- $sRadio = StringReplace (StringReplace ($sRadio , $sGrSep & $sGrSep , $sGrSep ), $sGrSep & $sGrSep , $sGrSep )
1295
+ $sRadio = StringRegExpReplace (StringReplace ($sRadio , $sGrSep , $sGrSep & $sGrSep , 0 , 1 ), " (?:" & $sGrSep & " |\A)\Q" & $aInputIds [1 ][$j ] & " \E(.*?)(?:" & $sGrSep & " |\Z)" , $sGrSep )
1296
+ $sRadio = StringReplace (StringReplace ($sRadio , $sGrSep & $sGrSep , $sGrSep , 0 , 1 ), $sGrSep & $sGrSep , $sGrSep , 0 , 1 )
1297
1297
EndIf
1298
1298
Next
1299
1299
EndIf
@@ -1304,9 +1304,9 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
1304
1304
$sButton = StringRegExpReplace ($sButton , " \Q" & $aInputIds [1 ][$j ] & " =" & $sPassedData & " \E" & $sGrSep & " *" , " " )
1305
1305
__WinHttpTrimBounds($sButton , $sGrSep )
1306
1306
Else
1307
- $sAddData = StringRegExpReplace (StringReplace ($sAddData , " &" , " &&" ), " (?:&|\A)\Q" & $aInputIds [1 ][$j ] & " =" & $aInputIds [2 ][$j ] & " \E(?:&|\Z)" , " &" & $aInputIds [1 ][$j ] & " =" & $sPassedData & " &" )
1307
+ $sAddData = StringRegExpReplace (StringReplace ($sAddData , " &" , " &&" , 0 , 1 ), " (?:&|\A)\Q" & $aInputIds [1 ][$j ] & " =" & $aInputIds [2 ][$j ] & " \E(?:&|\Z)" , " &" & $aInputIds [1 ][$j ] & " =" & $sPassedData & " &" )
1308
1308
$iNumRepl = @extended
1309
- $sAddData = StringReplace ($sAddData , " &&" , " &" )
1309
+ $sAddData = StringReplace ($sAddData , " &&" , " &" , 0 , 1 )
1310
1310
If $iNumRepl > 1 Then ; equalize ; TODO: remove duplicates
1311
1311
$sAddData = StringRegExpReplace ($sAddData , " (?:&|\A)\Q" & $aInputIds [1 ][$j ] & " \E=.*?(?:&|\Z)" , " &" , $iNumRepl - 1 )
1312
1312
EndIf
@@ -1340,11 +1340,11 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
1340
1340
ElseIf $aInputIds [1 ][$j ] == $aSplit [1 ] And $aInputIds [3 ][$j ] = " radio" Then
1341
1341
For $sChunkSub In StringSplit ($sRadio , $sGrSep , 3 ) ; go tru all "radio" controls
1342
1342
If $sChunkSub == $aInputIds [1 ][$j ] & " =" & $sPassedData Then
1343
- $sAddData = StringReplace (StringReplace (StringRegExpReplace (StringReplace ($sAddData , " &" , " &&" ), " (?:&|\A)\Q" & $aInputIds [1 ][$j ] & " \E(.*?)(?:&|\Z)" , " &" ), " &&" , " &" ), " &&" , " &" )
1343
+ $sAddData = StringReplace (StringReplace (StringRegExpReplace (StringReplace ($sAddData , " &" , " &&" , 0 , 1 ), " (?:&|\A)\Q" & $aInputIds [1 ][$j ] & " \E(.*?)(?:&|\Z)" , " &" ), " &&" , " &" , 0 , 1 ), " &&" , " &" , 0 , 1 )
1344
1344
If StringLeft ($sAddData , 1 ) = " &" Then $sAddData = StringTrimLeft ($sAddData , 1 )
1345
1345
$sAddData &= " &" & $sChunkSub
1346
- $sRadio = StringRegExpReplace (StringReplace ($sRadio , $sGrSep , $sGrSep & $sGrSep ), " (?:" & $sGrSep & " |\A)\Q" & $aInputIds [1 ][$j ] & " \E(.*?)(?:" & $sGrSep & " |\Z)" , $sGrSep )
1347
- $sRadio = StringReplace (StringReplace ($sRadio , $sGrSep & $sGrSep , $sGrSep ), $sGrSep & $sGrSep , $sGrSep )
1346
+ $sRadio = StringRegExpReplace (StringReplace ($sRadio , $sGrSep , $sGrSep & $sGrSep , 0 , 1 ), " (?:" & $sGrSep & " |\A)\Q" & $aInputIds [1 ][$j ] & " \E(.*?)(?:" & $sGrSep & " |\Z)" , $sGrSep )
1347
+ $sRadio = StringReplace (StringReplace ($sRadio , $sGrSep & $sGrSep , $sGrSep , 0 , 1 ), $sGrSep & $sGrSep , $sGrSep , 0 , 1 )
1348
1348
EndIf
1349
1349
Next
1350
1350
ContinueLoop 2 ; process next parameter
@@ -1358,9 +1358,9 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
1358
1358
ContinueLoop 2 ; process next parameter
1359
1359
EndIf
1360
1360
Next
1361
- $sAddData = StringRegExpReplace (StringReplace ($sAddData , " &" , " &&" ), " (?:&|\A)\Q" & $aSplit [1 ] & " \E=.*?(?:&|\Z)" , " &" & $aSplit [1 ] & " =" & $sPassedData & " &" )
1361
+ $sAddData = StringRegExpReplace (StringReplace ($sAddData , " &" , " &&" , 0 , 1 ), " (?:&|\A)\Q" & $aSplit [1 ] & " \E=.*?(?:&|\Z)" , " &" & $aSplit [1 ] & " =" & $sPassedData & " &" )
1362
1362
$iNumRepl = @extended
1363
- $sAddData = StringReplace ($sAddData , " &&" , " &" )
1363
+ $sAddData = StringReplace ($sAddData , " &&" , " &" , 0 , 1 )
1364
1364
If $iNumRepl > 1 Then ; remove duplicates
1365
1365
$sAddData = StringRegExpReplace ($sAddData , " (?:&|\A)\Q" & $aSplit [1 ] & " \E=.*?(?:&|\Z)" , " &" , $iNumRepl - 1 )
1366
1366
EndIf
@@ -1381,8 +1381,8 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
1381
1381
For $i = 0 To UBound ($aInput ) - 1 ; for all input elements
1382
1382
__WinHttpFormAttrib($aInputIds , $i , $aInput [$i ])
1383
1383
If $aInputIds [1 ][$i ] Then ; if there is 'name' field
1384
- $aInputIds [1 ][$i ] = StringReplace ($aInputIds [1 ][$i ], $sSpr1 , " " )
1385
- $aInputIds [2 ][$i ] = StringReplace (StringReplace ($aInputIds [2 ][$i ], $sSpr2 , " >" ), $sSpr1 , " " )
1384
+ $aInputIds [1 ][$i ] = StringReplace ($aInputIds [1 ][$i ], $sSpr1 , " " , 0 , 1 )
1385
+ $aInputIds [2 ][$i ] = StringReplace (StringReplace ($aInputIds [2 ][$i ], $sSpr2 , " >" , 0 , 1 ), $sSpr1 , " " , 0 , 1 )
1386
1386
If $aInputIds [3 ][$i ] = " file" Then
1387
1387
$sAddData &= " --" & $sBoundary & @CRLF & _
1388
1388
$sCDisp & $aInputIds [1 ][$i ] & ' "; filename=""' & @CRLF & @CRLF & _
@@ -1525,7 +1525,7 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
1525
1525
EndIf
1526
1526
Next
1527
1527
$sAddData = StringRegExpReplace ($sAddData , ' (?s)\Q' & $sCDisp & $aSplit [1 ] & ' "' & ' \E\r\n\r\n.*?\r\n' , _
1528
- $sCDisp & $aSplit [1 ] & ' "' & @CRLF & @CRLF & StringReplace ($sPassedData , " \" , " \\" ) & @CRLF )
1528
+ $sCDisp & $aSplit [1 ] & ' "' & @CRLF & @CRLF & StringReplace ($sPassedData , " \" , " \\" , 0 , 1 ) & @CRLF )
1529
1529
$iNumRepl = @extended
1530
1530
If $iNumRepl > 1 Then ; remove duplicates
1531
1531
$sAddData = StringRegExpReplace ($sAddData , ' (?s)\Q--' & $sBoundary & @CRLF & $sCDisp & $aSplit [1 ] & ' "' & ' \E\r\n\r\n.*?\r\n' , " " , $iNumRepl - 1 )
@@ -2038,7 +2038,7 @@ EndFunc
2038
2038
Func __WinHttpURLEncode($vData , $sEncType = " " )
2039
2039
If IsBool ($vData ) Then Return $vData
2040
2040
$vData = __WinHttpHTMLDecode($vData )
2041
- If $sEnctype = " text/plain" Then Return StringReplace ($vData , " " , " +" )
2041
+ If $sEnctype = " text/plain" Then Return StringReplace ($vData , " " , " +" , 0 , 1 )
2042
2042
Local $aData = StringToASCIIArray ($vData , Default , Default , 2 )
2043
2043
Local $sOut
2044
2044
For $i = 0 To UBound ($aData ) - 1
@@ -2055,7 +2055,7 @@ Func __WinHttpURLEncode($vData, $sEncType = "")
2055
2055
EndFunc
2056
2056
2057
2057
Func __WinHttpHTMLDecode($vData )
2058
- Return StringReplace (StringReplace (StringReplace (StringReplace (StringReplace ($vData , " '" , " '" ), " &" , " &" ), " <" , " <" ), " >" , " >" ), " "" , ' "' )
2058
+ Return StringReplace (StringReplace (StringReplace (StringReplace (StringReplace ($vData , " '" , " '" , 0 , 1 ), " &" , " &" , 0 , 1 ), " <" , " <" , 0 , 1 ), " >" , " >" , 0 , 1 ), " "" , ' "' , 0 , 1 )
2059
2059
EndFunc
2060
2060
2061
2061
Func __WinHttpNormalizeActionURL($sActionPage , ByRef $sAction , ByRef $iScheme , ByRef $sNewURL , ByRef $sEnctype , ByRef $sMethod , ByRef $sReferer , $sURL = " " )
@@ -2080,7 +2080,7 @@ Func __WinHttpNormalizeActionURL($sActionPage, ByRef $sAction, ByRef $iScheme, B
2080
2080
$sAction = $aCrackURL [6 ] & $sAction
2081
2081
EndIf
2082
2082
ElseIf StringLeft ($sAction , 1 ) = " #" Then
2083
- $sAction = StringReplace ($sActionPage , StringRegExpReplace ($sActionPage , " (.*?)(#.*?)" , " $2" ), $sAction )
2083
+ $sAction = StringReplace ($sActionPage , StringRegExpReplace ($sActionPage , " (.*?)(#.*?)" , " $2" ), $sAction , 0 , 1 )
2084
2084
ElseIf StringLeft ($sAction , 1 ) = " /" Then
2085
2085
$aCrackURL = _WinHttpCrackUrl($sURL )
2086
2086
If Not @error Then
0 commit comments