home *** CD-ROM | disk | FTP | other *** search
- {
- HTML report script v1.0 for NetView by KillerR
- Saves current hostlist state to an HTML file
- Saving occurs after every list recheck
- By the way you can use this script with NetView's
- HTTP server listener script in pair
-
- User defined constants:
- HTMLFILENAME - report file path and name. If you want to use
- this script with HTTP script you should set this
- const like '\Scripts\HTTP\DefaultHost\index.html' or any other
- filename and set reference to it in index.html
- }
- {
- WebCenter HtmlReport helper script
- }
- const HTML_FILE='';//Path and name of result report file.
- //If empty default to nv_directory+'\Scripts\HTTP\DefaultHost\HtmlReport\index.html';
-
- procedure GoReport;
- var fn,ts,lst,ctime:string;
- hst:TNVHost;
- i,f,flg:integer;
- tabs:TStringList;
- begin
- hst:=TNVHost.Create;
- tabs:=TStringList.Create;
- if length(HTML_FILE)=0 then fn:=nv_directory+'\Scripts\HTTP\DefaultHost\HtmlReport\index.html'
- else fn:=HTML_FILE;
- CreateDirectory(ExtractFilePath(fn));
- f:=openfile(fn,11);
- tabs.Clear;
- writefile(f,'<html><title>NetView hostlist</title>'+
- '<body text="#FFFFFF" bgcolor="#000000" link="#00FFFF" vlink="#00FFAA" alink="#00AAAA">');
- writefile(f,'<p align=center><a href=/>Go to main page</a></p>');
- writefile(f,'<H3><p align=center>Full servers list generated by NetView on '+
- FormatDateTime(' YYYY-MM-DD HH:MM.SS',Now)+'</p></H3>');
- writefile(f,'<TABLE x:str align=center border=1 cellpadding=0 cellspacing=0 '+
- 'style=''border-collapse: collapse;table-layout:fixed'' bgcolor="#101010">');
-
- writefile(f,'<TR bgcolor="#404040">');
- writefile(f,'<td width=150><b>Hostname</b></td>');
- writefile(f,'<td width=150><b>IP address</b></td>');
- writefile(f,'<td width=150><b>Connection</b></td>');
- writefile(f,'<td width=150><b>Workgroup</b></td>');
- writefile(f,'</TR>');
-
- hst.nextid:=0;
- repeat
- hst.gethost(hst.nextid,0);
- if(hst.id<>0)then
- begin
- flg:=strtoint(hst.getmetavar('flags'));
- lst:=hst.getmetavar('wgrp');
- if length(lst)=0 then lst:=' ';
- ctime:=hst.getmetavar('ctime');
- if(flg and $200)=0 then
- begin
- if(hst.getmetavar('ison')='on')then ts:='<TR bgcolor="#384045">' else ts:='<TR>';
- ts:=ts+'<td width=150><a href="file://'+hst.hname+'/" target="_blank">\\'+hst.hname+'</a></td>';
- ts:=ts+'<td width=150><a href="file://'+hst.hip+'/" target="_blank">\\'+hst.hip+'</a></td>';
- ts:=ts+'<td width=150>'+ctime+'</td>';
- ts:=ts+'<td width=150>'+lst+'</td>';
- ts:=ts+'</TR>';
- tabs.add(lst+hst.hname+#13+ts);
- end;
- if((flg and $400)<>0) or ((flg and $1000)<>0) then
- begin
- if(hst.getmetavar('ison')='on')then ts:='<TR bgcolor="#384045">' else ts:='<TR>';
- ts:=ts+'<td width=150><a href="ftp://'+hst.hname+'" target="_blank">ftp://'+hst.hname+'</a></td>';
- ts:=ts+'<td width=150><a href="ftp://'+hst.hip+'" target="_blank">ftp://'+hst.hip+'</a></td>';
- ts:=ts+'<td width=150>'+ctime+'</td>';
- ts:=ts+'<td width=150>'+lst+'</td>';
- ts:=ts+'</TR>';
- tabs.Add(lst+hst.hname+#13+ts);
- end;
- end;
- until hst.nextid=0;
- tabs.Sort;
- for i:=0 to tabs.count-1 do
- begin
- ts:=tabs.strings[i];
- delete(ts,1,pos(#13,ts));
- writefile(f,ts);
- end;
- writefile(f,'</TABLE>');
- writefile(f,'<p align="center">Powered by NetView<br><img border="0" src="/nvico.gif" width="64" height="64"><br><a href="http://www.killprog.com">http://www.killprog.com</a></p>');
- writefile(f,'</body><script language="JavaScript" src="/fade.js"></script></html>');
- closefile(f);
- hst.free;
- tabs.Free;
- end;
-
- var e,i1,i2:integer;
- begin
- GoReport;
- repeat
- e:=waitevent(i1,i2);
- if(e=NMNP_ACTION)then
- begin
- if ((i1 and NVACTION_LIST)<>0) and
- (((i1 and NVACTION_RECHECK)<>0)or((i1 and NVACTION_GETFROMFILE)<>0)or((i1 and NVACTION_GETFROMNET)<>0))
- then GoReport;
- end;
- until e=0;
- end.
-