Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim ua
- ua = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0"
- Dim url, headers
- url = "http://192.168.100.1/asp/GetRandCount.asp"
- headers = Array(_
- Array("User-Agent", ua)_
- )
- Dim token
- httpRequest "POST", url, headers, "", "", token
- MsgBox "GetRandCount token = " & token
- url = "http://192.168.100.1/login.cgi"
- headers = Array(_
- Array("User-Agent", ua),_
- Array("Content-Type", "application/x-www-form-urlencoded"),_
- Array("Cookie", "Cookie=body:Language:english:id=-1")_
- )
- Dim payload
- payload = "UserName=telecomadmin&PassWord=YWRtaW50ZWxlY29t&x.X_HW_Token=" & token
- Dim respHeaders, respText
- httpRequest "POST", url, headers, payload, respHeaders, respText
- Dim cookies
- parseResponse "^Set-Cookie: (\S*?=\S*?);[\s\S]*?$", respHeaders, cookies
- MsgBox "cookie = " & cookies(0)
- Dim urlCpx
- urlCpx = "http://192.168.100.1/html/bbsp/wan/complex.cgi?y=InternetGatewayDevice.WANDevice.1.WANConnectionDevice.4.WANPPPConnection.1&n=InternetGatewayDevice.WANDevice.1.WANConnectionDevice.4.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.1&m=InternetGatewayDevice.WANDevice.1.WANConnectionDevice.4.WANPPPConnection.1.X_HW_IPv6.IPv6Address.1&j=InternetGatewayDevice.WANDevice.1.WANConnectionDevice.4.WANPPPConnection.1&r=InternetGatewayDevice.WANDevice.1.WANConnectionDevice.4.WANPPPConnection.1&RequestFile=html/bbsp/wan/confirmwancfginfo.html"
- Dim headersWan
- headersWan = Array(_
- Array("User-Agent", ua),_
- Array("Referer", urlCpx),_
- Array("Cookie", cookies(0))_
- )
- Dim urlWan
- urlWan = "http://192.168.100.1/html/bbsp/wan/wan.asp"
- Dim headersCpx
- headersCpx = Array(_
- Array("User-Agent", ua),_
- Array("Content-Type", "application/x-www-form-urlencoded"),_
- Array("Referer", urlWan),_
- Array("Cookie", cookies(0))_
- )
- httpRequest "GET", urlWan, headersWan, "", "", respText
- Dim guids
- parseResponse """([0-9a-f]{32})""", respText, guids
- token = guids(0)
- MsgBox "wan.asp X_HW_Token = " & token
- payload = "y.Enable=1&y.X_HW_IPv4Enable=1&y.X_HW_IPv6Enable=1&y.X_HW_IPv6MultiCastVLAN=-1&y.X_HW_SERVICELIST=INTERNET&y.X_HW_ExServiceList=&y.X_HW_VLAN=10&y.X_HW_PRI=2&y.X_HW_PriPolicy=Specified&y.X_HW_DefaultPri=0&y.ConnectionType=PPPoE_Bridged&y.X_HW_MultiCastVLAN=4294967295&y.X_HW_BindPhyPortInfo=Lan1%2CLan2%2CLan3%2CSSID1&x.X_HW_Token=" & token"
- httpRequest "POST", urlCpx, headersCpx, payload, "", respText
- MsgBox respText
- httpRequest "GET", urlWan, headersWan, "", "", respText
- parseResponse """([0-9a-f]{32})""", respText, guids
- token = guids(0)
- MsgBox "wan.asp X_HW_Token = " & token
- payload = "y.Enable=1&y.X_HW_IPv4Enable=1&y.X_HW_IPv6Enable=1&y.X_HW_IPv6MultiCastVLAN=-1&y.X_HW_SERVICELIST=INTERNET&y.X_HW_ExServiceList=&y.X_HW_VLAN=10&y.X_HW_PRI=2&y.X_HW_PriPolicy=Specified&y.X_HW_DefaultPri=0&y.ConnectionType=IP_Routed&y.X_HW_MultiCastVLAN=4294967295&y.NATEnabled=1&y.X_HW_NatType=0&y.Username=1234500993121121%40beltel.by&y.Password=PASSWORDPPOE123&y.X_HW_LcpEchoReqCheck=0&y.DNSEnabled=1&y.MaxMRUSize=1492&y.X_HW_BindPhyPortInfo=Lan1%2CLan2%2CLan3%2CSSID1&m.Alias=&m.Origin=None&m.IPAddress=&m.ChildPrefixBits=&m.AddrMaskLen=0&m.DefaultGateway=&n.Alias=&n.Origin=PrefixDelegation&n.Prefix=&x.X_HW_Token=" & token"
- httpRequest "POST", urlCpx, headersCpx, payload, "", respText
- MsgBox respText
- MsgBox "Completed"
- Sub httpRequest(method, url, setHeaders, payload, respHeaders, respText)
- Dim header
- With CreateObject("MSXML2.ServerXMLHTTP.6.0")
- .Open method, url, False
- For Each header In setHeaders
- .SetRequestHeader header(0), header(1)
- Next
- .Send payload
- respHeaders = .GetAllResponseHeaders
- respText = .ResponseText
- End With
- End Sub
- Sub parseResponse(pattern, resp, data)
- Dim match, tmp, subMatch
- data = Array()
- With CreateObject("VBScript.RegExp")
- .Global = True
- .MultiLine = True
- .Pattern = pattern
- For Each match In .Execute(resp)
- If match.SubMatches.Count = 1 Then
- pushItem data, match.SubMatches(0)
- Else
- tmp = Array()
- For Each subMatch In match.SubMatches
- pushItem tmp, subMatch
- Next
- pushItem data, tmp
- End If
- Next
- End With
- End Sub
- Sub pushItem(arr, elt)
- ReDim Preserve arr(UBound(arr) + 1)
- arr(UBound(arr)) = elt
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement