routeos dnspod 脚本
#PPPoE :local pppoe "接口" #DNSPOD token 腾讯云或阿里云iD 和 秘钥 :local token "ID,token" #域名 :local domain "主域名" #域名主机名 :local subdomain "子域名" #以下不是专业人士请不要修改 #domain :local dname ($subdomain.".".$domain) #获取pppoe拨号ip :local ipaddr [/ip address get [/ip address find interface=$pppoe] address] :set ipaddr [:pick $ipaddr 0 ([len $ipaddr] -3)] #获取域名列表 :local record [/tool fetch url="https://dnsapi.cn/Record.List" http-data="login_token=$token&format=json&domain=$domain&sub_domain=$subdomain&record_type=A" as-value output=user] #获取id和ip :set record ($record->"data") :set record [:pick $record [:find $record "\"records\":"] [:len $record]] :local recordid [:pick $record ([:find $record "\"id\":\""]+6) [:find $record "\",\"ttl"]] :local recordip [:pick $record ([:find $record "\"value\":\""]+9) [:find $record "\",\"en"]] #更新ip地址 :if ($recordip!=$ipaddr) do={ /tool fetch url="https://dnsapi.cn/Record.Ddns" http-data="login_token=$token&format=json&domain=$domain&sub_domain=$subdomain&record_id=$recordid&record_line_id=0&value=$ipaddr" :log info ("[".$dname."] ip update") } else={ :log info ("[".$dname."] ip not update") }
未经允许不得转载:routeos dnspod 脚本
发表评论