|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『楼 主』:
原创!发个实用的局域网快速检测批处理(3月16日更新)
使用 LLM 解释/回答一下
原代码如下,我知道现在检测局域网的东东特别多,但我就是喜欢P,同时自己的东西用起来感觉不一样,呵呵(主要是能及时修改完善):
@echo off&color 9f&setlocal EnableDelayedExpansion
title 局域网快速检测工具
echo.
echo.
echo ************************** 局域网快速检测工具 **************************
echo *----------------------------------------------------------------------*
echo * 本工具集检测本机网卡、检测网关、查找局域网所有在线电脑几项功能于一*
echo *----------------------------------------------------------------------*
echo *体,特别是当局域网中有活动的ARP木马时,可迅速查找出有问题的电脑。为防 *
echo *----------------------------------------------------------------------*
echo *双网卡出错,本工具还增加了用户自行输入IP功能。在使用本工具前请在工具所*
echo *----------------------------------------------------------------------*
echo *在的文件夹新建名为gateway和use的文本文档(.txt),在gateway中依次输入 *
echo *___________________________________*
echo *局域网关的IP和MAC地址,注意IP和MAC间不能有空格,在USE中依次输入局域网 *
echo *----------------------------------------------------------------------*
echo *中所有电脑的IP地址和使用部门或人,一行输入一组并注意IP加个":",这是为 *
echo *----------------------------------------------------------------------*
echo *了查找IP时确定字串符结尾符(这就不会在查找以"#"结尾的IP时把以"*#"以及 *
echo *----------------------------------------------------------------------*
echo *"$#*"结尾的IP查找出来了,如 1 21 181 )。 *
echo *----------------------------------------------------------------------*
echo * 注:当检测局域网时请暂时关闭所有应用程序,在检测时会弹出很多黑色的*
echo *----------------------------------------------------------------------*
echo *窗口,这是在运行拼测命令,只要等待一分钟,所有弹出窗口都会自行关闭。 *
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 程序正在初始化. . .
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 对本机网卡进行拼测
cls
echo.&echo.&echo.&echo.
set/p lan= 请输入局域网段(输入格式为192.168.1.,直接回车默认为192.168.1.):
if "%lan%"=="" goto p1
goto p2
:p1
set lan=192.168.1.
:p2
cls
echo.&echo.&echo.&echo.
set/p ip= 请输入本机局域网IP地址的最后一个数字(直接回车默认为255):
if "%ip%"=="" goto p3
ping %lan%%ip% -n 2 >nul
if errorlevel 2 goto wrong1
if errorlevel 1 goto wrong1
goto show1
:p3
ping %lan%255 -n 2 >nul
if errorlevel 2 goto wrong1
if errorlevel 1 goto wrong1
:show1
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ****************************** 网卡通畅!*******************************
echo ====================================
ping -n 3 127.1 >nul
______________________________________________
rem 对网关进行拼测
cls&arp -d 2>nul
echo.&echo.&echo.&echo.
set/p pi= 请输入局域网关IP地址的最后一个数字(直接回车默认为1):
if "%pi%"=="" goto p4
ping %lan%%pi% -n 2 >nul
if errorlevel 2 goto wrong2
if errorlevel 1 goto wrong2
goto select1
:p4
ping %lan%1 -n 2 >nul
if errorlevel 2 goto wrong2
if errorlevel 1 goto wrong2
goto select1
______________________________________________
rem 对局域网进行拼测,查找出所有在线电脑
:ping
echo. >lb.txt
echo. >>lb.txt
echo ==================================== >>lb.txt
echo ************************ 局域网中以下电脑在线! ************************ >>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 检测局域网是否有ARP欺骗
cls&fc gateway.txt jiance.txt
if errorlevel 2 goto find
if errorlevel 1 goto find
goto show2
______________________________________________
rem 查找出中了木马的电脑
:find
cls
echo. >ld.txt
echo. >>ld.txt
echo ==================================== >>ld.txt
echo ********************* 局域网中以上电脑中了ARP木马!********************* >>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 ************************* 检测完成请按键退出!**************************
echo ====================================
pause >nul
del l*.txt jiance.txt mac*.txt&goto :eof
:show2
cls&mode con lines=15
echo.&echo.&echo.&echo.
echo ====================================
echo ***************** 经检测局域网中无ARP欺骗,网络安全! ******************
echo ====================================
pause
goto end
:select1
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ***************************** 网关通畅!********************************
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= 是否对局域网进行拼测?(1.拼测 2.不拼测)
if "%select2%"=="1" goto ping
if "%select2%"=="2" goto end
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ***************************** 输入错误!********************************
echo ====================================
ping -n 2 127.1 >nul&goto select2
:wrong1
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ************************** 网卡不通,无法检测!*************************
echo ====================================
ping -n 3 127.1 >nul&goto :eof
:wrong2
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ************************** 网络不通,无法检测!*************************
echo ====================================
ping -n 3 127.1 >nul&goto :eof
:show
cls
set /a a+=4
echo.&echo.&echo.&echo.
echo 程序正在初始化. . .
echo ┌─────────────────────────┐
echo !u:~,%1!%a%%%&ping /n 1 127.1 >nul
echo └─────────────────────────┘
goto :eof
Last edited by zw19750516 on 2008-3-16 at 02:57 PM ]
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):
@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 machine's 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 users entering IPs by themselves. Please create text documents (.txt) named gateway and use in the folder where the tool is located before using this tool. Enter the IP and MAC address of the LAN gateway in gateway in sequence. Note that there should be no space between the IP and MAC. Enter the IP addresses of all computers in the LAN and the departments or people using them in use in sequence. Enter one group per line and note to add a ":" after the IP. This is to determine the end character of the string when finding the IP (this will not find IPs ending with "*#" and "*$#" when finding IPs ending with "#", 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 are running the ping test commands. Just wait for one minute, and all the pop-up windows will close by themselves. *
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 The 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 machine's network card
cls
echo.&echo.&echo.&echo.
set/p lan= Please enter the LAN segment (the input format is 192.168.1., press Enter directly to default to 192.168.1.):
if "%lan%"=="" goto p1
goto p2
:p1
set lan=192.168.1.
:p2
cls
echo.&echo.&echo.&echo.
set/p ip= Please enter the last digit of the local machine's LAN IP address (press Enter directly to default to 255):
if "%ip%"=="" goto p3
ping %lan%%ip% -n 2 >nul
if errorlevel 2 goto wrong1
if errorlevel 1 goto wrong1
goto show1
:p3
ping %lan%255 -n 2 >nul
if errorlevel 2 goto wrong1
if errorlevel 1 goto wrong1
:show1
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
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):
if "%pi%"=="" goto p4
ping %lan%%pi% -n 2 >nul
if errorlevel 2 goto wrong2
if errorlevel 1 goto wrong2
goto select1
:p4
ping %lan%1 -n 2 >nul
if errorlevel 2 goto wrong2
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 if 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 computers 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 unobstructed, unable to detect!*************************
echo ====================================
ping -n 3 127.1 >nul&goto :eof
:wrong2
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ************************** Network is not unobstructed, unable to detect!*************************
echo ====================================
ping -n 3 127.1 >nul&goto :eof
:show
cls
set /a a+=4
echo.&echo.&echo.&echo.
echo The program is initializing...
echo ┌─────────────────────────┐
echo !u:~,%1!%a%%%&ping /n 1 127.1 >nul
echo └─────────────────────────┘
goto :eof
Last edited by zw19750516 on 2008-3-16 at 02:57 PM ]
此帖被 +5 点积分 点击查看详情 评分人:【 bjsh 】 | 分数: +4 | 时间:2008-3-10 18:46 | 评分人:【 vlq2599 】 | 分数: +1 | 时间:2008-3-26 17:23 |
|
|
|
2008-3-9 18:30 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
呵呵,无人问津,自己给自己加下油了。
Hehe, no one cares, I'll cheer myself up.
|
|
2008-3-10 00:52 |
|
|
hnfeng
初级用户
 
