mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 15:26:13 +01:00
39 lines
976 B
Python
39 lines
976 B
Python
from xml.etree import ElementTree
|
|
import os
|
|
from random import randint
|
|
|
|
try:
|
|
mydoc = ElementTree.parse('domain.xml')
|
|
|
|
|
|
len = 0
|
|
|
|
if len == 0:
|
|
raise BaseException("Error occurred!")
|
|
|
|
domains = mydoc.findall('ChildDomains/domain')
|
|
|
|
for d in domains:
|
|
print d.find('domain').text
|
|
print d.find('phpSelection').text
|
|
print d.find('path').text
|
|
|
|
databases = mydoc.findall('Databases/database')
|
|
|
|
for d in databases:
|
|
print d.find('dbName').text
|
|
print d.find('dbUser').text
|
|
print d.find('password').text
|
|
|
|
dnsrecords = mydoc.findall('dnsrecords/dnsrecord')
|
|
|
|
for dnsrecord in dnsrecords:
|
|
print dnsrecord.find('type').text
|
|
print dnsrecord.find('name').text
|
|
print dnsrecord.find('content').text
|
|
print dnsrecord.find('priority').text
|
|
|
|
print os.path.join("/home", "cyberpanel", str(randint(1000, 9999)) + ".xml/", "test")
|
|
except BaseException,msg:
|
|
print str(msg)
|