51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

【Windows-脚本】快速收集网络信息

1、说明:用于收集终端的网卡IP信息,查看IPv4路由表,解析域名测试,追踪域名路径,查看国内出口IP,查看国外出口IP,测试ping阿里云DNS和谷歌DNS20个包。 {#1%E3%80%81%E8%AF%B4%E6%98%8E%EF%BC%9A%E7%94%A8%E4%BA%8E%E6%94%B6%E9%9B%86%E7%BB%88%E7%AB%AF%E7%9A%84%E7%BD%91%E5%8D%A1ip%E4%BF%A1%E6%81%AF%EF%BC%8C%E6%9F%A5%E7%9C%8Bipv4%E8%B7%AF%E7%94%B1%E8%A1%A8%EF%BC%8C%E8%A7%A3%E6%9E%90%E5%9F%9F%E5%90%8D%E6%B5%8B%E8%AF%95%EF%BC%8C%E8%BF%BD%E8%B8%AA%E5%9F%9F%E5%90%8D%E8%B7%AF%E5%BE%84%EF%BC%8C%E6%9F%A5%E7%9C%8B%E5%9B%BD%E5%86%85%E5%87%BA%E5%8F%A3ip%EF%BC%8C%E6%9F%A5%E7%9C%8B%E5%9B%BD%E5%A4%96%E5%87%BA%E5%8F%A3ip%EF%BC%8C%E6%B5%8B%E8%AF%95ping%E9%98%BF%E9%87%8C%E4%BA%91dns%E5%92%8C%E8%B0%B7%E6%AD%8Cdns20%E4%B8%AA%E5%8C%85%E3%80%82}

2、使用:将以下信息复制到txt文本文档,后缀改成bat格式保存,并以管理员身份运行即可(cmd窗口不要关闭,脚本跑完,自己关闭)。 {#2%E3%80%81%E4%BD%BF%E7%94%A8%EF%BC%9A%E5%B0%86%E4%BB%A5%E4%B8%8B%E4%BF%A1%E6%81%AF%E5%A4%8D%E5%88%B6%E5%88%B0txt%E6%96%87%E6%9C%AC%E6%96%87%E6%A1%A3%EF%BC%8C%E5%90%8E%E7%BC%80%E6%94%B9%E6%88%90bat%E6%A0%BC%E5%BC%8F%E4%BF%9D%E5%AD%98%EF%BC%8C%E5%B9%B6%E4%BB%A5%E7%AE%A1%E7%90%86%E5%91%98%E8%BA%AB%E4%BB%BD%E8%BF%90%E8%A1%8C%E5%8D%B3%E5%8F%AF%EF%BC%88cmd%E7%AA%97%E5%8F%A3%E4%B8%8D%E8%A6%81%E5%85%B3%E9%97%AD%EF%BC%8C%E8%84%9A%E6%9C%AC%E8%B7%91%E5%AE%8C%EF%BC%8C%E8%87%AA%E5%B7%B1%E5%85%B3%E9%97%AD%EF%BC%89%E3%80%82}

Snipaste_2023-07-06_15-27-04

Snipaste_2023-07-06_15-27-55

3、结果:去C盘根目录查看log.txt文件就是。 {#3%E3%80%81%E7%BB%93%E6%9E%9C%EF%BC%9A%E5%8E%BBc%E7%9B%98%E6%A0%B9%E7%9B%AE%E5%BD%95%E6%9F%A5%E7%9C%8Blog.txt%E6%96%87%E4%BB%B6%E5%B0%B1%E6%98%AF%E3%80%82}

Snipaste_2023-07-06_15-29-16

@echo off
chcp 936 > nul
setlocal

set LOG_FILE=C:\\log.txt


break \> %LOG_FILE%


ipconfig /all \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%


route print -4 \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%


ipconfig /flushdns \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


nslookup www.baidu.com \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


nslookup www.google.com \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


nslookup www.youtube.com \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


tracert -d -w 1 www.baidu.com \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


tracert -d -w 1 www.google.com \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


tracert -d -w 1 www.youtube.com \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


curl 4.ipw.cn \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


curl ipinfo.io \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


ping -n 20 223.5.5.5 \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


ping -n 20 8.8.8.8  \>\> %LOG_FILE%
echo. \>\> %LOG_FILE%
echo =============================================================== \>\> %LOG_FILE%


endlocal

赞(2)
未经允许不得转载:工具盒子 » 【Windows-脚本】快速收集网络信息