我对Python还不熟悉,但需要在插件服务中修补这个问题/漏洞。在
我的代码如下:
#!/usr/bin/env python
import subprocess
import sys
import os
import yaml
from xml.dom import minidom
sys.path.append('/scripts')
import createvhosts
doc = minidom.parse(sys.stdin)
param0taglist = doc.getElementsByTagName('param0')
param1taglist = doc.getElementsByTagName('param1')
param0 = param0taglist[0].childNodes[0].toxml()
param1 = param1taglist[0].childNodes[0].toxml()
domain = param0 + '.' + param1
usertaglist = doc.getElementsByTagName('USER')
user = usertaglist[0].childNodes[0].toxml()
f = open('/var/cpanel/userdata/' + user + '/main')
ydata = yaml.load(f)
f.close()
sublist = ydata['sub_domains']
addondict = ydata['addon_domains']
parkedlist = ydata['parked_domains']
mainlist = ydata['main_domain']
serverip = createvhosts.getmainip()
if len(sublist) != 0:
slcont = 0
while slcont < len(sublist):
domain = sublist[slcont]
docroot, yip, alias = createvhosts.getvars(sublist[slcont])
if yip == serverip:
createvhosts.writeconfshared(user, domain, docroot, yip, alias)
else:
createvhosts.writeconfded(user, domain, docroot, yip, alias)
slcont = slcont + 1
proc = subprocess.Popen("/etc/init.d/nginx restart > /dev/null 2>&1", shell=True)
问题是当你用*在CPanel中添加一个子域时,它会使服务器崩溃,因为nginx显然不允许和接受这一点。我需要帮助的是找出如何替换/阻止*以便它不会进入。在
像Param0.find( "*" ) !=-1
这样的方法有效吗?在
您要查找的构造是
char in string
。在把这个放在一个条件下,你就得到了你想要的东西,比如:
^{pr2}$这一点,以及字符串上可用于执行更复杂工作的方法的全面列表,都记录在in the official docs, under Built-in Types中。在
相关问题 更多 >
编程相关推荐