替换上你的 API Token,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。
获得 domain_id 可以用 curl
curl -k https://dnsapi.cn/Domain.List -d "login_token=TOKEN"`| #!/bin/env python | |
| import requests | |
| url = 'http://YOUR_HOST_NAME/api/v1/data' | |
| def netdata(chart): | |
| r = requests.get(url, params={ | |
| 'chart': chart, | |
| 'points': 1, | 
| #!/usr/bin/env python | |
| #-*- coding:utf-8 -*- | |
| """Tool for import one domain from dnspod.cn to dnspod.com. Just import records which record_line is 默认 | |
| usage: %s DOMAIN [DOMAIN2] [DOMAIN3] ... | |
| Modify this script first, enter both cn & com account infomation. | |
| If DOMAIN not exists in your dnspod.com account, will add it first. | |
| """ | |
| import httplib, urllib | 
| $ http post https://io.notie.io/ source_id:=186 secret=XXXXXX title=test action=test content=test -v | |
| POST / HTTP/1.1 | |
| Accept: application/json | |
| Accept-Encoding: gzip, deflate, compress | |
| Content-Length: 97 | |
| Content-Type: application/json; charset=utf-8 | |
| Host: io.notie.io | |
| User-Agent: HTTPie/0.7.2 | |
| { | 
| # from __future__ import print_function | |
| import functools | |
| def memoize(obj): | |
| cache = obj.cache = {} | |
| @functools.wraps(obj) | |
| def memoizer(*args, **kwargs): | |
| if args not in cache: | 
| #-*- coding:utf-8 -*- | |
| # Author: @chuangbo | |
| # For: @likexian | |
| import socket | |
| import struct | |
| class CIDR: | |
| '''Check if ip in cidr | 
| #include <iostream> | |
| using namespace std; | |
| int main() { | |
| if ( (10 > 5 > 3) == true) { | |
| cout << "10 > 5 > 3 = true" << endl; | |
| } else { | |
| cout << "10 > 5 > 3 = false" << endl; | |
| } | |
| return 0; | 
| ``` | |
| $ dig +trace www.douban.com | |
| ; <<>> DiG 9.7.3-P3 <<>> +trace www.douban.com | |
| ;; global options: +cmd | |
| . 23374 IN NS j.root-servers.net. | |
| . 23374 IN NS f.root-servers.net. | |
| . 23374 IN NS c.root-servers.net. | |
| . 23374 IN NS h.root-servers.net. | |
| . 23374 IN NS i.root-servers.net. | 
替换上你的 API Token,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。
获得 domain_id 可以用 curl
curl -k https://dnsapi.cn/Domain.List -d "login_token=TOKEN"`| #!/usr/bin/python | |
| # -*- coding: utf8 -*- | |
| _actions = [] | |
| def action(f): | |
| """Decorator to register an action.""" | |
| _actions.append(f) | |
| return f | 
| _server.py() | |
| { | |
| local cur prev opts base | |
| COMPREPLY=() | |
| cur="${COMP_WORDS[COMP_CWORD]}" | |
| prev="${COMP_WORDS[COMP_CWORD-1]}" | |
| # | |
| # The first options should be a yaml config | |
| # |