├── requirements.txt ├── dns ├── __pycache__ │ ├── aliyun.cpython-37.pyc │ └── qCloud.cpython-37.pyc ├── qCloud.py └── aliyun.py ├── .github └── workflows │ └── run.yml ├── log.py ├── README.md ├── cf2dns_actions.py ├── cf2dns.py └── cf2dns.log /requirements.txt: -------------------------------------------------------------------------------- 1 | aliyun-python-sdk-alidns==2.6.19 2 | aliyun-python-sdk-core==2.13.29 3 | urllib3==1.25.10 4 | -------------------------------------------------------------------------------- /dns/__pycache__/aliyun.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmmtoo/cf2dns/HEAD/dns/__pycache__/aliyun.cpython-37.pyc -------------------------------------------------------------------------------- /dns/__pycache__/qCloud.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmmtoo/cf2dns/HEAD/dns/__pycache__/qCloud.cpython-37.pyc -------------------------------------------------------------------------------- /.github/workflows/run.yml: -------------------------------------------------------------------------------- 1 | name: 'GitHub Actions CloudFlare2DNSPod Bot' 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | schedule: 8 | - cron: '*/16 * * * *' 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: 'Checkout' 15 | uses: actions/checkout@v2 16 | - name: 'Set up Python' 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: 3.7 20 | - name: 'Install dependencies' 21 | run: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi 22 | - name: 'run cf2dns' 23 | env: 24 | KEY: ${{ secrets.KEY }} 25 | DOMAINS: ${{ secrets.DOMAINS }} 26 | SECRETID: ${{ secrets.SECRETID }} 27 | SECRETKEY: ${{ secrets.SECRETKEY }} 28 | run: python cf2dns_actions.py 29 | -------------------------------------------------------------------------------- /log.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from logging import handlers 3 | 4 | class Logger(object): 5 | level_relations = { 6 | 'debug':logging.DEBUG, 7 | 'info':logging.INFO, 8 | 'warning':logging.WARNING, 9 | 'error':logging.ERROR, 10 | 'crit':logging.CRITICAL 11 | }#日志级别关系映射 12 | 13 | def __init__(self,filename,level='info',when='D',backCount=3,fmt='%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s'): 14 | self.logger = logging.getLogger(filename) 15 | format_str = logging.Formatter(fmt)#设置日志格式 16 | self.logger.setLevel(self.level_relations.get(level))#设置日志级别 17 | sh = logging.StreamHandler()#往屏幕上输出 18 | sh.setFormatter(format_str) #设置屏幕上显示的格式 19 | th = handlers.TimedRotatingFileHandler(filename=filename,when=when,backupCount=backCount,encoding='utf-8')#往文件里写入#指定间隔时间自动生成文件的处理器 20 | #实例化TimedRotatingFileHandler 21 | #interval是时间间隔,backupCount是备份文件的个数,如果超过这个个数,就会自动删除,when是间隔的时间单位,单位有以下几种: 22 | # S 秒 23 | # M 分 24 | # H 小时、 25 | # D 天、 26 | # W 每星期(interval==0时代表星期一) 27 | # midnight 每天凌晨 28 | th.setFormatter(format_str)#设置文件里写入的格式 29 | self.logger.addHandler(sh) #把对象加到logger里 30 | self.logger.addHandler(th) 31 | if __name__ == '__main__': 32 | log = Logger('monitor.log',level='debug') 33 | log.logger.debug('debug') 34 | log.logger.info('info') 35 | log.logger.warning('警告') 36 | log.logger.error('报错') 37 | log.logger.critical('严重') 38 | Logger('error.log', level='error').logger.error('error') -------------------------------------------------------------------------------- /dns/qCloud.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Mail: tongdongdong@outlook.com 4 | # Reference: https://cloud.tencent.com/document/product/302/8517 5 | import base64 6 | import hashlib 7 | import hmac 8 | import random 9 | import time 10 | import operator 11 | import json 12 | import urllib.parse 13 | import urllib3 14 | 15 | class QcloudApi(): 16 | def __init__(self, SECRETID, SECRETKEY): 17 | self.SecretId = SECRETID 18 | self.secretKey = SECRETKEY 19 | 20 | def get(self, module, action, **params): 21 | config = { 22 | 'Action': action, 23 | 'Nonce': random.randint(10000, 99999), 24 | 'SecretId': self.SecretId, 25 | 'SignatureMethod': 'HmacSHA256', 26 | 'Timestamp': int(time.time()), 27 | } 28 | url_base = '{0}.api.qcloud.com/v2/index.php?'.format(module) 29 | 30 | params_all = dict(config, **params) 31 | 32 | params_sorted = sorted(params_all.items(), key=operator.itemgetter(0)) 33 | 34 | srcStr = 'GET{0}'.format(url_base) + ''.join("%s=%s&" % (k, v) for k, v in dict(params_sorted).items())[:-1] 35 | signStr = base64.b64encode(hmac.new(bytes(self.secretKey, encoding='utf-8'), bytes(srcStr, encoding='utf-8'), digestmod=hashlib.sha256).digest()).decode('utf-8') 36 | 37 | config['Signature'] = signStr 38 | 39 | params_last = dict(config, **params) 40 | 41 | params_url = urllib.parse.urlencode(params_last) 42 | 43 | url = 'https://{0}&'.format(url_base) + params_url 44 | http = urllib3.PoolManager() 45 | r = http.request('GET', url=url, retries=False) 46 | ret = json.loads(r.data.decode('utf-8')) 47 | if ret.get('code', {}) == 0: 48 | return ret 49 | else: 50 | raise Exception(ret) 51 | 52 | def del_record(self, domain, record): 53 | return self.get(module = 'cns', action = 'RecordDelete', domain = domain, recordId = record) 54 | 55 | def get_record(self, domain, length, sub_domain, record_type): 56 | return self.get(module = 'cns', action = 'RecordList', domain = domain, length = length, subDomain = sub_domain, recordType = record_type) 57 | 58 | def create_record(self, domain, sub_domain, value, record_type, line, ttl): 59 | return self.get(module = 'cns', action = 'RecordCreate', domain = domain, subDomain = sub_domain, value = value, recordType = record_type, recordLine = line, ttl = ttl) 60 | 61 | def change_record(self, domain, record_id, sub_domain, value, record_type, line, ttl): 62 | return self.get(module = 'cns', action = 'RecordModify', domain = domain, recordId =record_id, subDomain = sub_domain, value = value, recordType = record_type, recordLine = line, ttl = ttl) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 功能介绍 2 | 3 | 筛选出优质的Cloudflare IP(目前在暂不开源,以接口方式提供15分钟更新一次),并使用域名服务商提供的API解析到不同线路以达到网站加速的效果(目前只完成DNSPod和阿里云DNS,后续如果有需求将会加入其他运营商的)。 4 | 5 | **详细的使用场景请移步我的[小站](https://hostmonit.com/cloudflare-select-ip-plus/)** 6 | 7 | ### 适用人群 8 | 9 | 1. 小站长,网站经常被打或网站放置在国外需要稳定且速度相对快的CDN 10 | 2. 服务器在国外但是想建站的小伙伴 11 | 3. 科学上网加速,拯救移动线路(未测试) 12 | 13 | ### 使用方法 14 | 15 | > 必要条件: 16 | > 17 | > ★ Cloudflare自选IP并已接入到DNSPod或阿里云DNS,不知道怎么自选IP可以查看这个[教程](https://hostmonit.com/manually-select-ip/) 18 | > 19 | > ★ Python3、pip环境 20 | 21 | #### 方法一:GitHub Actions 运行(推荐) 22 | 23 | 1. 登录[腾讯云后台](https://console.cloud.tencent.com/cam/capi)或者[阿里云后台](https://help.aliyun.com/document_detail/53045.html?spm=a2c4g.11186623.2.11.2c6a2fbdh13O53),获取 SecretId、SecretKey,如果使用阿里云DNS,注意需要添加DNS控制权限**AliyunDNSFullAccess** 24 | 25 | 2. Fork本项目到自己的仓库![fork.png](https://img.hostmonit.com/images/2020/11/05/fork.png) 26 | 27 | 3. 进入第二步中Fork的项目,点击Settings->Secrets-New secret,分别是DOMAINS,KEY,SECRETID,SECRETKEY。 28 | 29 | > - DOMAINS 需改域名信息,填写时注意不要有换行 例如:`{"hostmonit.com": {"@": ["CM","CU","CT"], "shop": ["CM", "CU", "CT"], "stock": ["CM","CU","CT"]},"4096.me": {"@": ["CM","CU","CT"], "vv":["CM","CU","CT"]}}` 30 | > - KEY API密钥,从[商店](https://shop.hostmonit.com)购买KEY,也可以使用这个KEY `o1zrmHAF` ,区别是 `o1zrmHAF` 是历史优选的Cloudflare IP(也可以从这个[网站](https://stock.hostmonit.com/CloudFlareYes)查到IP的信息),而购买的KEY是15分钟内获取到的对各运营商速度最优的的Cloudflare IP 31 | > - SECRETID 第一部中从[腾讯云后台](https://console.cloud.tencent.com/cam/capi)或者[阿里云后台](https://help.aliyun.com/document_detail/53045.html?spm=a2c4g.11186623.2.11.2c6a2fbdh13O53),获取到的 `SECRETID ` 32 | > - SECRETKEY 第一部中从[腾讯云后台](https://console.cloud.tencent.com/cam/capi)或者[阿里云后台](https://help.aliyun.com/document_detail/53045.html?spm=a2c4g.11186623.2.11.2c6a2fbdh13O53),获取到的 `SECRETKEY` 33 | 34 | ![secret.png](https://img.hostmonit.com/images/2020/11/05/secret.png) 35 | 36 | 4. 修改您项目中的 `cf2dns_actions.py`文件中的`AFFECT_NUM`和`DNS_SERVER`参数,继续修改`.github/workflows/run.yml` 文件,定时执行的时长(建议15分钟执行一次),最后点击 `start commit` 提交即可在Actions中的build查看到执行情况,如果看到 `cf2dns` 执行日志中有 `CHANGE DNS SUCCESS` 详情输出,即表示运行成功。**需要注意观察下次定时是否能正确运行,有时候GitHub Actions 挺抽风的** 37 | 38 | ![modify.png](https://img.hostmonit.com/images/2020/11/05/modify.png) 39 | 40 | 41 | 42 | ![commit.png](https://img.hostmonit.com/images/2020/11/05/commit.png) 43 | 44 | 45 | 46 | ![build.png](https://img.hostmonit.com/images/2020/11/05/build.png) 47 | 48 | #### 方法二:在自己的VPS或电脑中运行 49 | 50 | 1. 安装运行脚本所需依赖 51 | 52 | ```python 53 | pip install -r requirements.txt 54 | ``` 55 | 56 | 2. 登录[腾讯云后台](https://console.cloud.tencent.com/cam/capi)或者[阿里云后台](https://help.aliyun.com/document_detail/53045.html?spm=a2c4g.11186623.2.11.2c6a2fbdh13O53),获取 SecretId、SecretKey,如果使用阿里云DNS,注意需要添加DNS控制权限**AliyunDNSFullAccess** 57 | 58 | 3. 将脚本下载到本地修改cf2dns.py中的SecretId、SecretKey 59 | 60 | 4. 修改脚本中域名配置信息,可配置多个域名和多个子域名,注意选择DNS服务商 61 | 62 | 5. (可选)从[商店](https://shop.hostmonit.com)购买KEY,当然也可以用脚本中自带的,区别是脚本中自带的KEY是历史优选的Cloudflare IP(也可以从这个[网站](https://stock.hostmonit.com/CloudFlareYes)查到IP的信息),而购买的KEY是15分钟内获取到的最新的Cloudflare IP。 63 | 64 | 6. 运行程序,如果能够正常运行可以选择cron定时执行(建议15分钟执行一次) 65 | 66 | ```python 67 | python cf2dns.py 68 | ``` 69 | 70 | 71 | 72 | ### 免责声明 73 | 74 | > 1.网络环境错综复杂,适合我的不一定适合你,所以尽量先尝试免费的KEY或者购买试用版的KEY 75 | > 76 | > 2.有什么问题和建议请提issue或者Email我,不接受谩骂、扯皮、吐槽 77 | > 78 | > 3.为什么收费? 这个标价我也根本不指望赚钱,甚至不够我国内一台VDS的钱。 79 | > 80 | > ★ 如果当前DNSPod有移动、联通、电信线路的解析将会覆盖掉 81 | 555 82 | -------------------------------------------------------------------------------- /dns/aliyun.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # Mail: tongdongdong@outlook.com 4 | # Reference: https://help.aliyun.com/document_detail/29776.html?spm=a2c4g.11186623.2.38.3fc33efexrOFkT 5 | import json 6 | from aliyunsdkcore import client 7 | from aliyunsdkalidns.request.v20150109 import DescribeDomainRecordsRequest 8 | from aliyunsdkalidns.request.v20150109 import DeleteDomainRecordRequest 9 | from aliyunsdkalidns.request.v20150109 import UpdateDomainRecordRequest 10 | from aliyunsdkalidns.request.v20150109 import AddDomainRecordRequest 11 | 12 | 13 | rc_format = 'json' 14 | class AliApi(): 15 | def __init__(self, ACCESSID, SECRETKEY): 16 | self.access_key_id = ACCESSID 17 | self.access_key_secret = SECRETKEY 18 | 19 | def del_record(self, domain, record): 20 | clt = client.AcsClient(self.access_key_id, self.access_key_secret, 'cn-hangzhou') 21 | request = DeleteDomainRecordRequest.DeleteDomainRecordRequest() 22 | request.set_RecordId(record) 23 | request.set_accept_format(rc_format) 24 | result = clt.do_action(request).decode('utf-8') 25 | result = json.JSONDecoder().decode(result) 26 | return result 27 | 28 | def get_record(self, domain, length, sub_domain, record_type): 29 | clt = client.AcsClient(self.access_key_id, self.access_key_secret, 'cn-hangzhou') 30 | request = DescribeDomainRecordsRequest.DescribeDomainRecordsRequest() 31 | request.set_DomainName(domain) 32 | request.set_PageSize(length) 33 | request.set_RRKeyWord(sub_domain) 34 | request.set_Type(record_type) 35 | request.set_accept_format(rc_format) 36 | result = clt.do_action(request).decode('utf-8').replace('DomainRecords', 'data', 1).replace('Record', 'records', 1).replace('RecordId', 'id').replace('Value', 'value').replace('Line', 'line').replace('telecom', '电信').replace('unicom', '联通').replace('mobile', '移动') 37 | result = json.JSONDecoder().decode(result) 38 | return result 39 | 40 | def create_record(self, domain, sub_domain, value, record_type, line, ttl): 41 | clt = client.AcsClient(self.access_key_id, self.access_key_secret, 'cn-hangzhou') 42 | request = AddDomainRecordRequest.AddDomainRecordRequest() 43 | request.set_DomainName(domain) 44 | request.set_RR(sub_domain) 45 | if line == "电信": 46 | line = "telecom" 47 | elif line == "联通": 48 | line = "unicom" 49 | elif line == "移动": 50 | line = "mobile" 51 | request.set_Line(line) 52 | request.set_Type(record_type) 53 | request.set_Value(value) 54 | request.set_TTL(ttl) 55 | request.set_accept_format(rc_format) 56 | result = clt.do_action(request).decode('utf-8') 57 | result = json.JSONDecoder().decode(result) 58 | return result 59 | 60 | def change_record(self, domain, record_id, sub_domain, value, record_type, line, ttl): 61 | clt = client.AcsClient(self.access_key_id, self.access_key_secret, 'cn-hangzhou') 62 | request = UpdateDomainRecordRequest.UpdateDomainRecordRequest() 63 | request.set_RR(sub_domain) 64 | request.set_RecordId(record_id) 65 | if line == "电信": 66 | line = "telecom" 67 | elif line == "联通": 68 | line = "unicom" 69 | elif line == "移动": 70 | line = "mobile" 71 | request.set_Line(line) 72 | request.set_Type(record_type) 73 | request.set_Value(value) 74 | request.set_TTL(ttl) 75 | request.set_accept_format(rc_format) 76 | result = clt.do_action(request).decode('utf-8') 77 | result = json.JSONDecoder().decode(result) 78 | return result 79 | -------------------------------------------------------------------------------- /cf2dns_actions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Mail: tongdongdong@outlook.com 4 | import base64 5 | import hashlib 6 | import hmac 7 | import random 8 | import time 9 | import operator 10 | import json 11 | import urllib.parse 12 | import urllib3 13 | import os 14 | from dns.qCloud import QcloudApi 15 | from dns.aliyun import AliApi 16 | 17 | #可以从https://shop.hostmonit.com获取 18 | KEY = os.environ["KEY"] #"o1zrmHAF" 19 | #CM:移动 CU:联通 CT:电信 20 | #修改需要更改的dnspod域名核子域名 21 | DOMAINS = json.loads(os.environ["DOMAINS"]) #{"hostmonit.com": {"@": ["CM","CU","CT"], "shop": ["CM", "CU", "CT"], "stock": ["CM","CU","CT"]},"4096.me": {"@": ["CM","CU","CT"], "vv": ["CM","CU","CT"]}} 22 | #腾讯云后台获取 https://console.cloud.tencent.com/cam/capi 23 | SECRETID = os.environ["SECRETID"] #'AKIDV**********Hfo8CzfjgN' 24 | SECRETKEY = os.environ["SECRETKEY"] #'ZrVs*************gqjOp1zVl' 25 | #默认为普通版本 不用修改 26 | AFFECT_NUM = 2 27 | #DNS服务商 如果使用DNSPod改为1 如果使用阿里云解析改成2 28 | DNS_SERVER = 1 29 | #解析生效时间,默认为600秒 如果不是DNS付费版用户 不要修改!!! 30 | TTL = 600 31 | 32 | urllib3.disable_warnings() 33 | 34 | def get_optimization_ip(): 35 | try: 36 | http = urllib3.PoolManager() 37 | headers = headers = {'Content-Type': 'application/json'} 38 | data = {"key": KEY} 39 | data = json.dumps(data).encode() 40 | response = http.request('POST','https://api.hostmonit.com/get_optimization_ip',body=data, headers=headers) 41 | return json.loads(response.data.decode('utf-8')) 42 | except Exception as e: 43 | print(e) 44 | return None 45 | 46 | def changeDNS(line, s_info, c_info, domain, sub_domain, cloud): 47 | global AFFECT_NUM 48 | if line == "CM": 49 | line = "移动" 50 | elif line == "CU": 51 | line = "联通" 52 | elif line == "CT": 53 | line = "电信" 54 | else: 55 | print("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----MESSAGE: LINE ERROR") 56 | return 57 | try: 58 | create_num = AFFECT_NUM - len(s_info) 59 | if create_num == 0: 60 | for info in s_info: 61 | if len(c_info) == 0: 62 | break 63 | cf_ip = c_info.pop(random.randint(0,len(c_info)-1))["ip"] 64 | if cf_ip in str(s_info): 65 | continue 66 | ret = cloud.change_record(domain, info["recordId"], sub_domain, cf_ip, "A", line, TTL) 67 | if(DNS_SERVER != 1 or ret["code"] == 0): 68 | print("CHANGE DNS SUCCESS: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----RECORDID: " + str(info["recordId"]) + "----VALUE: " + cf_ip ) 69 | else: 70 | print("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----RECORDID: " + str(info["recordId"]) + "----VALUE: " + cf_ip + "----MESSAGE: " + ret["message"] ) 71 | elif create_num > 0: 72 | for i in range(create_num): 73 | if len(c_info) == 0: 74 | break 75 | cf_ip = c_info.pop(random.randint(0,len(c_info)-1))["ip"] 76 | if cf_ip in str(s_info): 77 | continue 78 | ret = cloud.create_record(domain, sub_domain, cf_ip, "A", line, TTL) 79 | if(DNS_SERVER != 1 or ret["code"] == 0): 80 | print("CREATE DNS SUCCESS: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----VALUE: " + cf_ip ) 81 | else: 82 | print("CREATE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----RECORDID: " + str(info["recordId"]) + "----VALUE: " + cf_ip + "----MESSAGE: " + ret["message"] ) 83 | else: 84 | for info in s_info: 85 | if create_num == 0 or len(c_info) == 0: 86 | break 87 | cf_ip = c_info.pop(random.randint(0,len(c_info)-1))["ip"] 88 | if cf_ip in str(s_info): 89 | create_num += 1 90 | continue 91 | ret = cloud.change_record(domain, info["recordId"], sub_domain, cf_ip, "A", line, TTL) 92 | if(DNS_SERVER != 1 or ret["code"] == 0): 93 | print("CHANGE DNS SUCCESS: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----RECORDID: " + str(info["recordId"]) + "----VALUE: " + cf_ip ) 94 | else: 95 | print("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----RECORDID: " + str(info["recordId"]) + "----VALUE: " + cf_ip + "----MESSAGE: " + ret["message"] ) 96 | create_num += 1 97 | except Exception as e: 98 | log_cf2dns.logger.error("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----MESSAGE: " + str(e)) 99 | 100 | def main(cloud): 101 | global AFFECT_NUM 102 | if len(DOMAINS) > 0: 103 | try: 104 | cfips = get_optimization_ip() 105 | if cfips == None or cfips["code"] != 200: 106 | print("GET CLOUDFLARE IP ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----MESSAGE: " + str(cfips["info"])) 107 | return 108 | cf_cmips = cfips["info"]["CM"] 109 | cf_cuips = cfips["info"]["CU"] 110 | cf_ctips = cfips["info"]["CT"] 111 | for domain, sub_domains in DOMAINS.items(): 112 | for sub_domain, lines in sub_domains.items(): 113 | temp_cf_cmips = cf_cmips.copy() 114 | temp_cf_cuips = cf_cuips.copy() 115 | temp_cf_ctips = cf_ctips.copy() 116 | if DNS_SERVER == 1: 117 | ret = cloud.get_record(domain, 20, sub_domain, "CNAME") 118 | if ret["code"] == 0: 119 | for record in ret["data"]["records"]: 120 | if record["line"] == "移动" or record["line"] == "联通" or record["line"] == "电信": 121 | retMsg = cloud.del_record(domain, record["id"]) 122 | if(retMsg["code"] == 0): 123 | print("DELETE DNS SUCCESS: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+record["line"] ) 124 | else: 125 | print("DELETE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+record["line"] + "----MESSAGE: " + retMsg["message"] ) 126 | ret = cloud.get_record(domain, 100, sub_domain, "A") 127 | if DNS_SERVER != 1 or ret["code"] == 0 : 128 | if DNS_SERVER == 1 and "Free" in ret["data"]["domain"]["grade"] and AFFECT_NUM > 2: 129 | AFFECT_NUM = 2 130 | cm_info = [] 131 | cu_info = [] 132 | ct_info = [] 133 | for record in ret["data"]["records"]: 134 | if record["line"] == "移动": 135 | info = {} 136 | info["recordId"] = record["id"] 137 | info["value"] = record["value"] 138 | cm_info.append(info) 139 | if record["line"] == "联通": 140 | info = {} 141 | info["recordId"] = record["id"] 142 | info["value"] = record["value"] 143 | cu_info.append(info) 144 | if record["line"] == "电信": 145 | info = {} 146 | info["recordId"] = record["id"] 147 | info["value"] = record["value"] 148 | ct_info.append(info) 149 | for line in lines: 150 | if line == "CM": 151 | changeDNS("CM", cm_info, temp_cf_cmips, domain, sub_domain, cloud) 152 | elif line == "CU": 153 | changeDNS("CU", cu_info, temp_cf_cuips, domain, sub_domain, cloud) 154 | elif line == "CT": 155 | changeDNS("CT", ct_info, temp_cf_ctips, domain, sub_domain, cloud) 156 | except Exception as e: 157 | print("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----MESSAGE: " + str(e)) 158 | 159 | if __name__ == '__main__': 160 | if DNS_SERVER == 1: 161 | cloud = QcloudApi(SECRETID, SECRETKEY) 162 | elif DNS_SERVER == 2: 163 | cloud = AliApi(SECRETID, SECRETKEY) 164 | main(cloud) 165 | -------------------------------------------------------------------------------- /cf2dns.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Mail: tongdongdong@outlook.com 4 | import base64 5 | import hashlib 6 | import hmac 7 | import random 8 | import time 9 | import operator 10 | import json 11 | import urllib.parse 12 | import urllib3 13 | from dns.qCloud import QcloudApi 14 | from dns.aliyun import AliApi 15 | from log import Logger 16 | import traceback 17 | 18 | #可以从https://shop.hostmonit.com获取 19 | KEY = "o1zrmHAF" 20 | 21 | #CM:移动 CU:联通 CT:电信 22 | #修改需要更改的dnspod域名核子域名 23 | DOMAINS = { 24 | "hostmonit.com": {"@": ["CM","CU","CT"], "shop": ["CM", "CU", "CT"], "stock": ["CM","CU","CT"]}, 25 | "4096.me": {"@": ["CM","CU","CT"], "vv": ["CM","CU","CT"]} 26 | } 27 | 28 | #解析生效条数 免费的DNSPod相同线路最多支持2条解析 29 | AFFECT_NUM = 2 30 | 31 | #DNS服务商 如果使用DNSPod改为1 如果使用阿里云解析改成2 32 | DNS_SERVER = 1 33 | 34 | #解析生效时间,默认为600秒 如果不是DNS付费版用户 不要修改!!! 35 | TTL = 600 36 | 37 | #API 密钥 38 | #腾讯云后台获取 https://console.cloud.tencent.com/cam/capi 39 | #阿里云后台获取 https://help.aliyun.com/document_detail/53045.html?spm=a2c4g.11186623.2.11.2c6a2fbdh13O53 注意需要添加DNS控制权限 AliyunDNSFullAccess 40 | SECRETID = 'AKIDVmxtxxxxxxxxxxxfo8CzfjgN' 41 | SECRETKEY = 'ZrVszqxxxxxxxxxxjOp1zVl' 42 | 43 | log_cf2dns = Logger('cf2dns.log', level='debug') 44 | urllib3.disable_warnings() 45 | 46 | def get_optimization_ip(): 47 | try: 48 | http = urllib3.PoolManager() 49 | headers = headers = {'Content-Type': 'application/json'} 50 | data = {"key": KEY} 51 | data = json.dumps(data).encode() 52 | response = http.request('POST','https://api.hostmonit.com/get_optimization_ip',body=data, headers=headers) 53 | return json.loads(response.data.decode('utf-8')) 54 | except Exception as e: 55 | print(e) 56 | return None 57 | 58 | def changeDNS(line, s_info, c_info, domain, sub_domain, cloud): 59 | global AFFECT_NUM 60 | if line == "CM": 61 | line = "移动" 62 | elif line == "CU": 63 | line = "联通" 64 | elif line == "CT": 65 | line = "电信" 66 | else: 67 | log_cf2dns.logger.error("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----MESSAGE: LINE ERROR") 68 | return 69 | try: 70 | create_num = AFFECT_NUM - len(s_info) 71 | if create_num == 0: 72 | for info in s_info: 73 | if len(c_info) == 0: 74 | break 75 | cf_ip = c_info.pop(random.randint(0,len(c_info)-1))["ip"] 76 | if cf_ip in str(s_info): 77 | continue 78 | ret = cloud.change_record(domain, info["recordId"], sub_domain, cf_ip, "A", line, TTL) 79 | if(DNS_SERVER != 1 or ret["code"] == 0): 80 | log_cf2dns.logger.info("CHANGE DNS SUCCESS: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----RECORDID: " + str(info["recordId"]) + "----VALUE: " + cf_ip ) 81 | else: 82 | log_cf2dns.logger.error("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----RECORDID: " + str(info["recordId"]) + "----VALUE: " + cf_ip + "----MESSAGE: " + ret["message"] ) 83 | elif create_num > 0: 84 | for i in range(create_num): 85 | if len(c_info) == 0: 86 | break 87 | cf_ip = c_info.pop(random.randint(0,len(c_info)-1))["ip"] 88 | if cf_ip in str(s_info): 89 | continue 90 | ret = cloud.create_record(domain, sub_domain, cf_ip, "A", line, TTL) 91 | if(DNS_SERVER != 1 or ret["code"] == 0): 92 | log_cf2dns.logger.info("CREATE DNS SUCCESS: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----VALUE: " + cf_ip ) 93 | else: 94 | log_cf2dns.logger.error("CREATE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----RECORDID: " + str(info["recordId"]) + "----VALUE: " + cf_ip + "----MESSAGE: " + ret["message"] ) 95 | else: 96 | for info in s_info: 97 | if create_num == 0 or len(c_info) == 0: 98 | break 99 | cf_ip = c_info.pop(random.randint(0,len(c_info)-1))["ip"] 100 | if cf_ip in str(s_info): 101 | create_num += 1 102 | continue 103 | ret = cloud.change_record(domain, info["recordId"], sub_domain, cf_ip, "A", line, TTL) 104 | if(DNS_SERVER != 1 or ret["code"] == 0): 105 | log_cf2dns.logger.info("CHANGE DNS SUCCESS: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----RECORDID: " + str(info["recordId"]) + "----VALUE: " + cf_ip ) 106 | else: 107 | log_cf2dns.logger.error("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+line+"----RECORDID: " + str(info["recordId"]) + "----VALUE: " + cf_ip + "----MESSAGE: " + ret["message"] ) 108 | create_num += 1 109 | except Exception as e: 110 | log_cf2dns.logger.error("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----MESSAGE: " + str(e)) 111 | 112 | def main(cloud): 113 | global AFFECT_NUM 114 | if len(DOMAINS) > 0: 115 | try: 116 | cfips = get_optimization_ip() 117 | if cfips == None or cfips["code"] != 200: 118 | log_cf2dns.logger.error("GET CLOUDFLARE IP ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----MESSAGE: " + str(cfips["info"])) 119 | return 120 | cf_cmips = cfips["info"]["CM"] 121 | cf_cuips = cfips["info"]["CU"] 122 | cf_ctips = cfips["info"]["CT"] 123 | for domain, sub_domains in DOMAINS.items(): 124 | for sub_domain, lines in sub_domains.items(): 125 | temp_cf_cmips = cf_cmips.copy() 126 | temp_cf_cuips = cf_cuips.copy() 127 | temp_cf_ctips = cf_ctips.copy() 128 | if DNS_SERVER == 1: 129 | ret = cloud.get_record(domain, 20, sub_domain, "CNAME") 130 | if ret["code"] == 0: 131 | for record in ret["data"]["records"]: 132 | if record["line"] == "移动" or record["line"] == "联通" or record["line"] == "电信": 133 | retMsg = cloud.del_record(domain, record["id"]) 134 | if(retMsg["code"] == 0): 135 | log_cf2dns.logger.info("DELETE DNS SUCCESS: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+record["line"] ) 136 | else: 137 | log_cf2dns.logger.error("DELETE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----DOMAIN: " + domain + "----SUBDOMAIN: " + sub_domain + "----RECORDLINE: "+record["line"] + "----MESSAGE: " + retMsg["message"] ) 138 | ret = cloud.get_record(domain, 100, sub_domain, "A") 139 | if DNS_SERVER != 1 or ret["code"] == 0 : 140 | if DNS_SERVER == 1 and "Free" in ret["data"]["domain"]["grade"] and AFFECT_NUM > 2: 141 | AFFECT_NUM = 2 142 | cm_info = [] 143 | cu_info = [] 144 | ct_info = [] 145 | for record in ret["data"]["records"]: 146 | if record["line"] == "移动": 147 | info = {} 148 | info["recordId"] = record["id"] 149 | info["value"] = record["value"] 150 | cm_info.append(info) 151 | if record["line"] == "联通": 152 | info = {} 153 | info["recordId"] = record["id"] 154 | info["value"] = record["value"] 155 | cu_info.append(info) 156 | if record["line"] == "电信": 157 | info = {} 158 | info["recordId"] = record["id"] 159 | info["value"] = record["value"] 160 | ct_info.append(info) 161 | for line in lines: 162 | if line == "CM": 163 | changeDNS("CM", cm_info, temp_cf_cmips, domain, sub_domain, cloud) 164 | elif line == "CU": 165 | changeDNS("CU", cu_info, temp_cf_cuips, domain, sub_domain, cloud) 166 | elif line == "CT": 167 | changeDNS("CT", ct_info, temp_cf_ctips, domain, sub_domain, cloud) 168 | except Exception as e: 169 | traceback.print_exc() 170 | log_cf2dns.logger.error("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----MESSAGE: " + str(e)) 171 | 172 | if __name__ == '__main__': 173 | if DNS_SERVER == 1: 174 | cloud = QcloudApi(SECRETID, SECRETKEY) 175 | elif DNS_SERVER == 2: 176 | cloud = AliApi(SECRETID, SECRETKEY) 177 | main(cloud) 178 | -------------------------------------------------------------------------------- /cf2dns.log: -------------------------------------------------------------------------------- 1 | 2020-11-29 09:23:55,261 - cf2dns.py[line:172] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:23:55----MESSAGE: 'code' 2 | 2020-11-29 09:34:11,383 - cf2dns.py[line:173] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:34:11----MESSAGE: 'code' 3 | 2020-11-29 09:38:02,746 - cf2dns.py[line:173] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:38:02----MESSAGE: 'code' 4 | 2020-11-29 09:49:12,849 - cf2dns.py[line:173] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:49:12----MESSAGE: 'code' 5 | 2020-11-29 09:49:59,864 - cf2dns.py[line:173] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:49:59----MESSAGE: 'data' 6 | 2020-11-29 09:51:46,878 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:51:46----MESSAGE: name 'AddDomainRecordRequest' is not defined 7 | 2020-11-29 09:51:46,884 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:51:46----MESSAGE: name 'AddDomainRecordRequest' is not defined 8 | 2020-11-29 09:51:46,890 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:51:46----MESSAGE: name 'AddDomainRecordRequest' is not defined 9 | 2020-11-29 09:51:47,239 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:51:47----MESSAGE: name 'AddDomainRecordRequest' is not defined 10 | 2020-11-29 09:51:47,245 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:51:47----MESSAGE: name 'AddDomainRecordRequest' is not defined 11 | 2020-11-29 09:51:47,251 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:51:47----MESSAGE: name 'AddDomainRecordRequest' is not defined 12 | 2020-11-29 09:57:30,027 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:57:30----MESSAGE: 'code' 13 | 2020-11-29 09:57:30,421 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:57:30----MESSAGE: 'code' 14 | 2020-11-29 09:57:30,791 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:57:30----MESSAGE: 'code' 15 | 2020-11-29 09:57:31,409 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:57:31----MESSAGE: 'code' 16 | 2020-11-29 09:57:31,795 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:57:31----MESSAGE: 'code' 17 | 2020-11-29 09:57:32,182 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 09:57:32----MESSAGE: 'code' 18 | 2020-11-29 10:09:26,691 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:26----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.49.131 19 | 2020-11-29 10:09:27,094 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:27----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.4.174 20 | 2020-11-29 10:09:27,476 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:27----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 172.64.68.132 21 | 2020-11-29 10:09:28,008 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:28----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 104.27.115.185 22 | 2020-11-29 10:09:28,417 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:28----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----VALUE: 104.22.74.171 23 | 2020-11-29 10:09:28,828 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:28----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----VALUE: 104.28.147.30 24 | 2020-11-29 10:09:29,519 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:29----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.53.3 25 | 2020-11-29 10:09:29,919 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:29----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.71.108 26 | 2020-11-29 10:09:30,293 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:30----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 172.67.48.120 27 | 2020-11-29 10:09:30,671 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:30----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 104.19.54.21 28 | 2020-11-29 10:09:31,058 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:31----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----VALUE: 172.67.56.37 29 | 2020-11-29 10:09:31,476 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:09:31----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----VALUE: 104.27.137.82 30 | 2020-11-29 10:14:20,216 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:14:20----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.49.131 31 | 2020-11-29 10:14:20,749 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:14:20----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.42.41 32 | 2020-11-29 10:14:21,141 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:14:21----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 104.19.54.21 33 | 2020-11-29 10:14:24,764 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:14:24----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 104.20.161.112 34 | 2020-11-29 10:14:34,838 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 10:14:34----MESSAGE: SDK.HttpError HTTPConnectionPool(host='alidns.aliyuncs.com', port=80): Read timed out. (read timeout=10) 35 | 2020-11-29 10:14:38,991 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:14:38----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.34.171 36 | 2020-11-29 10:14:42,580 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:14:42----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.49.131 37 | 2020-11-29 10:14:46,438 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:14:46----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 104.24.175.186 38 | 2020-11-29 10:14:46,862 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:14:46----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 172.67.50.164 39 | 2020-11-29 10:14:56,957 - cf2dns.py[line:109] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 10:14:56----MESSAGE: SDK.HttpError HTTPConnectionPool(host='alidns.aliyuncs.com', port=80): Read timed out. (read timeout=10) 40 | 2020-11-29 10:19:21,577 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:21----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.71.108 41 | 2020-11-29 10:19:21,927 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:21----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.63.42 42 | 2020-11-29 10:19:22,232 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:22----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 104.19.54.21 43 | 2020-11-29 10:19:22,629 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:22----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 104.24.175.186 44 | 2020-11-29 10:19:23,038 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:23----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----VALUE: 104.22.49.80 45 | 2020-11-29 10:19:23,438 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:23----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----VALUE: 104.24.170.35 46 | 2020-11-29 10:19:24,089 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:24----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.86.69 47 | 2020-11-29 10:19:24,468 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:24----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.108.218 48 | 2020-11-29 10:19:24,845 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:24----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 172.67.53.91 49 | 2020-11-29 10:19:25,209 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:25----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 172.64.68.132 50 | 2020-11-29 10:19:25,642 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:25----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----VALUE: 104.27.136.85 51 | 2020-11-29 10:19:26,018 - cf2dns.py[line:90] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:19:26----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----VALUE: 172.67.63.192 52 | 2020-11-29 10:23:11,689 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:11----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.53.3 53 | 2020-11-29 10:23:12,137 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:12----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.34.171 54 | 2020-11-29 10:23:12,546 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:12----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 104.22.65.207 55 | 2020-11-29 10:23:12,915 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:12----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 104.24.175.186 56 | 2020-11-29 10:23:13,310 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:13----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----VALUE: 104.24.50.56 57 | 2020-11-29 10:23:13,686 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:13----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----VALUE: 104.20.5.212 58 | 2020-11-29 10:23:14,380 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:14----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.14.38 59 | 2020-11-29 10:23:14,802 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:14----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.53.3 60 | 2020-11-29 10:23:15,178 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:15----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 172.67.50.255 61 | 2020-11-29 10:23:15,540 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:15----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 104.22.65.207 62 | 2020-11-29 10:23:15,983 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:15----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----VALUE: 104.20.2.208 63 | 2020-11-29 10:23:16,348 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:16----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----VALUE: 104.24.33.168 64 | 2020-11-29 10:23:43,707 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:43----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.43.106 65 | 2020-11-29 10:23:44,144 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:44----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.14.38 66 | 2020-11-29 10:23:44,505 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:44----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 104.24.52.182 67 | 2020-11-29 10:23:44,885 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:44----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 172.67.53.91 68 | 2020-11-29 10:23:45,287 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:45----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----VALUE: 104.20.2.208 69 | 2020-11-29 10:23:45,695 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:45----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----VALUE: 104.24.33.168 70 | 2020-11-29 10:23:46,433 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:46----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.93.93 71 | 2020-11-29 10:23:46,842 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:46----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.63.42 72 | 2020-11-29 10:23:47,194 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:47----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 104.22.65.207 73 | 2020-11-29 10:23:47,526 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:47----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 172.67.50.255 74 | 2020-11-29 10:23:47,911 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:47----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----VALUE: 104.20.2.208 75 | 2020-11-29 10:23:48,416 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:23:48----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----VALUE: 104.27.1.119 76 | 2020-11-29 10:28:31,053 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:31----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.10.60 77 | 2020-11-29 10:28:31,456 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:31----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----VALUE: 104.19.26.189 78 | 2020-11-29 10:28:31,860 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:31----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 104.25.97.47 79 | 2020-11-29 10:28:32,231 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:32----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----VALUE: 104.27.139.123 80 | 2020-11-29 10:28:32,596 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:32----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----VALUE: 104.24.50.56 81 | 2020-11-29 10:28:32,973 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:32----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----VALUE: 104.27.1.119 82 | 2020-11-29 10:28:33,710 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:33----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.96.38 83 | 2020-11-29 10:28:34,126 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:34----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----VALUE: 104.19.63.42 84 | 2020-11-29 10:28:37,672 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:37----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 104.27.139.123 85 | 2020-11-29 10:28:38,070 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:38----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----VALUE: 172.67.32.27 86 | 2020-11-29 10:28:38,441 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:38----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----VALUE: 104.25.194.82 87 | 2020-11-29 10:28:38,838 - cf2dns.py[line:91] - INFO: CREATE DNS SUCCESS: ----Time: 2020-11-29 10:28:38----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----VALUE: 104.24.170.35 88 | 2020-11-29 10:39:06,488 - cf2dns.py[line:174] - ERROR: CHANGE DNS ERROR: ----Time: 2020-11-29 10:39:06----MESSAGE: 'line' 89 | 2020-11-29 10:44:25,628 - cf2dns.py[line:78] - INFO: CHANGE DNS SUCCESS: ----Time: 2020-11-29 10:44:25----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----RECORDID: 20826157494966272----VALUE: 104.19.18.212 90 | 2020-11-29 10:44:29,160 - cf2dns.py[line:78] - INFO: CHANGE DNS SUCCESS: ----Time: 2020-11-29 10:44:29----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 移动----RECORDID: 20826157521442816----VALUE: 104.19.52.56 91 | 2020-11-29 10:44:29,606 - cf2dns.py[line:78] - INFO: CHANGE DNS SUCCESS: ----Time: 2020-11-29 10:44:29----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----RECORDID: 20826157547274240----VALUE: 104.24.2.235 92 | 2020-11-29 10:44:30,041 - cf2dns.py[line:78] - INFO: CHANGE DNS SUCCESS: ----Time: 2020-11-29 10:44:30----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 联通----RECORDID: 20826157571972096----VALUE: 104.24.52.182 93 | 2020-11-29 10:44:30,431 - cf2dns.py[line:78] - INFO: CHANGE DNS SUCCESS: ----Time: 2020-11-29 10:44:30----DOMAIN: 484848.xyz----SUBDOMAIN: @----RECORDLINE: 电信----RECORDID: 20826157621128192----VALUE: 104.20.5.212 94 | 2020-11-29 10:44:31,303 - cf2dns.py[line:78] - INFO: CHANGE DNS SUCCESS: ----Time: 2020-11-29 10:44:31----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 移动----RECORDID: 20826157696232448----VALUE: 104.19.10.60 95 | 2020-11-29 10:44:31,716 - cf2dns.py[line:78] - INFO: CHANGE DNS SUCCESS: ----Time: 2020-11-29 10:44:31----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----RECORDID: 20826157955952640----VALUE: 172.67.51.202 96 | 2020-11-29 10:44:32,178 - cf2dns.py[line:78] - INFO: CHANGE DNS SUCCESS: ----Time: 2020-11-29 10:44:32----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 联通----RECORDID: 20826157929467904----VALUE: 104.24.2.235 97 | 2020-11-29 10:44:32,583 - cf2dns.py[line:78] - INFO: CHANGE DNS SUCCESS: ----Time: 2020-11-29 10:44:32----DOMAIN: 484848.xyz----SUBDOMAIN: shop----RECORDLINE: 电信----RECORDID: 20826158005371904----VALUE: 104.31.129.8 98 | --------------------------------------------------------------------------------