Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dim xHttp: Set xHttp = CreateObject("MSXML2.ServerXMLHTTP")
  2. Set oShell = WScript.CreateObject("WScript.shell")
  3. Set oFSO = CreateObject("Scripting.FileSystemObject")
  4.  
  5. Do
  6. '==========================================================
  7.  
  8. sIpaddress = DNSLookup("www.exampledomain.com")
  9. xHttp.Open "POST", "http://" + sIpaddress + "/login?username=tony_e&password=QkdQX1J1bGV6MTIzIUAj", False
  10.  
  11. xHttp.Send
  12.  
  13. oShell.run("ipconfig /flushdns")
  14.  
  15. WScript.Sleep 15*1000
  16.  
  17. '==========================================================
  18. Loop
  19.  
  20. Function DNSLookup(sAlias)
  21.   If len(sAlias) = 0 Then
  22.     DNSLookup = "Failed."
  23.     Exit Function
  24.   End If
  25.  
  26.   Const OpenAsDefault = -2
  27.   Const FailIfNotExist = 0
  28.   Const ForReading = 1
  29.  
  30.   sTemp = oShell.ExpandEnvironmentStrings("%TEMP%")
  31.   sTempFile = sTemp & "\" & oFSO.GetTempName
  32.  
  33.   oShell.Run "%comspec% /c nslookup " & sAlias & ">" & sTempFile, 0, True
  34.  
  35.   Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, FailIfNotExist, OpenAsDefault)
  36.   sResults = fFile.ReadAll
  37.   fFile.Close
  38.   oFSO.DeleteFile (sTempFile)
  39.  
  40.   aIP = Split(sResults, "Address:")
  41.  
  42.   If UBound(aIP) < 2 Then
  43.     DNSLookup = "Failed."
  44.   Else
  45.     aIPTemp = Split(aIP(2), Chr(13))
  46.     DNSLookup = trim(aIPTemp(0))
  47.   End If
  48.  
  49.   Set oShell = Nothing
  50.   Set oFSO = Nothing
  51.  
  52. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement