中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-15 08:35
47,812 topics / 349,917 posts / today 0 new / 48,268 members
DOS批处理 & 脚本技术(批处理室) » Can everyone help improve the scanning of the local area network mac address and converting it to modiip
Printable Version  2,375 / 3
Floor1 dato Posted 2008-08-24 12:39
高级用户 Posts 377 Credits 916
I want to try to use
http://www.unixwiz.net/tools/nbtscan.html#download
The provided nbtscan and gnu sort to process the MAC addresses scanned in the local area network into the modiip format.

The obtained abc.txt
is
192.168.10.8 WORKGROUP\ONLY208 00:1f:3c:2d:5f:f6 SHARING
192.168.10.222 WORKGROUP\ONLY202 00:1f:3c:28:43:2c SHARING

But when processing at the end, only one record can be generated, because it is affected by the set replacement, I don't know how to deal with it, please help me modify it, thank you
mac.ini
001f3c28432c=192.168.10.222,ONLY202

Floor2 HAT Posted 2008-08-24 12:52
版主 Posts 5,017 Credits 9,023
```
@echo off
type nul>"mac.ini"
.\arc\nbtscan-1.0.35.exe -m 192.168.10.0/24 | .\arc\sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 >>abc.txt
setlocal enabledelayedexpansion
for /f "tokens=1-3 delims= " %%a in (abc.txt) do (
set mac=%%c
set mac=!mac::=!
set cname=%%b
>>"mac.ini" echo !mac!=%%a,!cname:~10!
)
pause
```
Floor3 dato Posted 2008-08-24 13:09
高级用户 Posts 377 Credits 916
Floor4 weasel Posted 2009-02-19 01:20
初级用户 Posts 66 Credits 118
Post again


@echo off

:Address Scan
echo Intranet IP segment MAC address scan
echo.
echo If you don't want to scan, enter . To scan, enter the first three segments of the IP segment you want to scan (for example: 192.168.1):
set /p ipa=
IF /I '%ipa%'=='Y' goto ipend
echo.
echo Processing data, please wait a moment........
echo.
for /l %%i in (1 1 254) do start/b ping -n 1 -w 1 %ipa%.%%i>nul && echo Connected: %ipa%.%%i
arp -a|findstr /v "00-00-00-00-00-00"|more
arp -d
goto Address Scan
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023