中国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-27 14:18
47,813 topics / 349,918 posts / today 0 new / 48,276 members
DOS批处理 & 脚本技术(批处理室) » Original: 原创!发个实用的局域网快速检测批处理(3月16日更新) Translation: Original! Post a practical LAN quick detection batch processing (updated on March 16)
Printable Version  3,855 / 15
Floor1 bat-zw Posted 2008-03-09 18:30
金牌会员 Posts 1,276 Credits 3,105
The original code is as follows. I know there are a lot of things for detecting the local area network now, but I just like to P, and it feels different to use my own things. Hehe (mainly because I can modify and improve it in time):


[ Last edited by zw19750516 on 2008-3-16 at 02:57 PM ]
Floor2 bat-zw Posted 2008-03-10 00:52
金牌会员 Posts 1,276 Credits 3,105
Hehe, no one cares, I'll cheer myself up.
Floor3 hnfeng Posted 2008-03-10 12:53
初级用户 Posts 36 Credits 89
Thanks for sharing.
Learned...
Floor4 HAT Posted 2008-03-10 13:38
版主 Posts 5,017 Credits 9,023
Skills for handling special characters in the set command, the LZ used it well, heh.
Floor5 bjsh Posted 2008-03-10 18:46
银牌会员 Posts 621 Credits 2,000
Floor6 bat-zw Posted 2008-03-10 18:49
金牌会员 Posts 1,276 Credits 3,105
Thanks, boss. Let's all work hard together!
Floor7 hhz520 Posted 2008-03-10 21:03
初级用户 Posts 8 Credits 20
Oh, so many windows. I almost got scared by it, heh!
Floor8 bat-zw Posted 2008-03-11 03:21
金牌会员 Posts 1,276 Credits 3,105
Everyone, please pay attention to closing other applications during the detection. The characteristic of this P is fast, but it also causes a shortcoming: occupying extremely high memory within a short time (about one minute). It is recommended that those with poor computer configurations do not use it.
Floor9 dato Posted 2008-03-11 09:56
高级用户 Posts 377 Credits 916
Floor10 bat-zw Posted 2008-03-11 19:38
金牌会员 Posts 1,276 Credits 3,105
I have also checked for incorrect codes, detected various situations, and made aesthetic improvements. Everyone can rest assured to test and use it.
Floor11 bat-zw Posted 2008-03-16 13:46
金牌会员 Posts 1,276 Credits 3,105
In order to improve together for everyone, I have to be a bit selfish and bump it myself, hehe.
Floor12 usafbi2007 Posted 2008-03-17 10:40
新手上路 Posts 4 Credits 8
Thanks for sharing. Learned...
Floor13 bat-zw Posted 2008-03-26 13:31
金牌会员 Posts 1,276 Credits 3,105
```batch
@echo off&color 9f&setlocal EnableDelayedExpansion
title LAN Quick Detection Tool
echo.
echo.
echo ************************** LAN Quick Detection Tool **************************
echo   *----------------------------------------------------------------------*
echo   * This tool integrates functions of detecting the local area network card, detecting the gateway, and finding all online computers in the LAN. In particular, when there are active ARP trojans in the LAN, it can quickly find out the problematic computers. To prevent errors with dual network cards, this tool also adds the function of user inputting IP. Before using this tool, please create text documents (.txt) named gateway and use in the folder where the tool is located. In gateway, input the IP and MAC address of the LAN gateway in sequence. Note that there should be no space between IP and MAC. In use, input the IP addresses of all computers in the LAN and the department or person in use in sequence. Input one group per line and note that add a ":" after the IP. This is to determine the end character of the string when finding the IP (so that the IP ending with "#" will not be found when finding the IP ending with "*#" and "*#*", such as 1 21 181).   *
echo *----------------------------------------------------------------------*
echo   *  Note: Please temporarily close all applications when detecting the LAN. Many black windows will pop up during the detection, which is running the ping test command. Just wait for one minute, and all pop-up windows will close automatically. *
echo   *----------------------------------------------------------------------*
echo   ************************************************************************
pause
cls&mode con lines=15
set u=■■■■■■■■■■■■■■■■■■■■■■■■■
set a=0
for /l %%i in (1,1,20) do call :show %%i
cls
echo.&echo.&echo.&echo.
echo Program is initializing...
echo ┌─────────────────────────┐
echo %u%100%%
echo └─────────────────────────┘
ping /n 3 127.1 >nul
if exist l*.txt del l*.txt
if exist mac*.txt del mac*.txt
if exist jiance.txt del jiance.txt
______________________________________________
rem Ping test for the local area network card
cls
set lan=192.168.1.
echo.&echo.&echo.&echo.
set/p lan= Please enter the LAN segment (input format is 192.168.1., press Enter directly to default to 192.168.1.):
cls
set ip=255
echo.&echo.&echo.&echo.
set/p ip= Please enter the last digit of the local LAN IP address (press Enter directly to default to 255):
ping %lan%%ip% -n 2 >nul
if errorlevel 1 goto wrong1
cls
echo.&echo.&echo.&echo.
echo   ====================================
echo   ****************************** Network card is unobstructed!*******************************
echo   ====================================
ping -n 3 127.1 >nul
______________________________________________
rem Ping test for the gateway
cls&arp -d 2>nul
set pi=1
echo.&echo.&echo.&echo.
set/p pi= Please enter the last digit of the LAN gateway IP address (press Enter directly to default to 1):
ping %lan%%pi% -n 2 >nul
if errorlevel 1 goto wrong2
goto select1
______________________________________________
rem Ping test for the LAN to find all online computers
:ping
echo. >lb.txt
echo. >>lb.txt
echo   ==================================== >>lb.txt
echo   ************************ The following computers in the LAN are online! ************************ >>lb.txt
echo   ==================================== >>lb.txt
for /l %%i in (0,1,255) do start ping -n 1 %lan%%%i
for /f "skip=3 tokens=*" %%k in ('arp -a') do echo %%k >>mac.txt
for /f "tokens=1" %%j in ('findstr /c:"dynamic" mac.txt') do (
findstr /c:"%%j:" use.txt >>lb.txt
)
cls&mode con lines=30&type lb.txt | more
pause
______________________________________________
rem Detect whether there is ARP spoofing in the LAN
cls&fc gateway.txt jiance.txt
if errorlevel 2 goto find
if errorlevel 1 goto find
goto show2
______________________________________________
rem Find the computer infected with the trojan
:find
cls
echo. >ld.txt
echo. >>ld.txt
echo   ==================================== >>ld.txt
echo   ********************* The above computers in the LAN are infected with ARP trojans!********************* >>ld.txt
echo   ==================================== >>ld.txt

for /f "skip=3 tokens=2" %%i in (la.txt) do findstr /c:"%%i" mac.txt >>lc.txt
for /f "tokens=1" %%i in (lc.txt) do findstr /c:"%%i:" use.txt >>ld.txt
type ld.txt | more
pause
______________________________________________
:end
cls&mode con lines=15
echo.&echo.&echo.&echo.
echo   ====================================
echo ************************* Detection completed, press any key to exit!**************************
echo ====================================
pause >nul
del l*.txt jiance.txt mac*.txt&goto :eof
:show2
cls&mode con lines=15
echo.&echo.&echo.&echo.
echo   ====================================
echo   ***************** After detection, there is no ARP spoofing in the LAN, and the network is secure! ******************
echo   ====================================
pause
goto end
:select1
cls
echo.&echo.&echo.&echo.
echo   ====================================
echo   ***************************** Gateway is unobstructed!********************************
echo   ====================================
ping -n 2 127.1 >nul&arp -a >la.txt
cls&for /f "skip=3 tokens=1,2" %%i in ('arp -a') do echo %%i%%j >>jiance.txt
:select2
cls
echo.&echo.&echo.&echo.
set/p select2= Do you want to ping test the LAN? (1. Ping test 2. Do not ping test)
if "%select2%"=="1" goto ping
if "%select2%"=="2" goto end
cls
echo.&echo.&echo.&echo.
echo   ====================================
echo   ***************************** Incorrect input!********************************
echo   ====================================
ping -n 2 127.1 >nul&goto select2
:wrong1
cls
echo.&echo.&echo.&echo.
echo   ====================================
echo   ************************** Network card is not connected, unable to detect!*************************
echo   ====================================
ping -n 3 127.1 >nul&goto :eof
:wrong2
cls
echo.&echo.&echo.&echo.
echo   ====================================
echo   ************************** Network is not connected, unable to detect!*************************
echo   ====================================
ping -n 3 127.1 >nul&goto :eof
:show
cls
set /a a+=4
echo.&echo.&echo.&echo.
echo Program is initializing...
echo ┌─────────────────────────┐
echo !u:~,%1!%a%%%&ping /n 1 127.1 >nul
echo └─────────────────────────┘
goto :eof
```
Floor14 goofy123 Posted 2008-03-26 16:44
初级用户 Posts 17 Credits 36
Great, learning from you~
Floor15 vlq2599 Posted 2008-03-26 17:24
新手上路 Posts 10 Credits 7
Bro, not bad. I can only give you one point. Don't mind it being little.
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023