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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
|
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1251">
<object ID="mysink" CLASSID="CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223"></object>
<hta:application id="hta" applicationname="KillProc"
contextmenu="yes"
innerborder="no"
maximizebutton="yes"
minimizebutton="yes"
navigable="yes"
scroll="no"
scrollflat="yes"
selection="no"
showintaskbar="yes"
singleinstance="no"
sysmenu="yes"
version="1.0"
windowstate="normal"
>
<title>Monitor the new processes</title>
<style>
Body {
background-color: buttonface;
font-family: Arial Narrow;
cursor: arrow;
}
Table {
font-size:13px;
}
#ListView1 {
font-size: 11px;
}
#scroll {
width: 250;
overflow: hidden;
}
</style>
<script language="vbscript">
Dim locator, service, procTemp, vTrigg
vTrigg = 0
procTemp = ""
Sub Window_Onload
ListView1.font = "arial"
ListView1.View = 3
ListView1.GridLines = True
ListView1.ColumnHeaders.Add , , "Name of the process", 100
ListView1.ColumnHeaders.Add , , "PID", 50
ListView1.ColumnHeaders.Add , , "Time of the creation", 110
ListView1.ColumnHeaders.Add , , "Priority", 70
ListView1.ColumnHeaders.Add , , "Way to the feasible file", 250
ListView1.ColumnHeaders.Add , , "Owner", 140
self.Focus()
self.MoveTo 65,30
self.ResizeTo 755,550
End Sub
Sub Connect(ht, lg, pswd)
On Error Resume Next
Set wshNet = CreateObject("WScript.Network")
Set locator = CreateObject ("WbemScripting.SWbemLocator")
If isLogin.checked Then
Set service = locator.ConnectServer(ht, "root\CIMV2", lg, pswd)
If Err.Number = 0 Then
Call Query(ht, wshNet.ComputerName)
Else
alert Err.Description
End If
Else
Set service = locator.ConnectServer(ht)
If Err.Number = 0 Then
Call Query(ht, wshNet.ComputerName)
Else
alert Err.Description
End If
End If
Set wshNet = Nothing
End Sub
Sub Query(remoteHost, localHost)
myQuery = "SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_Process'"
service.ExecNotificationQueryAsync mysink ,myQuery
If remoteHost = "" Then
strmess = localHost
Else
strmess = remoteHost
End If
message.innerHTML = "Connected to " & strmess
If document.all.isLogin.checked Then
document.all.host.disabled = "True"
document.all.isLogin.disabled = "True"
document.all.login.disabled = "True"
document.all.passwd.disabled = "True"
Else
document.all.isLogin.disabled = "True"
document.all.host.disabled = "True"
End If
End Sub
Sub AddItem(ProcName, ProcID, ProcTime, ProcPriority, ProcPath, ProcOwner)
Set itmx = ListView1.ListItems.Add(, , ProcName)
itmX.SubItems(1) = ProcID
itmX.SubItems(2) = ProcTime
itmX.SubItems(3) = ProcPriority
If IsNull(ProcPath) Then
itmX.SubItems(4) = ""
Else
itmX.SubItems(4) = ProcPath
End If
itmX.SubItems(5) = ProcOwner
End Sub
Sub ListView1_Click
On Error Resume Next
If ListView1.SelectedItem.Text <> "" Then
document.all.Kill.value = ListView1.SelectedItem.Text
End If
End Sub
Sub ListView1_ColumnClick(ColumnHeader)
With ListView1
.Sorted = False
.SortKey = ColumnHeader.Index - 1
If .SortOrder = 0 Then
.SortOrder = 1
Else
.SortOrder = 0
End If
.Sorted = True
End With
End Sub
Sub KillOne()
On Error Resume Next
If document.all.Kill.value <> "" Then
Set colProcessList = service.ExecQuery("Select * from Win32_Process Where Name = '" & document.all.Kill.value & "'")
For Each objProcess in colProcessList
ret = objProcess.Terminate()
If ret <> 0 Then
alert("It is not possible to complete process!")
End If
Next
Set colProcessList = Nothing
document.all.Kill.value = ""
ListView1.ListItems.Remove(ListView1.SelectedItem.Index)
Else
alert("Process is not selected!")
End If
End Sub
Sub KillPermanent()
If document.all.Kill.value <> "" Then
ProcTemp = document.all.Kill.value
Else
alert("Process is not selected!")
End If
End Sub
Sub wbemsinkCancel()
mysink.cancel()
If document.all.isLogin.checked Then
document.all.host.disabled = "False"
document.all.isLogin.disabled = "False"
document.all.login.disabled = "False"
document.all.passwd.disabled = "False"
Else
document.all.isLogin.disabled = "False"
document.all.host.disabled = "False"
End If
End Sub
Sub ClearGrid()
ListView1.ListItems.Clear()
End Sub
Sub Window_OnUnload
mysink.cancel()
Set service = Nothing
Set locator = Nothing
End Sub
</script>
<script language="vbscript" FOR="mysink" EVENT="OnProgress(iUpperBound, iCurrent, strMessage, objWbemAsyncContext)">
alert("Progress")
</script>
<script language="vbscript" FOR="mysink" EVENT="OnCompleted(iHResult, objWbemErrorObject, objWbemAsyncContext)">
document.all.Kill.value = ""
Call ClearGrid()
alert("Monitoring is opened.")
message.innerHTML = "Opened"
</script>
<script language="vbscript" FOR="mysink" EVENT="OnObjectReady(obj, objAsyncContext)">
timeCreated = obj.TargetInstance.CreationDate
TimeCreated = Mid(timeCreated, 1, 4) & "." & Mid(timeCreated, 5, 2) & "." & Mid(timeCreated, 7, 2) & " " & Mid(timeCreated, 9, 2) & ":" & Mid(timeCreated, 11, 2) & ":" & Mid(timeCreated, 13, 2)
colProp = obj.TargetInstance.GetOwner(User,Domain)
Call AddItem(obj.TargetInstance.Name, obj.TargetInstance.ProcessID, timeCreated, obj.TargetInstance.Priority, obj.TargetInstance.ExecutablePath, Domain & "\" & User)
If obj.TargetInstance.Name = ProcTemp Then
obj.TargetInstance.Terminate()
End If
</script>
<script language="javascript">
var xInit;
xInit = 0;
function full()
{
if (document.all.isLogin.checked)
{
if (xInit < 720)
{
xInit += 40;
document.all.scroll.style.width = xInit;
var x = setTimeout("full()", 0.08);
}
else
{
clearTimeout(x);
}
}
else
{
document.all.scroll.style.width = 250;
xInit = 0;
}
}
</script>
</head>
<body>
<table cellpadding="0" style="border-collapse: collapse" width="720" height="467">
<tr>
<td colspan="5">
<div id="scroll">
<table border="0" cellpadding="0" style="border-collapse: collapse" width="730" height="100%">
<tr>
<td width="37">
Host:
</td>
<td width="136">
<input name="host" type="text" style="width: 100; border: 1px solid black;">
</td>
<td width="20">
<input name="isLogin" type="checkbox" onclick="full()" style="cursor: hand;" onmouseover='javascript: (this.checked)?this.title="Connection under the the alternative loginom with the remote system ": this.title="Soedinenie with that flowing loginom with any system"; '>
</td>
<td width="85">
Login:
</td>
<td width="31">
Name:
</td>
<td width="147">
<input name="login" type="text" style="width: 137; border: 1px solid black; height:19" name="T1" size="20"></td>
<td width="47">
Password:
</td>
<td width="231">
<input name="passwd" type="password" style="width: 137; border: 1px solid black; height:19" name="T2" size="20">
</td>
</tr>
<tr>
<td width="191" colspan="3">
<input type="button" style="cursor: hand; border: 1px solid black; height:19; font-size: 11px; width:88" value="Connect" onclick="vbscript: call Connect(document.all.host.value, document.all.login.value, document.all.passwd.value)">
</td>
<td width="539" colspan="5">
<span lang="ru"> </span></td>
</tr>
<tr>
<td width="191" colspan="3">
<input type="button" style="cursor: hand; border: 1px solid black; height:19; font-size: 11px; width:88" value="Open" onclick="wbemsinkCancel()"></td>
<td width="539" colspan="5">
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td width="720" height="340" colspan="5" style="border: 1px solid #000000">
<OBJECT ID="ListView1" WIDTH=720 HEIGHT=340 CLASSID="CLSID:BDD1F04B-858B-11D1-B16A-00C0F0283628">
<PARAM NAME="SortKey" VALUE="0">
<PARAM NAME="View" VALUE="2">
<PARAM NAME="Arrange" VALUE="0">
<PARAM NAME="LabelEdit" VALUE="1">
<PARAM NAME="SortOrder" VALUE="0">
<PARAM NAME="Sorted" VALUE="-1">
<PARAM NAME="MultiSelect" VALUE="0">
<PARAM NAME="LabelWrap" VALUE="-1">
<PARAM NAME="HideSelection" VALUE="0">
<PARAM NAME="HideColumnHeaders" VALUE="0">
<PARAM NAME="OLEDragMode" VALUE="0">
<PARAM NAME="OLEDropMode" VALUE="0">
<PARAM NAME="AllowReorder" VALUE="-1">
<PARAM NAME="Checkboxes" VALUE="0">
<PARAM NAME="FlatScrollBar" VALUE="0">
<PARAM NAME="FullRowSelect" VALUE="-1">
<PARAM NAME="GridLines" VALUE="-1">
<PARAM NAME="HotTracking" VALUE="0">
<PARAM NAME="HoverSelection" VALUE="0">
<PARAM NAME="PictureAlignment" VALUE="0">
<PARAM NAME="TextBackground" VALUE="0">
<PARAM NAME="ForeColor" VALUE="-2147483640">
<PARAM NAME="BackColor" VALUE="-2147483624">
<PARAM NAME="BorderStyle" VALUE="0">
<PARAM NAME="Appearance" VALUE="0">
<PARAM NAME="MousePointer" VALUE="0">
<PARAM NAME="Enabled" VALUE="1">
<PARAM NAME="NumItems" VALUE="0">
<param name="OLEDragMode" value="0">
<param name="OLEDropMode" value="0">
</OBJECT>
</td>
</tr>
<tr>
<td width="720" height="17" colspan="5">
</td>
</tr>
<tr>
<td width="233" height="18">
<input type="text" name="Kill" style="border: 0px; height:18; font-size: 11px; width:233"
</td>
<td width="103" height="18">
<input type="button" style="cursor: hand; border: 1px solid black; height:19; font-size: 11px; width:100" value="Kill" onclick="KillOne()"></td>
<td width="123" height="18">
<input type="button" style="cursor: hand; border: 1px solid black; height:19; font-size: 11px; width:120" value="Kill all" onclick="KillPermanent()"></td>
<td width="131" height="18">
<input type="button" style="cursor: hand; border: 1px solid black; height:19; font-size: 11px; width:120" value="Clean the grid" onclick="ClearGrid()"></td>
<td width="140" height="18">
</td>
</tr>
<tr>
<td width="720" height="23" colspan="5">
</td>
</tr>
<tr>
<td width="720" height="23" colspan="5" id="message">Opened
</td>
</tr>
</table>
</body> |
Partager