找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 5205|回复: 2

[脚本] ROS 2.9.27的QQ服务器脚本在ROS 5.25下运行失败怎么办?

[复制链接]
发表于 2016-3-23 00:35:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
本帖最后由 口觜亻尔 于 2016-3-23 00:37 编辑

收集IP后可到ip fireros 自动获取 QQ 服务器 IP 的方法 (转载)
wall address-list查看相应的IP列表,然后在通过防火墙规则禁止此QQ列表IP通过,达到禁止上QQ的效果!
适用于用ROS的DNS作为内网DNS的环境,配合防火墙规则,可以很好的控制QQ的访问权限

脚本如下:
引用

#脚本如下:
#自动获取QQ服务器IP地址
#QQ服务器域名关键字,多个关键字之间用逗号分隔
:set QQ-STR "tencent,qqtcp"
#QQ地址列表名
:set QQ-LST "D-DST"
#取得DNS缓存的A记录
:set id [/ip dns cache all find type=A]
#对记录进行分析
:foreach i in=$id do={
#取得域名
:set dom [/ip dns cache all get $i name]
:set fond "no"
#判断域名中是否有指定的关键字
:foreach k in=$QQ-STR do={
  :if([:find $dom $k]!=[:nothing]) do={:set fond "yes"}
  }
#找到关键字的话,就把IP地址保存在指定地址列表中
:if($fond="yes") do={
  /ip firewall address-list add list=$QQ-LST disabled=no address=[/ip dns cache all get $i data]
  }
}
#清除缓存,以便寻找新的IP
/ip dns cache flush

---------------------------------------------------------
请问各位高手,此脚本在ROS 5.25下失败。是哪个地方出问题了,用来收集其它域名用。
试不出来是哪里不行。


routeros
发表于 2016-5-4 11:05:03 | 显示全部楼层
:foreach i in=[/ip dns cache all find type="A"] \
     do={
            :foreach j in=[:toarray "tencent,qqtcp"] \
                 do={
                        :local doname [/ip dns cache get $i name]
                        :if ($doname~$j) \
                            do={
                                   :local address [/ip dns cache get $i address]
                                   :if ([:len [/ip firewall address-list find list=QQ-LST && address=$address]]=0) \
                                       do={/ip firewall address-list add list=QQ-LST comment=$doname address=$address timeout=1w}
                                  }
                       }
          }
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-16 12:07 , Processed in 0.087657 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表