🔒 Closed ☁skyvpn mods☁[versions] (1.5.47)

Status
Not open for further replies.
Put some Cloudflare DNS on Json File using my Python Script right here











#! /bin/python
#
#Edit/update CloudFlare record with machine IP, this script working like ddclient.
#More info at CloudFlare Client API Documentation: You do not have permission to view the full content of this post. Log in or register now.
#

import json
import urllib
import requests

#==============================
##Main variables.
#Your CloudFlare key:
#You do not have permission to view the full content of this post. Log in or register now.
key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
cloudflare_api="You do not have permission to view the full content of this post. Log in or register now."
main_domain="example.com"
sub_domain="sub.example.com"
email="youremail@domain.com"
record_type = "A"

#==============================
##Functions.
#Get record ID based on domain name and record type.
def get_record_id(record_name, record_type):
decoded_records = json.loads(all_domain_info)
for record in decoded_records['response']['recs']['objs']:
if record['name'] == record_name and record['type'] == record_type:
record_id = record['rec_id']
return record_id

#Send request to Cloudflare API with specific parameters.
def connect_cloudflare(parameters):
url_parameters = urllib.urlencode(parameters)
request_output = urllib.urlopen(cloudflare_api, url_parameters)
return request_output

#==============================
##Rest of script.
#All domain information parameters.
get_all_domain = {
'a': 'rec_load_all',
'tkn': key,
'email': email,
'z': main_domain
}

#Get all info about the main domain.
all_domain_info = connect_cloudflare(get_all_domain).read()

#Get ID of subdomain record.
record_id = get_record_id(sub_domain, record_type)

#Get current machine IP.
current_machine_ip = urllib.urlopen("").read().strip()

#Edit domain parameters.
edit_domain = {
'a': 'rec_edit',
'tkn': key,
'id': record_id,
'email': email,
'z': main_domain,
'type': record_type,
'name': sub_domain,
'content': current_machine_ip,
'service_mode': 0,
'ttl': 1
}

#Send post request to Cloudflare API to edit domin IP.
connect_cloudflare(edit_domain)





I hope yah all understand the script nyahahahahhaha



-Ateh-
 
Status
Not open for further replies.

About this Thread

  • 2K
    Replies
  • 64K
    Views
  • 1K
    Participants
Last reply from:
dianne_sins

Online now

Members online
656
Guests online
1,233
Total visitors
1,889

Forum statistics

Threads
2,271,635
Posts
28,936,977
Members
1,238,743
Latest member
aruyyttee
Back
Top