|I am trying to do the following:|
1. Create a batch file that will ping hosts on the network.
2. If the host is up enumerate the NETBIOS name table using nbtstat.
This has to be done using a regular batch file and not using vbs.
I have tried many ways and they all fail to enumerate the host file that I have the ping results written to. Is there a way to have nbtstat read the ip address in a text file. Here are a few of my efforts using regular batch script code and also attempting to implement nmap into the rucus.
1st attempt creates the file but nbtstat just returns the usage information:
echo "Step 1"
for /f "tokens=*" %%C in (hosts.txt) do (ping -n 1 %%C >> PingResults.txt)
echo "Step 2"
for /f "tokens=*" %%R in (PingResults.txt) do (NBTSTAT -A)
Attempt 2 using nmap in the batch file:
echo "Step 1 NMAP Ping Scan"
nmap -sP <iprange/mask >> NmapPing.txt
rem IP masked for security purposes
for /L %%R in (NmapPing.txt) do (nbtstat -A %%R)
rem echo "NBTStat Enumeration"
Third attempt just tried using this with a text file that has IP addresses also tried it with hostnames and the results return ports and 1 line of enumeration. I need the entire enumeration. I hope someone can help. Thanks in advance
rem nmap -v--script nbstat.nse -iL CCBDomain.txt