REM > HitCount REM REM Program : HitCount REM Purpose : Report summary of 'DeltaNet' connections, by type. REM Author : Ian Giblin, ALT-itude Software, (c) 1996. REM Email : giblin@dm.unipi.it REM WWW : http://adams.dm.unipi.it/~giblin REM REM Version : 1.1 (Tue 02nd July 1996) REM REM Notes : (1) This lookup technique can take a *long* time!! REM (2) Use the following line in an obey file to make this look REM nice in the desktop: REM REM TaskWindow "HitCount" -display -wimpslot 64k -quit -name HitCount REM REM ...assuming you have put the program in your Library first. ON ERROR PRINT REPORT$;" at line ";ERL:END DIM buffer% 128 DIM site$(256) DIM hits%(256) DIM telnet%(256) DIM ftp%(256) DIM ident%(256) DIM finger%(256) DIM http%(256) sites% = 0 c1%=OPENIN(".logfile") REM================== Survey the situation ======================== WHILE NOT EOF#c1% a$ = GET$#c1% a% = INSTR(a$, "Connect from ") IF a%>0 THEN b$ = MID$(a$, a%+13) c$ = MID$(b$, 1, INSTR(b$," ")) WHILE RIGHT$(c$,1)=" ":c$=LEFT$(c$):ENDWHILE found% = FALSE FOR i%=0 TO sites% IF site$(i%)=c$ THEN PROClog_hit(i%, a$) found% = TRUE ENDIF NEXT i% IF NOT found% THEN sites% += 1 site$(sites%) = c$ PROClog_hit(sites%, a$) ENDIF ENDIF ENDWHILE CLOSE#c1% REM================== Translate IP No's =========================== PRINT '" IP address identity "; PRINT " all ftp tel http fgr"' FOR s%=1 TO sites% IF LEFT$(site$(s%),1)<="9" THEN PRINT " ";site$(s%)+STRING$(16-LEN(site$(s%)), " "); ELSE PRINT " (local)"+STRING$(16-LEN("(local)"), " "); ENDIF IF LEFT$(site$(s%),1)<="9" THEN $buffer% = site$(s%) SYS "Resolver_GetHostByName",,buffer% TO R0%,R1% IF R1%<>0 THEN a% = !(R1%) b$="" i%=0 REPEAT c%=?(a%+i%) IF c%>31 THEN b$=b$+CHR$(c%) i%+=1 UNTIL c%=0 IF LEN(b$)>0 THEN site$(s%)=b$ ENDIF ENDIF PRINT site$(s%)+STRING$(36-LEN(site$(s%)), " "); PRINT FNpadded(hits%(s%)); PRINT FNpadded(ftp%(s%)); PRINT FNpadded(telnet%(s%)); REM -- PRINT FNpadded(ident%(s%)); PRINT FNpadded(http%(s%)); PRINT FNpadded(finger%(s%)) NEXT s% PRINT'" [end]"' END DEF FNpadded(p%) = STR$(p%)+STRING$(5-LEN(STR$(p%))," ") DEF PROClog_hit(s%, s$) hits%(s%) += 1 IF INSTR(s$, " in.ftpd:") THEN ftp%(s%) += 1 IF INSTR(s$, " in.telnetd:") THEN telnet%(s%) += 1 IF INSTR(s$, " in.identd:") THEN ident%(s%) += 1 IF INSTR(s$, " in.httpd:") THEN http%(s%) += 1 IF INSTR(s$, " in.fingerd:") THEN finger%(s%) += 1 ENDPROC REM===================================================================== REM REM Function UPPER(string) REM REM Emulates the "normal" BASIC function UPPER$(string) REM DEF FNupper(in$) LOCAL out$, z%, ascii% out$="" FOR z%=1 TO LEN(in$) ascii%=ASC(MID$(in$,z%,1)) IF ascii%>=ASC("a") AND ascii%<=ASC("z") THEN ascii%=ascii%-32 out$=out$+CHR$(ascii%) NEXT z% =out$