生产域名被DNS劫持

 

苏州地区客户反应浏览公司网站的时候,ip地址被跳转到别的页面

 

 

 

 

 

 

初步判断是DNS劫持,为了收集信息和修改dns,写了如下脚本

@echo off

cls

color 0A

chcp 65001

Echo *******************************************************************************

Echo          Collect fault information…………

Echo *******************************************************************************
ipconfig /all > "%userprofile%"\desktop\故障处理.txt
echo. >> "%userprofile%"\desktop\故障处理.txt
echo. >> "%userprofile%"\desktop\故障处理.txt
nslookup -qt=ns 51cjml.com >> "%userprofile%"\desktop\故障处理.txt

Echo *******************************************************************************

Echo          正在修改IP地址和DNS服务器地址,请耐心等待…………

Echo *******************************************************************************

::cmd /c netsh interface ip set address name="本地连接" source=static addr=192.168.1.136 mask=255.255.255.0 gateway=192.168.0.1 gwmetric=1

cmd /c netsh interface ip set dns name="以太网" source=static addr=114.114.114.114

cmd /c netsh interface ip add dns name="以太网" addr=127.0.0.1 index=2

cmd /c netsh interface ip set dns name="本地连接" source=static addr=114.114.114.114

cmd /c netsh interface ip add dns name="本地连接" addr=127.0.0.1 index=2

cmd /c netsh interface ip set dns name="WLAN" source=static addr=8.8.8.8

cmd /c netsh interface ip add dns name="WLAN" addr=127.0.0.1 index=2

ipconfig /all

Echo *******************************************************************************

Echo          OK!!已修改成功!请按任意键继续…………

Echo          All done

Echo *******************************************************************************

Pause

 

再此修改为动态

@echo off

cls

color 0A

Echo *******************************************************************************

Echo          正在修改IP地址和DNS服务器地址,请耐心等待…………

Echo *******************************************************************************

netsh interface ip set address name="本地连接" source=dhcp

netsh interface ip delete dns "本地连接" all

ipconfig /flushdns

ipconfig /all

Echo *******************************************************************************

Echo          OK!!已修改成功!请按任意键继续…………

Echo          All done

Echo *******************************************************************************
pause

 

posted @ 2020-08-27 13:54  ascertain  阅读(279)  评论(0编辑  收藏  举报