Mistři v programování na #hovnokod

Visual Basic #548

DECLARE FUNCTION ping$ (host$)
TYPE HostData
  ip AS STRING * 15
  nm AS STRING * 15
  mac AS STRING * 16
END TYPE
DIM host(255) AS HostData

CLS

FOR i = 1 TO 255
 k$ = INKEY$: IF k$ = CHR$(27) THEN EXIT FOR
 s$ = "192.168.54." + MID$(STR$(i), 2)
 CLS
 SHELL "ping " + s$ + " -n 1 -w 300"
 IF SCREEN(4, 1) = ASC("О") THEN k = k + 1: host(k).ip = s$
NEXT i
FOR i = 1 TO k
 CLS
 SHELL "nbtstat -A " + host(i).ip
 s$ = ""
 FOR n = 5 TO 19
  s$ = s$ + CHR$(SCREEN(9, n))
 NEXT n
  FOR n = 9 TO 20
  IF SCREEN(n, 5) = 32 THEN mcol% = n + 1: EXIT FOR
  NEXT n
 s$ = LTRIM$(s$)
 host(i).nm = s$
 s$ = ""
  FOR n = 19 TO 35
   s$ = s$ + CHR$(SCREEN(mcol%, n))
  NEXT n
 s$ = LTRIM$(s$)
 host(i).mac = s$
NEXT i
OPEN "d:\ipreport.txt" FOR OUTPUT AS #1
 FOR i = 1 TO k
  PRINT #1, host(i).ip, host(i).nm, host(i).mac
 NEXT i
CLOSE #1

FUNCTION ping$ (host$)
flag% = 0
CLS
IF ln% = 0 THEN ln% = 300
SHELL "ping 192.168.0." + host$ + " -n 1 -w " + STR$(ln%)
FOR i = 1 TO 10
t$ = CHR$(SCREEN(4, 42 + i))
IF t$ = "m" OR t$ = " " THEN EXIT FOR
sum$ = sum$ + t$
NEXT i
IF i > 1 THEN flag% = 1
ping$ = sum$
END FUNCTION

HovnoKod,