Skip to content

Commit aa4b7ac

Browse files
committed
add ddns script
1 parent 864bb30 commit aa4b7ac

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

ddns/ddns.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
login_email='*****'
22
login_password='****'
3-
main_domain='nome.tk'
3+
main_domain='domain.com'
44
sub_domain='dht'
55

66
wanip='iframe.ip138.com/ic.asp'

ddns/dnspod.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
4+
55
import httplib, urllib
66
import re, urllib2, json
77
import socket, sys
88

99

10-
domain = "linsir.tk"
10+
domain = "Domain"
1111
sub_domain = ['@',]
12-
email = "vi5i0n@qq.com"# replace with your email
13-
password = "Vision"# replace with your password
12+
email = "username@email.com"# replace with your email
13+
password = "passwd"# replace with your password
1414

1515
class dnspod(object):
1616
"""docstring for dnspod"""
@@ -21,7 +21,7 @@ def __init__(self):
2121
"format" : "json",
2222
"record_line" : "默认",
2323
}
24-
24+
2525
def get_public_ip(self):
2626
data = urllib2.urlopen("http://20140507.ip138.com/ic.asp").read()
2727
ip = re.search('\d+\.\d+\.\d+\.\d+',data).group(0)
@@ -30,7 +30,7 @@ def get_public_ip(self):
3030
def get_domain_ip(self):
3131
result=socket.getaddrinfo(domain,'http')[0][4][0]
3232
return result
33-
33+
3434
def post(self,method):
3535
headers = {"UserAgent":"Ddns Client/0.1.0([email protected])",
3636
"Content-type": "application/x-www-form-urlencoded",
@@ -63,7 +63,7 @@ def get_record_id(self):
6363
if record["name"] in sub_domain:
6464
name = record["name"]
6565
record_ids[name] = record["id"]
66-
66+
6767
# print record_ids
6868
return record_ids
6969

@@ -76,8 +76,8 @@ def update_record(self, ip):
7676
data = self.post("Record.Ddns")
7777
data = json.loads(data)
7878
return data['status']['code']
79-
80-
79+
80+
8181
if __name__ == '__main__':
8282
dns = dnspod()
8383
try:

0 commit comments

Comments
 (0)