19 lines
700 B
Python
19 lines
700 B
Python
import requests
|
|
import json
|
|
|
|
headers={
|
|
'Authorization': 'token UPmCF82KqqqWghdlnhfUaQ4Kp24c6qth'
|
|
}
|
|
url=' https://api.zerotier.com/api/v1/network/af78bf94361850a3/member'
|
|
param = {}
|
|
response = requests.get(url=url,params=param,headers=headers) #三个参数
|
|
memberData = json.loads(response.text)
|
|
|
|
with open("smartdns.conf", '+w') as f:
|
|
f.write(f"bind [::]:53\n")
|
|
f.write(f"server 192.168.3.1\n")
|
|
f.write(f"server 223.5.5.5\n")
|
|
for i in memberData:
|
|
config=i['config']
|
|
print(f"id: {config['id']};\tname: {i['name']};\tdescription: {i['description']};\tip: {config['ipAssignments']}")
|
|
f.write(f"address /{i['name']}.fbh/{','.join(config['ipAssignments'])}\n") |