积分 89
发帖 36
注册 2007-12-20
状态 离线
|
|
2008-3-10 12:53 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
set命令中特殊字符的处理技巧,楼主用的挺好,呵呵。
Skills for handling special characters in the set command, the LZ used it well, heh.
|
|
2008-3-10 13:38 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
|
2008-3-10 18:46 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
谢谢老大了,大家一起加油了!
Thanks, boss. Let's all work hard together!
|
|
2008-3-10 18:49 |
|
|
hhz520
初级用户
 
积分 20
发帖 8
注册 2007-7-4
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
晕 这么多窗口 差D给你吓死 呵呵!
Oh, so many windows. I almost got scared by it, heh!
|
|
2008-3-10 21:03 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
大家请注意在检测时关闭其他应用程序,这个P的特点就是快,但也造成了它的缺点:短时间内(约一分钟)占用内存极高,建议电脑配置不好的不要使用。
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.
|
|
2008-3-11 03:21 |
|
|
dato
高级用户
   
积分 916
发帖 377
注册 2004-3-8
状态 离线
|
|
2008-3-11 09:56 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
我又做了错码的检查,同时对各种情况进行了检测,同时还做了美观上的处理,请大家放心测试和使用了。
I have also checked for incorrect codes, detected various situations, and made aesthetic improvements. Everyone can rest assured to test and use it.
|
|
2008-3-11 19:38 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
为了大家共同提高,只好自私点,自己顶下了,呵呵。
In order to improve together for everyone, I have to be a bit selfish and bump it myself, hehe.
|
|
2008-3-16 13:46 |
|
|
usafbi2007
新手上路

