Skip to content

Commit 225ea91

Browse files
authored
Merge pull request #712 from midoks/dev
简单优化
2 parents 1328699 + 172ca05 commit 225ea91

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

plugins/tamper_proof_py/index.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ def set_site_status(self):
324324
siteInfo['open'] = not siteInfo['open']
325325

326326
m_logs = {True: '开启', False: '关闭'}
327-
self.writeLog('%s站点[%s]防篡改保护' %
328-
(m_logs[siteInfo['open']], siteInfo['siteName']))
327+
self.writeLog('%s站点[%s]防篡改保护' % (m_logs[siteInfo['open']], siteInfo['siteName']))
329328
self.siteReload(siteInfo)
330329
self.saveSiteConfig(siteInfo)
331330
self.restart()
@@ -458,8 +457,7 @@ def remove_protect_ext(self):
458457
if not protectExt in siteInfo['protectExt']:
459458
continue
460459
siteInfo['protectExt'].remove(protectExt)
461-
self.writeLog('站点[%s]从受保护列表中删除[.%s]' %
462-
(siteInfo['siteName'], protectExt))
460+
self.writeLog('站点[%s]从受保护列表中删除[.%s]' % (siteInfo['siteName'], protectExt))
463461
self.siteReload(siteInfo)
464462
self.saveSiteConfig(siteInfo)
465463
return mw.returnJson(True, '删除成功!')
@@ -593,8 +591,7 @@ def set_site_status_all(self):
593591
for i in range(len(sites)):
594592
if sites[i]['siteName'] in siteNames:
595593
sites[i]['open'] = siteState
596-
self.writeLog('%s站点[%s]防篡改保护' %
597-
(m_logs[siteState], sites[i]['siteName']))
594+
self.writeLog('%s站点[%s]防篡改保护' % (m_logs[siteState], sites[i]['siteName']))
598595
self.writeSites(sites)
599596
return mw.returnJson(True, '批量设置成功')
600597

plugins/tamper_proof_py/info.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"title": "网站防篡改程序[PY]",
2+
"title": "网站防篡改程序PY",
33
"tip": "lib",
44
"name": "tamper_proof_py",
55
"type": "soft",
6-
"ps": "事件型防篡改程序,可有效保护网站重要文件不被木马篡改",
6+
"ps": "事件型防篡改程序,可有效保护网站重要文件不被木马篡改[Python]",
77
"versions": "1.0",
88
"shell": "install.sh",
99
"checks": "server/tamper_proof_py",

plugins/tamper_proof_py/tamper_proof_service.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ def check_site_logs(self, Stiename, datetime_time):
123123
return ret[0:20]
124124
return ret
125125

126-
def get_site_logs(self, Stiename):
126+
def get_site_logs(self, site_name):
127127
try:
128128
pythonV = sys.version_info[0]
129-
path = '/www/wwwlogs/' + Stiename + '.log'
129+
path = '/www/wwwlogs/' + site_name + '.log'
130130
num = 500
131131
if not os.path.exists(path):
132132
return []
@@ -422,7 +422,7 @@ def unlock(self, path):
422422
os.system('chattr -R -a {} &> /dev/null'.format(path))
423423
self.set_user_ini(path)
424424

425-
def close(self, reload=False):
425+
def close(self, close_reload=False):
426426
# 解除锁定
427427
sites = self.get_sites()
428428
print("")
@@ -433,11 +433,10 @@ def close(self, reload=False):
433433
tip = self._PLUGIN_PATH + '/tips/' + siteInfo['siteName'] + '.pl'
434434
if not siteInfo['open'] and not os.path.exists(tip):
435435
continue
436-
if reload and siteInfo['open']:
436+
if close_reload and siteInfo['open']:
437437
continue
438438
if sys.version_info[0] == 2:
439-
print(
440-
"【{}】|-Unlock website[{}]".format(mw.formatDate(), siteInfo['siteName'])),
439+
print("【{}】|-Unlock website[{}]".format(mw.formatDate(), siteInfo['siteName'])),
441440
else:
442441
os.system("echo -e '{}|-Unlock website[{}]\c'".format(mw.formatDate(), siteInfo['siteName']))
443442
#print("【{}】|-解锁网站[{}]".format(mw.format_date(),siteInfo['siteName']),end=" ")
@@ -514,8 +513,7 @@ def run():
514513
if not os.path.exists(tip):
515514
event.list_DIR(siteInfo['path'], siteInfo)
516515
try:
517-
watchManager.add_watch(
518-
siteInfo['path'], mode, auto_add=True, rec=True)
516+
watchManager.add_watch(siteInfo['path'], mode, auto_add=True, rec=True)
519517
except:
520518
print(mw.getTracebackInfo())
521519
tout = round(time.time() - s, 2)

plugins/webhook/install.sh

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Install_App()
1515
mkdir -p $serverPath/webhook
1616
echo "${VERSION}" > $serverPath/webhook/version.pl
1717
echo '安装完成'
18+
19+
which mw && mw restart
1820
}
1921

2022
Uninstall_App()

0 commit comments

Comments
 (0)