Apagada docs

Aprendiendo a programar el pasado

Herramientas de usuario

Herramientas del sitio


en:bat:netscan

Scripts to scan a network

FINDSHARE.CMD

Findshare.cmd returns the NetBios share name for a given ip address. It is similar to NBTSTAT, but it checks for host availability of the given ip address before running NBTSTAT, resulting in highest “netbios ping” rates when running against serially-generated ip addresses.

REM %1 Has to be an ip address, such as 127.0.0.1
PING -n 1 -w 100 %1
IF NOT ERRORLEVEL 1 NBTSTAT -A %1

Save this code snippet as findshare.cmd inside a folder in your path, and call the script as findshare.cmd ip-address

The above script can be run in any MS-Windows or MS-DOS computer having NBTSTAT and PING installed (tipically, any Windows 3.0-Windows 8 computer with networking installed). Call it “FindShare.bat” if you want it to run in a windows prior to 2K.

But, in order to make it useful, you'd better call it with a FOR /L loop, which not available in windows 3.x, 95, 98 or Me (you need NT4, 2K, XP, Vista, 7 or 8 to make it work):

for /L %A in (1,1,255) do call findshare.cmd 192.168.1.%A

(substitute 192.168.1. with your IP address range).

MIPINGSCAN.CMD

MiPingScan makes a PING call inside the 192.168.1.1-192.168.1.256 range.

It requires sed for MS-WINDOWS (install ssed and rename it into sed to get a sed for MS-Windows, or install gnuwin32, or UnixUtils to get a bunch of unixlike command-line utilities including sed, or, if you want to run a complete unixlike environment inside windows, consider using cygwin ).

In the next lines, substitute 192.168.1.x for your LAN ip range.

rem pings all network from 192.168.1.1 to 1921.168.1.254
rem this requires sed installed.
echo off
for /L %%a in (1,1,253) do ping -n 1 -w 40 192.168.1.%%a |sed -e ":a;N;s/.\n//;s
/[^0-9]*\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*\([(][^()]*[)]\).*$/\1 --> \2/g;
ta"
 
arp -a

The output of the utility is something like:

192.168.1.1 --> (100% perdidos)
192.168.1.2 --> (100% perdidos)
192.168.1.3 --> (0% perdidosTiempos aproximados de ida y vuelta en milisegundos
:    Mínimo = 114ms, Máximo = 114ms, Media = 114ms
192.168.1.4 --> (100% perdidos)
192.168.1.5 --> (0% perdidosTiempos aproximados de ida y vuelta en milisegundos
:    Mínimo = 1ms, Máximo = 1ms, Media = 1ms
192.168.1.252 --> (100% perdidos)
192.168.1.253 --> (100% perdidos)
192.168.1.254 --> (100% perdidos)

followed by an arp -a that shows the ethernet mac addresses.

Este sitio web utiliza cookies. Al utilizar el sitio web, usted acepta almacenar cookies en su computadora. También reconoce que ha leído y entendido nuestra Política de privacidad. Si no está de acuerdo abandone el sitio web.Más información
en/bat/netscan.txt · Última modificación: 2013/07/08 13:53 por nepenthes