Update mw.py

pull/528/head
Mr Chen 1 year ago
parent ac97b8f7ec
commit a8ced31d32
  1. 12
      class/core/mw.py

@ -246,7 +246,7 @@ def isInstalledWeb():
def isIpAddr(ip):
check_ip = re.compile(
'^(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)$')
'^(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\.(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$')
if check_ip.match(ip):
return True
else:
@ -1176,10 +1176,10 @@ def getLocalIpBack():
url = 'http://pv.sohu.com/cityjson?ie=utf-8'
req = urllib.request.urlopen(url, timeout=10)
content = req.read().decode('utf-8')
ipaddress = re.search('\d+.\d+.\d+.\d+', content).group(0)
ipaddress = re.search('\\d+.\\d+.\\d+.\\d+', content).group(0)
writeFile(filename, ipaddress)
ipaddress = re.search('\d+.\d+.\d+.\d+', ipaddress).group(0)
ipaddress = re.search('\\d+.\\d+.\\d+.\\d+', ipaddress).group(0)
return ipaddress
except Exception as ex:
# print(ex)
@ -1244,7 +1244,7 @@ def checkIp(ip):
# 检查是否为IPv4地址
import re
p = re.compile(
'^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$')
'^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$')
if p.match(ip):
return True
else:
@ -1382,13 +1382,13 @@ def getCpuType():
# 取CPU类型
cpuinfo = open('/proc/cpuinfo', 'r').read()
rep = "model\s+name\s+:\s+(.+)"
rep = "model\\s+name\\s+:\\s+(.+)"
tmp = re.search(rep, cpuinfo, re.I)
if tmp:
cpuType = tmp.groups()[0]
else:
cpuinfo = execShell('LANG="en_US.UTF-8" && lscpu')[0]
rep = "Model\s+name:\s+(.+)"
rep = "Model\\s+name:\\s+(.+)"
tmp = re.search(rep, cpuinfo, re.I)
if tmp:
cpuType = tmp.groups()[0]

Loading…
Cancel
Save