-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathexec.hta
58 lines (51 loc) · 1.65 KB
/
exec.hta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<html>
<head>
<title>HTA exec</title>
</head>
<SCRIPT LANGUAGE="VBScript">
Public globalShellObj
Public globalExecObj
sub getOutput
std = vbCrLf & globalExecObj.stdout.readall()
errr = vbCrLf & globalExecObj.StdErr.readall()
Set div = document.getElementById("output")
if std <> "" then
div.innerText = div.innerText & std
end if
if errr <> "" then
div.innerText = div.innerText & errr
end if
document.getElementById("right").scrollTop = document.getElementById("right").scrollHeight
end Sub
Sub HandleInput
Set globalShellObj = CreateObject("WScript.Shell")
Set globalExecObj = globalShellObj.exec( BasicTextbox.Value)
Set div = document.getElementById("output")
div.innerText = div.innerText & vbCrLf & "> " & BasicTextbox.Value
BasicTextbox.value = ""
getOutput
End Sub
sub runInteractive
Set temp1 = CreateObject("WScript.Shell")
temp2 = temp1.run( BasicTextbox.Value, 1, 0)
end sub
</SCRIPT>
<body>
<div id="left" style="float:left;height=100%;">
<div>
<textarea rows="4" cols="50" id="prompt" type="text" name="BasicTextbox" size="30"></textarea>
</div>
<div>
<input id=runbutton type="button" value="Run and grab stdin/out (non-interactive blocking)" name="run_button" onClick="HandleInput">
<br>
<input id=runbutton type="button" value="Run without grabbing stdin/out (interactive non-blocking)" name="run_button" onClick="runInteractive">
</div>
</div>
<div id="right" style="background-color:black;font:Typewriter;color:white;height:100%;max-height:100%;overflow:scroll;">
<p id="output">Output will go here</p>
</div>
<script>
document.getElementById("prompt").focus()
</script>
</body>
</html>