#128329 - 2004-10-23 04:46 PM
doc, when you come back (htmlTreeView)...
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
this is what I came up with. what ya think? the looks can be changed as much as one pleases but this is the generic base... Code:
$header=@wksta,"","" $HD="1","Model=IBM-DJSA-210","Interface=IDE","Size=10GB" $HD2="2","Model=COM-CO10-JA0","Interface=SCSI","Size=9GB" $OS="Operating System","Name=Windows 2000","Service Pack=4","Role=workstation","language=finnish" $Antivir="Antivirus","Name=Fsecure AV","version=5.52","defTimeStamp=23.10.2004_03"
$Hardware="Hardware","" $Harddrives="Harddrives","","" $Harddrives[1]=$hd $Harddrives[2]=$hd2 $Hardware[1]=$harddrives
$software="Software","","" $software[1]=$os $software[2]=$antivir
$header[1]=$hardware $header[2]=$software
buildHTMLtree($header) run 'explorer "'+@scriptdir+'\testoutput.htm"'
function buildHTMLtree($data) if 8<>vartype($data[0]) exit 1 endif $=redirectoutput(@scriptdir+"\testoutput.htm") '<span style="cursor:pointer;" onclick="var sauna = document.getElementById(' + "'" + $data[0] + "'" + "); if (sauna.style.display == 'none') { sauna.style.display = 'block'; } else { sauna.style.display = 'none'; }" + '"><b>' + $data[0] + '</b></span><table id="' + $data[0] + '" style="display:none;"><tr><td width="20"> </td><td>' $=redirectoutput("") for $section=1 to ubound($data) if 0<ubound($data[$section]) if 8<>vartype($data[$section][1]) BuildHTMLtree($data[$section]) else $=redirectoutput(@scriptdir+"\testoutput.htm") "<b>" $data[$section][0] "</b>" '<table><tr><td width="20"></td><td><table>' for $value=1 to ubound($data[$section]) $=split($data[$section][$value],"=") "<tr><td></td><td>" $[0] "</td><td>" $[1] "</td></tr>" next '</table></td></tr></table>' $=redirectoutput("") endif endif next $=redirectoutput(@scriptdir+"\testoutput.htm") '</td></tr></table><br>' $=redirectoutput("") endfunction
_________________________
!download KiXnet
|
Top
|
|
|
|
#128330 - 2004-10-25 01:07 AM
Re: doc, when you come back (htmlTreeView)...
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
and here different version. note, this version does not write the file but outputs it. with IE-com you are able to view the data without SP2 blocking it.
Code:
$header=@wksta,"","" $HD="1","Model=IBM-DJSA-210","Interface=IDE","Size=10GB" $HD2="2","Model=COM-CO10-JA0","Interface=SCSI","Size=9GB" $OS="Operating System","Name=Windows 2000","Service Pack=4","Role=workstation","language=finnish" $Antivir="Antivirus","Name=Fsecure AV","version=5.52","defTimeStamp=23.10.2004_03" $services="Services", "Alerter=Hälytys=C:\WINNT\System32\services.exe=Manual=Stopped=LocalSystem", 'Apache2=Apache2="C:\Program Files\Apache Group\Apache2\bin\Apache.exe" -k runservice=Manual=Stopped=LocalSystem', "AppMgmt=Sovellusten hallinta=C:\WINNT\system32\services.exe=Manual=Stopped=LocalSystem", "aspnet_state=ASP.NET State Service=C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspnet_state.exe=Manual=Stopped=.\ASPNET", "BackWeb Client - 7681197=F-Secure Automatic Update=C:\PROGRA~1\F-Secure\BackWeb\7681197\Program\SERVIC~1.EXE=Auto=Stopped=LocalSystem", "BITS=Background Intelligent Transfer Service=C:\WINNT\System32\svchost.exe -k BITSgroup=Manual=Stopped=LocalSystem", "Browser=Tietokoneiden selaus=C:\WINNT\System32\services.exe=Auto=Running=LocalSystem", "cisvc=Indeksointipalvelu=C:\WINNT\System32\cisvc.exe=Disabled=Stopped=LocalSystem", "ClipSrv=Leikekirja=C:\WINNT\system32\clipsrv.exe=Manual=Stopped=LocalSystem", "Dhcp=DHCP-asiakas=C:\WINNT\System32\services.exe=Auto=Running=LocalSystem", "dmadmin=Loogisen levyn hallinnan valvontapalvelu=C:\WINNT\System32\dmadmin.exe /com=Manual=Stopped=LocalSystem"
$Hardware="Hardware","" $Harddrives="Harddrives","","" $Harddrives[1]=$hd $Harddrives[2]=$hd2 $Hardware[1]=$harddrives
$software="Software","","","" $software[1]=$os $software[2]=$antivir $software[3]=$services
$header[1]=$hardware $header[2]=$software
;$=open(1,@scriptdir+'\testoutput2.htm',5) ;writeline(1,buildHTMLtree($header)) ;$=close(1) ;run 'explorer "'+@scriptdir+'\testoutput2.htm"'
$ie = CreateObject("internetexplorer.application") $ie.fullscreen = 1 $ie.menubar = 1 $ie.statusbar = 0 $ie.toolbar = 1 $ie.navigate("about:blank") While $ie.busy AND $ie.readystate <> 4 AND @error = 0 Loop $ie.document.write('<span style="position:absolute;right:10;cursor:pointer;" onclick="window.close()">Close</span>') $ie.document.write(buildHTMLtree($header)) $ie.visible = 1
function buildHTMLtree($data) if 8<>vartype($data[0]) exit 1 endif $buildHTMLtree='<span style="cursor:pointer;" onclick="var sauna = document.getElementById(' + "'" + $data[0] + "'" + "); if (sauna.style.display == 'none') { sauna.style.display = 'block'; } else { sauna.style.display = 'none'; }" + '"><b>' + $data[0] + '</b></span><table id="' + $data[0] + '" style="display:none;"><tr><td width="20"> </td><td>' for $section=1 to ubound($data) if 0<ubound($data[$section]) if 8<>vartype($data[$section][1]) $buildHTMLtree=$buildHTMLtree+BuildHTMLtree($data[$section]) else $buildHTMLtree=$buildHTMLtree+'<b>'+$data[$section][0]+'</b>'+ '<table><tr><td width="20"></td><td><table bgcolor="#EEEEEE">' $bg=0 for $value=1 to ubound($data[$section]) $bg=$bg+1 $=split($data[$section][$value],"=") $buildHTMLtree=$buildHTMLtree+'<tr '+iif($bg/2*2=$bg,'bgcolor="#FFFFFF"','')+'><td></td>' for each $s in $ $buildHTMLtree=$buildHTMLtree+'<td>'+$s+'</td>' next $buildHTMLtree=$buildHTMLtree+'</tr>' next $buildHTMLtree=$buildHTMLtree+'</table></td></tr></table>' endif endif next $buildHTMLtree=$buildHTMLtree+'</td></tr></table><br>' endfunction
_________________________
!download KiXnet
|
Top
|
|
|
|
#128331 - 2004-10-25 03:24 AM
Re: doc, when you come back (htmlTreeView)...
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
k, doc...
here is one more, with little bit more listing...
oh, and if someone else wants to barf, just shoot.
btw, added some real info collection to see how it works on "non-managed" input.
Code:
$header=@wksta,"",""
$HD="1","Model"+chr(1)+"IBM-DJSA-210","Interface"+chr(1)+"IDE","Size"+chr(1)+"10GB"
$HD2="2","Model"+chr(1)+"COM-CO10-JA0","Interface"+chr(1)+"SCSI","Size"+chr(1)+"9GB"
$OS="Operating System","Name"+chr(1)+"Windows 2000","Service Pack"+chr(1)+"4","Role"+chr(1)+"workstation","language"+chr(1)+"finnish"
$Antivir="Antivirus","Name"+chr(1)+"Fsecure AV","version"+chr(1)+"5.52","defTimeStamp"+chr(1)+"23.10.2004_03"
$services="Services",""
$services[1]=listServices(".")
$processes="Processes",""
$processes[1]=listServices(".")
$Hardware="Hardware",""
$Harddrives="Harddrives","",""
$Harddrives[1]=$hd
$Harddrives[2]=$hd2
$Hardware[1]=$harddrives
$software="Software","","","",""
$software[1]=$os
$software[2]=$antivir
$software[3]=$services
$software[4]=$processes
$header[1]=$hardware
$header[2]=$software
;$=open(1,@scriptdir+'\testoutput2.htm',5)
;writeline(1,buildHTMLtree($header))
;$=close(1)
;run 'explorer "'+@scriptdir+'\testoutput2.htm"'
$ie = CreateObject("internetexplorer.application")
$ie.fullscreen = 1
$ie.navigate("about:blank")
While $ie.busy AND $ie.readystate <> 4 AND @error = 0 Loop
$ie.document.write('<span style="position:absolute;right:10;cursor:pointer;" onclick="window.close()">Close</span>')
$ie.document.write(buildHTMLtree($header))
$ie.visible = 1
function buildHTMLtree($data)
if 8<>vartype($data[0]) exit 1 endif
$buildHTMLtree='<span style="cursor:pointer;" id="s_' + $data[0] + '" onclick="var sauna = document.getElementById('
+"'"+$data[0]+"'"+"); var s2 = document.getElementById('s_"+$data[0]+"'); if (sauna.style.display == 'none')"
+" { sauna.style.display = 'block'; s2.innerHTML='- <b>"+ $data[0] + "</b>'; } else { sauna.style.display = 'none'; "
+"s2.innerHTML='+ <b>"+ $data[0] + "</b>';}" + '">+ <b>' + $data[0] + '</b></span><table id="' + $data[0] + '" style="display:none;"><tr><td width="20"> </td><td>'
for $section=1 to ubound($data)
if 0<ubound($data[$section])
if 8<>vartype($data[$section][1])
$buildHTMLtree=$buildHTMLtree+BuildHTMLtree($data[$section])
else
$buildHTMLtree=$buildHTMLtree+'<b>'+$data[$section][0]+'</b>'+
'<table><tr><td width="20"></td><td><table bgcolor="#EEEEEE">'
$bg=0
for $value=1 to ubound($data[$section])
$bg=$bg+1
$=split($data[$section][$value],chr(1))
$buildHTMLtree=$buildHTMLtree+'<tr '+iif($bg/2*2=$bg,'bgcolor="#FFFFFF"','')+'><td></td>'
for each $s in $ $buildHTMLtree=$buildHTMLtree+'<td>'+$s+'</td>' next
$buildHTMLtree=$buildHTMLtree+'</tr>'
next
$buildHTMLtree=$buildHTMLtree+'</table></td></tr></table>'
endif
endif
next
$buildHTMLtree=$buildHTMLtree+'</td></tr></table><br>'
endfunction
Function ListServices($Computer)
Dim $Service,$SL
For Each $Service In GetObject('winmgmts:{impersonationLevel=impersonate}!//' + $Computer + '\root\cimv2' ).ExecQuery('select * from Win32_Service', , 48)
$SL = $SL + chr(2) + $Service.Name + CHR(1) + $Service.DisplayName + CHR(1) + $Service.PathName + CHR(1) +
$Service.StartMode + CHR(1) + $Service.State + CHR(1) + $Service.StartName
Next
$ListServices=split($SL,chr(2))
EndFunction
Function ListProcess($Computer)
Dim $Process, $PL
For Each $Process In GetObject("winmgmts:{impersonationLevel=impersonate}!//" + $Computer ).ExecQuery("select * from Win32_Process")
If $Process.ExecutablePath = '' $Process.ExecutablePath = 'Path Unknown' EndIf
$PL = $PL + chr(2) + $Process.Name + CHR(1) + $Process.ProcessId + CHR(1) + $Process.ExecutablePath
Next
$ListProcess=split($PL,chr(1))
EndFunction
_________________________
!download KiXnet
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 920 anonymous users online.
|
|
|