4 |
|
Begin VB.Form Form1 |
5 |
|
BorderStyle = 3 'Fixed Dialog |
6 |
|
Caption = "i-scream Winhost" |
7 |
< |
ClientHeight = 4905 |
7 |
> |
ClientHeight = 1185 |
8 |
|
ClientLeft = 45 |
9 |
|
ClientTop = 330 |
10 |
|
ClientWidth = 4710 |
12 |
|
LinkTopic = "Form1" |
13 |
|
MaxButton = 0 'False |
14 |
|
MinButton = 0 'False |
15 |
< |
ScaleHeight = 4905 |
15 |
> |
ScaleHeight = 1185 |
16 |
|
ScaleWidth = 4710 |
17 |
|
ShowInTaskbar = 0 'False |
18 |
|
StartUpPosition = 2 'CenterScreen |
36 |
|
Width = 4455 |
37 |
|
End |
38 |
|
Begin VB.CommandButton Hide |
39 |
< |
Caption = "Hide Window" |
40 |
< |
Height = 375 |
41 |
< |
Left = 3120 |
39 |
> |
Caption = "hide" |
40 |
> |
Height = 255 |
41 |
> |
Left = 3960 |
42 |
|
TabIndex = 6 |
43 |
< |
Top = 240 |
44 |
< |
Width = 1455 |
43 |
> |
Top = 480 |
44 |
> |
Width = 615 |
45 |
|
End |
46 |
|
Begin SysTray.SystemTray SystemTray |
47 |
|
Left = 2520 |
139 |
|
Dim seqNo As Long |
140 |
|
Dim machineName As String |
141 |
|
|
142 |
+ |
Dim secondsRunning As Long |
143 |
+ |
|
144 |
|
Dim filterHostname As String |
145 |
|
Dim filterTCPPort As Integer |
146 |
|
Dim filterUDPPort As Integer |
147 |
|
Dim fileList As String |
148 |
|
Dim lastModified As String |
149 |
|
|
150 |
+ |
Dim fourtySevenDays As Integer |
151 |
+ |
|
152 |
|
Dim UDPUpdateTime As Integer |
153 |
|
Dim TCPUpdateTime As Integer |
154 |
|
|
183 |
|
End |
184 |
|
End If |
185 |
|
|
186 |
+ |
' Assume the host is run within the first 47 days of the machine starting. |
187 |
+ |
fourtySevenDays = 0 |
188 |
+ |
|
189 |
|
protocolVersion = "1.1" |
190 |
|
|
191 |
|
Status.Caption = "Loading" |
249 |
|
SystemTray.Icon = Val(Form1.Icon) |
250 |
|
End Sub |
251 |
|
|
252 |
+ |
Private Sub Image1_Click() |
253 |
+ |
|
254 |
+ |
End Sub |
255 |
+ |
|
256 |
|
Private Sub Reconfigure_Click() |
257 |
|
' establish a TCP connection to a filtermanager |
258 |
|
connected = False |
294 |
|
' Remove linefeeds and returns from the line. |
295 |
|
response = Replace(response, Chr(13), "") |
296 |
|
response = Replace(response, Chr(10), "") |
286 |
– |
'Text4.Text = Text4.Text & vbCrLf & response |
297 |
|
|
298 |
|
If connected = False Then |
299 |
|
' Perform TCP configuration (1.1) |
309 |
|
lastModified = response |
310 |
|
Text1.Text = Text1.Text & response & vbCrLf |
311 |
|
TCPSock.SendData "FILELIST" & vbCrLf |
312 |
< |
''' Uncomment this for new protocol release. |
303 |
< |
'Case 2a: |
304 |
< |
'If response = "ERROR" Then GoTo configError |
305 |
< |
'fileList = response |
306 |
< |
'Text1.Text = Text1.Text & response & vbCrLf |
307 |
< |
'TCPSock.SendData "FQDN" & vbCrLf |
312 |
> |
' New addition to the protocol. |
313 |
|
Case 3: |
314 |
|
If response = "ERROR" Then GoTo configError |
315 |
|
fileList = response |
316 |
|
Text1.Text = Text1.Text & response & vbCrLf |
317 |
< |
' REMOVE above line, uncomment next |
313 |
< |
'machineName = response |
314 |
< |
TCPSock.SendData "UDPUpdateTime" & vbCrLf |
317 |
> |
TCPSock.SendData "FQDN" & vbCrLf |
318 |
|
Case 4: |
319 |
|
If response = "ERROR" Then GoTo configError |
320 |
+ |
Text1.Text = Text1.Text & response & vbCrLf |
321 |
+ |
machineName = response |
322 |
+ |
TCPSock.SendData "UDPUpdateTime" & vbCrLf |
323 |
+ |
Case 5: |
324 |
+ |
If response = "ERROR" Then GoTo configError |
325 |
|
UDPUpdateTime = response |
326 |
|
Text1.Text = Text1.Text & response & vbCrLf |
327 |
|
TCPSock.SendData "TCPUpdateTime" & vbCrLf |
328 |
< |
Case 5: |
328 |
> |
Case 6: |
329 |
|
If response = "ERROR" Then GoTo configError |
330 |
|
TCPUpdateTime = response |
331 |
|
Text1.Text = Text1.Text & response & vbCrLf |
332 |
|
TCPSock.SendData "ENDCONFIG" & vbCrLf |
333 |
< |
Case 6: |
333 |
> |
Case 7: |
334 |
|
If Not response = "OK" Then GoTo configError |
335 |
|
Text1.Text = Text1.Text & response & vbCrLf |
336 |
|
TCPSock.SendData "FILTER" & vbCrLf |
337 |
< |
Case 7: |
337 |
> |
Case 8: |
338 |
|
Text1.Text = Text1.Text & response & vbCrLf |
339 |
|
'we got a filter list here. |
340 |
|
readTo = 0 |
349 |
|
' get TCP Port number |
350 |
|
filterTCPPort = response |
351 |
|
TCPSock.SendData "END" & vbCrLf |
352 |
< |
Case 8: |
352 |
> |
Case 9: |
353 |
|
If Not response = "OK" Then GoTo configError |
354 |
|
connected = True |
355 |
|
responseNumber = 0 |
414 |
|
' prepare the contents of the XML packet. |
415 |
|
seqNo = seqNo + 1 |
416 |
|
|
417 |
< |
' Comment this line in the next protocol |
410 |
< |
machineName = TCPSock.LocalHostName |
417 |
> |
netbiosName = TCPSock.LocalHostName |
418 |
|
|
419 |
|
LocalIP = TCPSock.LocalIP |
420 |
|
packetDate = Date2Num() |
454 |
|
Dim memory& |
455 |
|
GlobalMemoryStatus memsts |
456 |
|
memory& = memsts.dwTotalPhys |
457 |
< |
memTotal = memory& \ 1024 |
457 |
> |
memTotal = memory& \ 1048576 |
458 |
|
memory& = memsts.dwAvailPhys |
459 |
< |
memFree = memory& \ 1024 |
459 |
> |
memFree = memory& \ 1048576 |
460 |
|
memory& = memsts.dwTotalVirtual |
461 |
< |
swapTotal = memory& \ 1024 |
461 |
> |
swapTotal = memory& \ 1048576 |
462 |
|
memory& = memsts.dwAvailVirtual |
463 |
< |
swapFree = memory& \ 1024 |
463 |
> |
swapFree = memory& \ 1048576 |
464 |
|
|
458 |
– |
uptime = CUpTime.MilliSecs \ 1000 |
459 |
– |
|
465 |
|
CUpTime.Capture |
466 |
|
cpu_time = CUpTime.CPUTime |
467 |
|
percent_idle = CUpTime.PercentIdle |
468 |
|
|
469 |
+ |
'' Causes numbers to be too big :-/ |
470 |
+ |
'uptime = CUpTime.MilliSecs \ 1000 |
471 |
+ |
|
472 |
+ |
'' Doesn't work after 47 days :-/ |
473 |
+ |
'uptime = GetTickCount \ 1000 |
474 |
+ |
|
475 |
+ |
secondsRunning = secondsRunning + UDPUpdateTime |
476 |
+ |
uptime = secondsRunning |
477 |
+ |
|
478 |
+ |
userCount = wksta.LoggedOnUsers |
479 |
+ |
|
480 |
|
' build the contents of the XML packet |
481 |
|
xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & LocalIP & """>" & _ |
482 |
|
"<os>" & _ |
483 |
+ |
"<netbios_name>" & netbiosName & "</netbios_name>" & _ |
484 |
|
"<name>" & osName & "</name>" & _ |
485 |
|
"<version>" & osVersionMajor & "</version>" & _ |
486 |
|
"<release>" & osBuild & "</release>" & _ |
489 |
|
"<processor>" & processorType & "</processor>" & _ |
490 |
|
"<uptime>" & uptime & "</uptime>" & _ |
491 |
|
"</os>" & _ |
492 |
+ |
"<users><count>" & userCount & "</count></users>" & _ |
493 |
|
"<cpu><idle>" & percent_idle & "</idle><user>" & cpu_time & "</user></cpu>" & _ |
494 |
|
"<memory><total>" & memTotal & "</total><free>" & memFree & "</free></memory>" & _ |
495 |
|
"<swap><total>" & swapTotal & "</total><free>" & swapFree & "</free></swap>" & _ |