Advertisement
omegastripes

test.vbs

Mar 26th, 2020
1,506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. Dim ua
  4. ua = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0"
  5. Dim url, headers
  6. url = "http://192.168.100.1/asp/GetRandCount.asp"
  7. headers = Array(_
  8.     Array("User-Agent", ua)_
  9. )
  10. Dim token
  11. httpRequest "POST", url, headers, "", "", token
  12. MsgBox "GetRandCount token = " & token
  13.  
  14.  
  15. url = "http://192.168.100.1/login.cgi"
  16. headers = Array(_
  17.     Array("User-Agent", ua),_
  18.     Array("Content-Type", "application/x-www-form-urlencoded"),_
  19.     Array("Cookie", "Cookie=body:Language:english:id=-1")_
  20. )
  21. Dim payload
  22. payload = "UserName=telecomadmin&PassWord=YWRtaW50ZWxlY29t&x.X_HW_Token=" & token
  23. Dim respHeaders, respText
  24. httpRequest "POST", url, headers, payload, respHeaders, respText
  25. Dim cookies
  26. parseResponse "^Set-Cookie: (\S*?=\S*?);[\s\S]*?$", respHeaders, cookies
  27. MsgBox "cookie = " & cookies(0)
  28.  
  29.  
  30. Dim urlCpx
  31. 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"
  32. Dim headersWan
  33. headersWan = Array(_
  34.     Array("User-Agent", ua),_
  35.     Array("Referer", urlCpx),_
  36.     Array("Cookie", cookies(0))_
  37. )
  38. Dim urlWan
  39. urlWan = "http://192.168.100.1/html/bbsp/wan/wan.asp"
  40. Dim headersCpx
  41. headersCpx = Array(_
  42.     Array("User-Agent", ua),_
  43.     Array("Content-Type", "application/x-www-form-urlencoded"),_
  44.     Array("Referer", urlWan),_
  45.     Array("Cookie", cookies(0))_
  46. )
  47. httpRequest "GET", urlWan, headersWan, "", "", respText
  48. Dim guids
  49. parseResponse """([0-9a-f]{32})""", respText, guids
  50. token = guids(0)
  51. MsgBox "wan.asp X_HW_Token = " & token
  52. 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"
  53. httpRequest "POST", urlCpx, headersCpx, payload, "", respText
  54. MsgBox respText
  55.  
  56.  
  57. httpRequest "GET", urlWan, headersWan, "", "", respText
  58. parseResponse """([0-9a-f]{32})""", respText, guids
  59. token = guids(0)
  60. MsgBox "wan.asp X_HW_Token = " & token
  61. 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"
  62. httpRequest "POST", urlCpx, headersCpx, payload, "", respText
  63. MsgBox respText
  64. MsgBox "Completed"
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Sub httpRequest(method, url, setHeaders, payload, respHeaders, respText)
  71.     Dim header
  72.     With CreateObject("MSXML2.ServerXMLHTTP.6.0")
  73.         .Open method, url, False
  74.         For Each header In setHeaders
  75.             .SetRequestHeader header(0), header(1)
  76.         Next
  77.         .Send payload
  78.         respHeaders = .GetAllResponseHeaders
  79.         respText = .ResponseText
  80.     End With
  81. End Sub
  82.  
  83. Sub parseResponse(pattern, resp, data)
  84.     Dim match, tmp, subMatch
  85.     data = Array()
  86.     With CreateObject("VBScript.RegExp")
  87.         .Global = True
  88.         .MultiLine = True
  89.         .Pattern = pattern
  90.         For Each match In .Execute(resp)
  91.             If match.SubMatches.Count = 1 Then
  92.                 pushItem data, match.SubMatches(0)
  93.             Else
  94.                 tmp = Array()
  95.                 For Each subMatch In match.SubMatches
  96.                     pushItem tmp, subMatch
  97.                 Next
  98.                 pushItem data, tmp
  99.             End If
  100.         Next
  101.     End With
  102. End Sub
  103.  
  104. Sub pushItem(arr, elt)
  105.     ReDim Preserve arr(UBound(arr) + 1)
  106.     arr(UBound(arr)) = elt
  107. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement