import xml.etree.ElementTree as ET
xml_string = '''
$HOSTNAME
2
nobody
nobody
0
/
0
120M
/tmp/lshttpd/swap
1
1
0
/usr/local/lsws/conf/httpd.conf
0
0
1
5
$SERVER_ROOT/conf/mime.properties
0
0
86400
1
usman@cyberpersons.com
$SERVER_ROOT/logs/error.log
DEBUG
0
10M
1
1
$SERVER_ROOT/logs/access.log
%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"
10M
30
1
index.html, index.php
0
.htaccess
1
image/*=A604800, text/css=A604800, application/x-javascript=A604800, application/javascript=A604800
10000
10000
300
1000
5
0
0
8192
16380
500M
8K
500M
4096
20M
256K
40M
1
1
4
1
text/*,application/x-javascript,application/javascript,application/xml, image/svg+xml
1
1
1
6
1M
300
1
1
0
000
000
0
0
0
0
10000
10000
15
300
200
11
10
0
300
600
1450M
1500M
1400
1450
0
0
deny,log,status:403
1
/tmp
$SERVER_ROOT/logs/security_audit.log
XSS attack
log,deny,status:403,msg:'XSS attack'
1
/
/etc/*
/dev/*
$SERVER_ROOT/conf/*
$SERVER_ROOT/admin/conf/*
ALL, 127.0.0.1T, 103.21.244.0/22T, 103.22.200.0/22T, 103.31.4.0/22T, 104.16.0.0/12T, 108.162.192.0/18T, 131.0.72.0/22T, 141.101.64.0/18T, 162.158.0.0/15T, 172.64.0.0/13T, 173.245.48.0/20T, 188.114.96.0/20T, 190.93.240.0/20T, 197.234.240.0/22T, 198.41.128.0/17T, 2400:cb00::/32T, 2405:8100::/32T, 2405:b500::/32T, 2606:4700::/32T, 2803:f800::/32T, 2a06:98c0::/29T, 2c0f:f248::/32T, 192.88.134.0/23T, 185.93.228.0/22, 66.248.200.0/22T, 208.109.0.0/22T, 2a02:fe80::/29T
lsapi
lsphp5
uds://tmp/lshttpd/lsphp5.sock
35
PHP_LSAPI_CHILDREN=35
60
0
1
0
3
$SERVER_ROOT/fcgi-bin/lsphp5
100
1
0
2047M
2047M
400
500
proxy
docker100
127.0.0.1:1100
60
-1
60
60
0
'''
# Parse the XML content
root = ET.fromstring(xml_string)
# Find the node
ext_processor_list = root.find('extProcessorList')
# Create the new node
new_ext_processor = ET.Element('extProcessor')
port = '100'
# Add child elements to the new
ET.SubElement(new_ext_processor, 'type').text = 'proxy'
ET.SubElement(new_ext_processor, 'name').text = f'docker{port}'
ET.SubElement(new_ext_processor, 'address').text = f'127.0.0.1:{port}'
ET.SubElement(new_ext_processor, 'maxConns').text = '35'
ET.SubElement(new_ext_processor, 'pcKeepAliveTimeout').text = '60'
ET.SubElement(new_ext_processor, 'initTimeout').text = '60'
ET.SubElement(new_ext_processor, 'retryTimeout').text = '60'
ET.SubElement(new_ext_processor, 'respBuffer').text = '0'
# Append the new to the
ext_processor_list.append(new_ext_processor)
# Write the updated XML content to a new file or print it out
tree = ET.ElementTree(root)
#tree.write(ConfPath, encoding='UTF-8', xml_declaration=True)
# Optionally, print the updated XML
ET.dump(root)