积分 8
发帖 4
注册 2008-1-8
状态 离线
|
|
2008-3-17 10:40 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 13 楼』:
再次修改(简化部分代码)
使用 LLM 解释/回答一下
@echo off&color 9f&setlocal EnableDelayedExpansion
title 局域网快速检测工具
echo.
echo.
echo ************************** 局域网快速检测工具 **************************
echo *----------------------------------------------------------------------*
echo * 本工具集检测本机网卡、检测网关、查找局域网所有在线电脑几项功能于一*
echo *----------------------------------------------------------------------*
echo *体,特别是当局域网中有活动的ARP木马时,可迅速查找出有问题的电脑。为防 *
echo *----------------------------------------------------------------------*
echo *双网卡出错,本工具还增加了用户自行输入IP功能。在使用本工具前请在工具所*
echo *----------------------------------------------------------------------*
echo *在的文件夹新建名为gateway和use的文本文档(.txt),在gateway中依次输入 *
echo *___________________________________*
echo *局域网关的IP和MAC地址,注意IP和MAC间不能有空格,在USE中依次输入局域网 *
echo *----------------------------------------------------------------------*
echo *中所有电脑的IP地址和使用部门或人,一行输入一组并注意IP加个":",这是为 *
echo *----------------------------------------------------------------------*
echo *了查找IP时确定字串符结尾符(这就不会在查找以"#"结尾的IP时把以"*#"以及 *
echo *----------------------------------------------------------------------*
echo *"$#*"结尾的IP查找出来了,如 1 21 181 )。 *
echo *----------------------------------------------------------------------*
echo * 注:当检测局域网时请暂时关闭所有应用程序,在检测时会弹出很多黑色的*
echo *----------------------------------------------------------------------*
echo *窗口,这是在运行拼测命令,只要等待一分钟,所有弹出窗口都会自行关闭。 *
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 程序正在初始化. . .
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 对本机网卡进行拼测
cls
set lan=192.168.1.
echo.&echo.&echo.&echo.
set/p lan= 请输入局域网段(输入格式为192.168.1.,直接回车默认为192.168.1.):
cls
set ip=255
echo.&echo.&echo.&echo.
set/p ip= 请输入本机局域网IP地址的最后一个数字(直接回车默认为255):
ping %lan%%ip% -n 2 >nul
if errorlevel 1 goto wrong1
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ****************************** 网卡通畅!*******************************
echo ====================================
ping -n 3 127.1 >nul
______________________________________________
rem 对网关进行拼测
cls&arp -d 2>nul
set pi=1
echo.&echo.&echo.&echo.
set/p pi= 请输入局域网关IP地址的最后一个数字(直接回车默认为1):
ping %lan%%pi% -n 2 >nul
if errorlevel 1 goto wrong2
goto select1
______________________________________________
rem 对局域网进行拼测,查找出所有在线电脑
:ping
echo. >lb.txt
echo. >>lb.txt
echo ==================================== >>lb.txt
echo ************************ 局域网中以下电脑在线! ************************ >>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 检测局域网是否有ARP欺骗
cls&fc gateway.txt jiance.txt
if errorlevel 2 goto find
if errorlevel 1 goto find
goto show2
______________________________________________
rem 查找出中了木马的电脑
:find
cls
echo. >ld.txt
echo. >>ld.txt
echo ==================================== >>ld.txt
echo ********************* 局域网中以上电脑中了ARP木马!********************* >>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 ************************* 检测完成请按键退出!**************************
echo ====================================
pause >nul
del l*.txt jiance.txt mac*.txt&goto :eof
:show2
cls&mode con lines=15
echo.&echo.&echo.&echo.
echo ====================================
echo ***************** 经检测局域网中无ARP欺骗,网络安全! ******************
echo ====================================
pause
goto end
:select1
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ***************************** 网关通畅!********************************
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= 是否对局域网进行拼测?(1.拼测 2.不拼测)
if "%select2%"=="1" goto ping
if "%select2%"=="2" goto end
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ***************************** 输入错误!********************************
echo ====================================
ping -n 2 127.1 >nul&goto select2
:wrong1
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ************************** 网卡不通,无法检测!*************************
echo ====================================
ping -n 3 127.1 >nul&goto :eof
:wrong2
cls
echo.&echo.&echo.&echo.
echo ====================================
echo ************************** 网络不通,无法检测!*************************
echo ====================================
ping -n 3 127.1 >nul&goto :eof
:show
cls
set /a a+=4
echo.&echo.&echo.&echo.
echo 程序正在初始化. . .
echo ┌─────────────────────────┐
echo !u:~,%1!%a%%%&ping /n 1 127.1 >nul
echo └─────────────────────────┘
goto :eof
```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
```
|
|
2008-3-26 13:31 |
|
|
goofy123
初级用户
 
积分 36
发帖 17
注册 2008-1-7
状态 离线
|
|
2008-3-26 16:44 |
|
|
vlq2599
新手上路

积分 7
发帖 10
注册 2006-1-9
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
兄弟,不错,我只能给你加一分,不要嫌少呀
Bro, not bad. I can only give you one point. Don't mind it being little.
|
|
2008-3-26 17:24 |
|