VPS参考测评推荐
专注分享VPS主机优惠信息
衡天云优惠活动
热网互联2026年促销活动
hostkvm优惠促销活动
zji优惠促销活动

广东移动内穿扫描IP段的小想法

主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情!
我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作

又看到有人秀广东移动内穿了

也是不说IP

不过最开始的在坛子里秀广东移动内穿的MJJ说了是172段的IP

另外再百度了一下,在V2EX看到了同是讨论此内容的帖子

评论中称是216或219段,根据各地dns查询来看

应该就是指172.216.xxx.xxx或者172.219.xxx.xxx

接着我百度查了一下,curl指定ip或者host的方法

命令是这样的

  1. curl -H “域名” “ip
  2. #如
  3. curl -H “www.google.com” “172.216.1.1”
  4. #加上设置3S超时
  5. curl –connect-timeout 3 -H “www.google.com” “172.216.1.1”

复制代码

不过在这里C段应该只有少数几个到几十个,暂时看到有的是172.216.2x.xx

现在只说思路,就是扫IP连通性的思路,直接ping也许也行

回到脚本,IP范围是0~255

所以做一个for循环0~255即可

  1. for ((i=0;i<=255;i++))
  2. do
  3. #这里i就是C段
  4. done

复制代码

嵌套一个D段

  1. for ((i=0;i<=255;i++))
  2. do
  3.         #这里i就是C段
  4.         for ((d=0;d<=255;d++))
  5.                 do
  6.                 #这里d就是D段
  7.                 done
  8. done

复制代码

设置变量,拼接一下IP

  1. bip=”172.216.”
  2. for ((i=0;i<=255;i++))
  3. do
  4.         #这里i就是C段
  5.         cip=$bip$i
  6.         for ((d=0;d<=255;d++))
  7.                 do
  8.                 #这里d就是D段
  9.                 dip=$cip$d
  10.                 done
  11. done

复制代码

加上curl的命令

  1. bip=”172.216.”
  2. for ((i=0;i<=255;i++))
  3. do
  4.         #这里i就是C段
  5.         cip=$bip$i
  6.         for ((d=0;d<=255;d++))
  7.                 do
  8.                         #这里d就是D段
  9.                         dip=$cip$d
  10.                         curl –connect-timeout 3 -H “www.google.com” $dip
  11.                 done
  12. done

复制代码

判断curl命令的返回值可知IP是否连通
如果通了则能在返回值中找到”google”,否则反之

  1. bip=”172.216.”
  2. for ((i=0;i<=255;i++))
  3. do
  4.         #这里i就是C段
  5.         cip=$bip$i
  6.         for ((d=0;d<=255;d++))
  7.                 do
  8.                         #这里d就是D段
  9.                         dip=$cip$d
  10.                         echo $(curl –connect-timeout 3 -H “www.google.com” $dip | grep “google”)
  11.                 done
  12. done

复制代码

加一个判断

  1. bip=”172.216.”
  2. for ((i=0;i<=255;i++))
  3. do
  4.         #这里i就是C段
  5.         cip=$bip$i
  6.         for ((d=0;d<=255;d++))
  7.                 do
  8.                         #这里d就是D段
  9.                         dip=$cip$d
  10.                         #echo $(curl –connect-timeout 3 -H “www.google.com” $dip | grep “google”)
  11.                         if [$(curl –connect-timeout 3 -H “www.google.com” $dip | grep “google”) != “” ]
  12.                         then
  13.                                 echo “IP “+$dip+” 连通”
  14.                         else
  15.                                 echo “IP “+$dip+” 不连通”
  16.                         fi
  17.                 done
  18. done

复制代码

加一个保存IP到文本文件

  1. bip=”172.216.”
  2. for ((i=0;i<=255;i++))
  3. do
  4.         #这里i就是C段
  5.         cip=$bip$i
  6.         for ((d=0;d<=255;d++))
  7.                 do
  8.                         #这里d就是D段
  9.                         dip=$cip$d
  10.                         #echo $(curl –connect-timeout 3 -H “www.google.com” $dip | grep “google”)
  11.                         if [$(curl –connect-timeout 3 -H “www.google.com” $dip | grep “google”) != “” ]
  12.                         then
  13.                                 echo “IP “+$dip+” 连通”
  14.                                 touch testip.txt
  15.                                 echo $dip &gt;&gt; testip.txt
  16.                         else
  17.                                 echo “IP “+$dip+” 不连通”
  18.                         fi
  19.                 done
  20. done

复制代码

思路就是这么个思路

各路大神的回复:

注册: 现在办一个移动宽带还来得及吗?

这几篇文章你可能也喜欢:

  • 暂无相关推荐文章

本文由主机参考刊发,转载请注明:广东移动内穿扫描IP段的小想法 https://dev-web.zhujicankao.com/23621.html

【腾讯云】领8888元采购礼包,抢爆款云服务器 每月 9元起,个人开发者加享折上折!
打赏
转载请注明原文链接:主机参考 » 广东移动内穿扫描IP段的小想法
主机参考仅做资料收集,不对商家任何信息及交易做信用担保,购买前请注意风险,有交易纠纷请自行解决!请查阅:特别声明

评论 抢沙发

评论前必须登录!