Compare commits

...
58 Commits
Author SHA1 Message Date
midoks 0c44305a01 Update requirements.txt 2021-05-01 11:11:22 +08:00
midoks 9c4d482471 Update requirements.txt 2021-05-01 11:07:11 +08:00
midoks 713f77c1ad up 2021-05-01 10:56:12 +08:00
midoks db2b71582b Update requirements.txt 2021-05-01 10:14:01 +08:00
midoks ccc750cce3 Update simdht_delta.conf 2021-04-30 21:59:14 +08:00
midoks 0dc26232b6 Update simdht_delta.conf 2021-04-30 21:58:36 +08:00
midoks fa0fc8eefe Update requirements.txt 2021-04-30 18:41:05 +08:00
midoks 1cadcde740 Update requirements.txt 2021-04-30 18:40:13 +08:00
midoks a602cad2db Update requirements.txt 2021-04-30 18:36:05 +08:00
midoks 0a400aeda9 Update requirements.txt 2021-04-30 18:35:13 +08:00
midoks aaca85bc7e Update requirements.txt 2021-04-30 18:27:06 +08:00
midoks fcba8a9269 Update requirements.txt 2021-04-30 18:19:47 +08:00
midoks 8931a28286 Update install_centos.sh 2021-04-30 18:02:09 +08:00
midoks 8d4d72e14d Update zimg.tpl 2021-04-26 17:21:46 +08:00
midoks fa40d1dc92 Update phplib.conf 2021-04-24 09:51:59 +08:00
midoks 4007d14517 Create openssl.sh 2021-04-24 09:51:09 +08:00
midoks 389db5404c up 2021-04-24 09:22:39 +08:00
midoks 763065e7ab Update install.sh 2021-04-24 09:19:30 +08:00
midoks c697f016aa 更新memcached版本 2021-04-24 09:19:12 +08:00
midoks 1df3b8efd0 更新版本 2021-04-24 09:08:53 +08:00
midoks bfce862180 up 2021-04-22 04:08:30 +08:00
midoks 3f0cc58bdc up 2021-04-22 04:00:01 +08:00
midoks 710482e9ed Update index.py 2021-04-13 15:21:10 +08:00
midoks 49dc230feb Update zimg.tpl 2021-04-13 15:15:03 +08:00
midoks bf6cca7b95 up 2021-04-13 13:15:20 +08:00
midoks 6281e7ae2d up 2021-04-13 12:57:58 +08:00
midoks 4f488ba75f Update zimg.tpl 2021-04-13 12:56:45 +08:00
midoks 1fa59d0a08 Update index.py 2021-04-13 12:55:28 +08:00
midoks ccc9bd26c5 up 2021-04-13 12:54:01 +08:00
midoks 1436a508a5 up 2021-04-13 12:51:56 +08:00
midoks a9aabdfa0c Update install.sh 2021-04-13 12:43:18 +08:00
midoks a6d2081d22 Update install.sh 2021-04-13 12:23:26 +08:00
midoks 88dba0e876 Update install.sh 2021-04-13 12:16:56 +08:00
midoks 88c9680682 Update install.sh 2021-04-13 12:10:49 +08:00
midoks 1e1157159a up 2021-04-13 12:00:48 +08:00
midoks b2fe48e1f2 up 2021-04-11 18:38:52 +08:00
midoks e1b5d6f8b1 Update phplib.conf 2021-04-11 18:34:22 +08:00
midoks 003a0bfacc Create openssl.sh 2021-04-11 18:32:26 +08:00
midoks 08b73394ee Update index.py 2021-04-11 12:19:26 +08:00
midoks ec9d4c050f Update index.py 2021-04-11 12:13:21 +08:00
midoks 6460a0d7db up 2021-04-11 12:12:36 +08:00
midoks f709a033a5 up 2021-04-11 12:05:31 +08:00
midoks 851d6829ee up 2021-04-11 11:51:30 +08:00
midoks 8b5f2aec6b Update index.py 2021-04-11 11:46:20 +08:00
midoks 32f911c3cf Update index.py 2021-04-11 11:37:09 +08:00
midoks ef74376c21 Update index.py 2021-04-11 11:36:26 +08:00
midoks 2752d758b5 up 2021-04-11 11:25:02 +08:00
midoks 296d4fb96d Update install.sh 2021-04-11 11:02:26 +08:00
midoks 69f8a492c8 Delete api_login.txt 2021-04-11 10:47:19 +08:00
midoks 21cf32852b aria2 2021-04-11 10:46:53 +08:00
midoks 5eff5e7b1a Create check-ssh.sh 2021-03-09 22:49:59 +08:00
midoks 9edd79e5f1 up 2021-02-21 15:56:10 +08:00
midoks 4c2a42fc48 Update init.lua 2021-02-21 12:51:46 +08:00
midoks 10446a1934 Update luawaf.conf 2021-02-21 12:51:39 +08:00
midoks 3aeb2b0959 up 2021-02-21 12:34:58 +08:00
midoks e9807280d5 Update init.lua 2021-02-21 12:05:38 +08:00
midoks 395f8b456a up 2021-02-21 11:28:46 +08:00
midoks ef7c9d4e47 Update info.json 2021-02-21 11:06:14 +08:00
41 changed files with 1512 additions and 47 deletions
+102
View File
@@ -0,0 +1,102 @@
## 文件保存相关 ##
# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置
dir=/tmp/aria2
# 设置日志等级
log-level=error
# 日志保存路径
log={$SERVER_PATH}/aria2.log
# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M
disk-cache=32M
# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc
# 预分配所需时间: none < falloc ? trunc < prealloc
# falloc和trunc则需要文件系统和内核支持
# NTFS建议使用falloc, EXT3/4建议trunc, MAC 下需要注释此项
#file-allocation=none
# 断点续传
continue=true
## 下载连接相关 ##
# 最大同时下载任务数, 运行时可修改, 默认:5
max-concurrent-downloads=5
# 同一服务器连接数, 添加时可指定, 默认:1
max-connection-per-server=10
# 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M
# 假定size=10M, 文件为20MiB 则使用两个来源下载; 文件为15MiB 则使用一个来源下载
min-split-size=10M
# 单个任务最大线程数, 添加时可指定, 默认:5
split=128
# 整体下载速度限制, 运行时可修改, 默认:0
#max-overall-download-limit=0
# 单个任务下载速度限制, 默认:0
#max-download-limit=0
# 整体上传速度限制, 运行时可修改, 默认:0
#max-overall-upload-limit=0
# 单个任务上传速度限制, 默认:0
#max-upload-limit=0
# 禁用IPv6, 默认:false
disable-ipv6=true
## 进度保存相关 ##
# 从会话文件中读取下载任务
input-file={$SERVER_PATH}/aria2.session
# 在Aria2退出时保存`错误/未完成`的下载任务到会话文件
save-session={$SERVER_PATH}/aria2.session
# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0
#save-session-interval=60
## RPC相关设置 ##
# 启用RPC, 默认:false
enable-rpc=true
# 允许所有来源, 默认:false
rpc-allow-origin-all=true
# 允许非外部访问, 默认:false
rpc-listen-all=true
# 事件轮询方式, 取值:[epoll, kqueue, port, poll, select], 不同系统默认值不同
#event-poll=select
# RPC监听端口, 端口被占用时可以修改, 默认:6800
rpc-listen-port=6800
# 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项
#rpc-secret=sark
# 设置的RPC访问用户名, 此选项新版已废弃, 建议改用 --rpc-secret 选项
#rpc-user=<USER>
# 设置的RPC访问密码, 此选项新版已废弃, 建议改用 --rpc-secret 选项
#rpc-passwd=<PASSWD>
## BT/PT下载相关 ##
# 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true
#follow-torrent=true
# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999
listen-port=51413
# 单个种子最大连接数, 默认:55
#bt-max-peers=55
# 打开DHT功能, PT需要禁用, 默认:true
enable-dht=false
# 打开IPv6 DHT功能, PT需要禁用
#enable-dht6=false
# DHT网络监听端口, 默认:6881-6999
#dht-listen-port=6881-6999
# 本地节点查找, PT需要禁用, 默认:false
#bt-enable-lpd=false
# 种子交换, PT需要禁用, 默认:true
enable-peer-exchange=false
# 每个种子限速, 对少种的PT很有用, 默认:50K
#bt-request-peer-speed-limit=50K
# 客户端伪装, PT需要
peer-id-prefix=-TR2770-
user-agent=Transmission/2.77
# 当种子的分享率达到这个数时, 自动停止做种, 0为一直做种, 默认:1.0
seed-ratio=0
# 强制保存会话, 即使任务已经完成, 默认:false
# 较新的版本开启后会在任务完成后依然保留.aria2文件
#force-save=false
# BT校验相关, 默认:true
#bt-hash-check-seed=true
# 继续之前的BT任务时, 无需再次校验, 默认:false
bt-seed-unverified=true
# 保存磁力链接元数据为种子文件(.torrent文件), 默认:false
bt-save-metadata=true
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

+19
View File
@@ -0,0 +1,19 @@
<div class="bt-form">
<div class="bt-w-main">
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('aria2');">服务</p>
<p onclick="pluginInitD('aria2');">自启动</p>
<p onclick="pluginConfig('aria2');">配置修改</p>
<p onclick="pluginLogs('aria2','','run_log');">运行日志</p>
<p onclick="readme();">说明</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con"></div>
</div>
</div>
</div>
<script type="text/javascript">
$.getScript( "/plugins/file?name=aria2&f=js/aria2.js", function(){
pluginService('aria2');
});
</script>
+211
View File
@@ -0,0 +1,211 @@
# coding:utf-8
import sys
import io
import os
import time
import shutil
sys.path.append(os.getcwd() + "/class/core")
import mw
app_debug = False
if mw.isAppleSystem():
app_debug = True
def getPluginName():
return 'aria2'
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
def getServerDir():
return mw.getServerDir() + '/' + getPluginName()
def getInitDTpl():
path = getPluginDir() + "/init.d/aria2.tpl"
return path
def getArgs():
args = sys.argv[2:]
tmp = {}
args_len = len(args)
if args_len == 1:
t = args[0].strip('{').strip('}')
t = t.split(':')
tmp[t[0]] = t[1]
elif args_len > 1:
for i in range(len(args)):
t = args[i].split(':')
tmp[t[0]] = t[1]
return tmp
def initDreplace():
file_tpl = getInitDTpl()
service_path = os.path.dirname(os.getcwd())
initD_path = getServerDir() + '/init.d'
file_bin = initD_path + '/' + getPluginName()
if not os.path.exists(initD_path):
os.mkdir(initD_path)
# initd replace
content = mw.readFile(file_tpl)
content = content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(file_bin, content)
mw.execShell('chmod +x ' + file_bin)
aria2_path = getServerDir() + '/aria2'
mw.execShell('mkdir -p /tmp/download')
if not os.path.exists(aria2_path):
mw.execShell('mkdir -p ' + aria2_path)
mw.execShell('touch ' + aria2_path + '/aria2.session')
path = getPluginDir() + "/conf/aria2.conf"
content = mw.readFile(path)
content = content.replace('{$SERVER_PATH}', aria2_path)
mw.writeFile(aria2_path + '/aria2.conf', content)
return file_bin
def checkArgs(data, ck=[]):
for i in range(len(ck)):
if not ck[i] in data:
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
return (True, mw.returnJson(True, 'ok'))
def status():
cmd = "ps -ef|grep aria2 |grep -v grep | grep -v 'mdserver-web'| awk '{print $2}'"
data = mw.execShell(cmd)
if data[0] == '':
return 'stop'
return 'start'
def start():
file = initDreplace()
data = mw.execShell(file + ' start')
if data[1] == '':
return 'ok'
return data[1]
def stop():
file = initDreplace()
data = mw.execShell(file + ' stop')
# print data
if data[1] == '':
return 'ok'
return data[1]
def restart():
file = initDreplace()
data = mw.execShell(file + ' reload')
if data[1] == '':
return 'ok'
return data[1]
def reload():
file = initDreplace()
data = mw.execShell(file + ' reload')
if data[1] == '':
return 'ok'
return data[1]
def getPathFile():
if mw.isAppleSystem():
user = mw.execShell(
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
return '/Users/' + user + '/.aria2/aria2.conf'
return getServerDir() + '/aria2/aria2.conf'
def getInitDFile():
if app_debug:
return '/tmp/' + getPluginName()
return '/etc/init.d/' + getPluginName()
def initdStatus():
if not app_debug:
if mw.isAppleSystem():
return "Apple Computer does not support"
initd_bin = getInitDFile()
if os.path.exists(initd_bin):
return 'ok'
return 'fail'
def initdInstall():
source_bin = initDreplace()
initd_bin = getInitDFile()
shutil.copyfile(source_bin, initd_bin)
mw.execShell('chmod +x ' + initd_bin)
if not app_debug:
mw.execShell('chkconfig --add ' + getPluginName())
return 'ok'
def initdUinstall():
if not app_debug:
mw.execShell('chkconfig --del ' + getPluginName())
initd_bin = getInitDFile()
if os.path.exists(initd_bin):
os.remove(initd_bin)
return 'ok'
def getLog():
if mw.isAppleSystem():
user = mw.execShell(
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
return '/Users/' + user + '/.aria2/aria2.log'
return getServerDir() + '/aria2/aria2.log'
if __name__ == "__main__":
func = sys.argv[1]
if func == 'status':
print status()
elif func == 'start':
print start()
elif func == 'stop':
print stop()
elif func == 'restart':
print restart()
elif func == 'reload':
print reload()
elif func == 'conf':
print getPathFile()
elif func == 'initd_status':
print initdStatus()
elif func == 'initd_install':
print initdInstall()
elif func == 'initd_uninstall':
print initdUinstall()
elif func == 'run_log':
print getLog()
else:
print 'error'
+15
View File
@@ -0,0 +1,15 @@
{
"title":"aria2",
"tip":"soft",
"name":"aria2",
"type":"其他插件",
"ps":"一款下载神器",
"versions":"1.0",
"shell":"install.sh",
"checks":"server/aria2",
"path": "server/aria2",
"author":"midoks",
"home":"https://github.com/aria2/aria2",
"date":"2020-06-08",
"pid": "5"
}
+49
View File
@@ -0,0 +1,49 @@
#!/bin/sh
# chkconfig: 2345 55 25
# description: aria2 Service
### BEGIN INIT INFO
# Provides: aria2
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts aria2
# Description: starts the MDW-Web
### END INIT INFO
app_start(){
# aria2c -D
aria2c --daemon --enable-rpc --rpc-listen-all -c -D --conf-path={$SERVER_PATH}/aria2/aria2/aria2.conf
echo "aria2 started"
}
app_stop(){
echo "Stopping ..."
arr=`ps -ef | grep "aria2" | grep -v 'grep' | grep -v '/bin/sh'|grep -v 'index.py' | awk '{print $2}'`
echo $arr
for p in ${arr[@]}
do
kill -9 $p &>/dev/null
done
echo "aria2 stopped"
}
case "$1" in
start)
app_start
;;
stop)
app_stop
;;
restart|reload)
app_stop
sleep 0.3
app_start
;;
*)
echo "Please use start or stop as first argument"
;;
esac
+49
View File
@@ -0,0 +1,49 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
install_tmp=${rootPath}/tmp/mw_install.pl
SYSOS=`uname`
Install_aria2()
{
isStart=""
echo '正在安装脚本文件...' > $install_tmp
mkdir -p $serverPath/aria2
echo '1.0' > $serverPath/aria2/version.pl
if [ "Darwin" == "$SYSOS" ];then
echo 'macosx unavailable' > $install_tmp
find_sh=`which aria2c`
if [ "$?" != "0" ];then
brew install aria2
fi
else
find_sh=`which aria2c`
if [ "$?" != "0" ];then
yum install aria2 -y
fi
fi
echo 'Install complete' > $install_tmp
}
Uninstall_aria2()
{
rm -rf $serverPath/aria2
echo "Uninstall completed" > $install_tmp
}
action=$1
if [ "${1}" == 'install' ];then
Install_aria2
else
Uninstall_aria2
fi
+92
View File
@@ -0,0 +1,92 @@
function str2Obj(str){
var data = {};
kv = str.split('&');
for(i in kv){
v = kv[i].split('=');
data[v[0]] = v[1];
}
return data;
}
function lpPost(method,args,callback, title){
var _args = null;
if (typeof(args) == 'string'){
_args = JSON.stringify(str2Obj(args));
} else {
_args = JSON.stringify(args);
}
var _title = '正在获取...';
if (typeof(title) != 'undefined'){
_title = title;
}
var loadT = layer.msg(_title, { icon: 16, time: 0, shade: 0.3 });
$.post('/plugins/run', {name:'aria2', func:method, args:_args}, function(data) {
layer.close(loadT);
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function lpAsyncPost(method,args){
var _args = null;
if (typeof(args) == 'string'){
_args = JSON.stringify(str2Obj(args));
} else {
_args = JSON.stringify(args);
}
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
return syncPost('/plugins/run', {name:'l2tp', func:method, args:_args});
}
function userList(){
lpPost('user_list', '' ,function(data){
var rdata = $.parseJSON(data['data']);
if (!rdata['status']){
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
var list = rdata['data'];
var con = '';
con += '<div class="divtable" style="margin-top:5px;"><table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">';
con += '<thead><tr>';
con += '<th>用户</th>';
con += '<th>密码</th>';
con += '<th>操作(<a class="btlink" onclick="addUser()">添加</a>)</th>';
con += '</tr></thead>';
con += '<tbody>';
for (var i = 0; i < list.length; i++) {
con += '<tr>'+
'<td>' + list[i]['user']+'</td>' +
'<td>' + list[i]['pwd']+'</td>' +
'<td><a class="btlink" onclick="modUser(\''+list[i]['user']+'\')">改密</a>|<a class="btlink" onclick="delUser(\''+list[i]['user']+'\')">删除</a></td></tr>';
}
con += '</tbody>';
con += '</table></div>';
$(".soft-man-con").html(con);
});
}
function readme(){
var readme = '<ul class="help-info-text c7">';
readme += '<li>使用时,查看对应的端口</li>';
readme += '</ul>';
$('.soft-man-con').html(readme);
}
+1 -1
View File
@@ -12,5 +12,5 @@
"author":"Google",
"home":"https://github.com/google/bbr",
"date":"2019-03-29",
"pid":"4"
"pid":"5"
}
+2 -2
View File
@@ -4,8 +4,8 @@
"name": "memcached",
"title": "Memcached",
"shell": "install.sh",
"versions":["1.5"],
"updates":["1.5.12"],
"versions":["1.6"],
"updates":["1.6.9"],
"tip": "soft",
"checks": "server/memcached",
"path":"server/memcached",
+2 -2
View File
@@ -16,7 +16,7 @@ Install_mem(){
echo '正在安装脚本文件...' > $install_tmp
if [ ! -f $serverPath/source/memcached.tar.gz ];then
wget -O $serverPath/source/memcached.tar.gz http://www.memcached.org/files/memcached-1.5.12.tar.gz
wget -O $serverPath/source/memcached.tar.gz http://www.memcached.org/files/memcached-1.6.9.tar.gz
fi
cd $serverPath/source && tar -zxvf memcached.tar.gz
@@ -25,7 +25,7 @@ Install_mem(){
cd $serverPath/source/memcached*
./configure --prefix=$serverPath/memcached && make && make install
echo '1.5' > $serverPath/memcached/version.pl
echo '1.6' > $serverPath/memcached/version.pl
echo 'install ok' > $install_tmp
}
+1
View File
@@ -1,4 +1,5 @@
[client]
user = root
#password = your_password
port = 3306
socket = {$SERVER_APP_PATH}/mysql.sock
+1
View File
@@ -1,4 +1,5 @@
[client]
user = root
#password = your_password
port = 3306
socket = {$SERVER_APP_PATH}/mysql.sock
+1 -1
View File
@@ -1,7 +1,7 @@
lua_shared_dict limit 30m;
lua_shared_dict drop_ip 30m;
lua_shared_dict drop_sum 30m;
lua_package_path "{$WAF_PATH}/lua/?.lua";
lua_package_path "{$WAF_PATH}/lua/?.lua;{$ROOT_PATH}/openresty/lualib/?.lua;;";
access_by_lua_file {$WAF_PATH}/lua/init.lua;
#init_by_lua_file {$WAF_PATH}/lua/init.lua;
+13 -13
View File
@@ -172,10 +172,6 @@ def initTotalInfo():
def status():
initDomainInfo()
initSiteInfo()
initTotalInfo()
path = getConf()
if not os.path.exists(path):
return 'stop'
@@ -199,19 +195,19 @@ def contentReplace(content):
def initDreplace():
config = getPluginDir() + '/waf/config.json'
content = mw.readFile(config)
content = json.loads(content)
content['reqfile_path'] = mw.getServerDir(
) + "/openresty/nginx/conf/waf/html"
mw.writeFile(config, mw.getJson(content))
path = mw.getServerDir() + "/openresty/nginx/conf"
if not os.path.exists(path + '/waf'):
sdir = getPluginDir() + '/waf'
cmd = 'cp -rf ' + sdir + ' ' + path
mw.execShell(cmd)
config = mw.getServerDir() + '/openresty/nginx/conf/waf/config.json'
content = mw.readFile(config)
content = json.loads(content)
content['reqfile_path'] = mw.getServerDir(
) + "/openresty/nginx/conf/waf/html"
mw.writeFile(config, mw.getJson(content))
config = mw.getServerDir() + "/openresty/nginx/conf/waf/lua/init.lua"
content = mw.readFile(config)
content = contentReplace(content)
@@ -223,6 +219,10 @@ def initDreplace():
content = contentReplace(content)
mw.writeFile(waf_conf, content)
initDomainInfo()
initSiteInfo()
initTotalInfo()
def start():
initDreplace()
@@ -669,7 +669,7 @@ def setCcConf():
def setSiteCcConf():
return mw.returnJson(True, '设置成功-?!', [])
return mw.returnJson(False, '暂未开发!', [])
def saveScanRule():
@@ -986,4 +986,4 @@ if __name__ == "__main__":
elif func == 'waf_site':
print getWafSite()
else:
print 'error'
print('error')
+1 -1
View File
@@ -1,5 +1,5 @@
{
"title":"OP防火墙[DEV]",
"title":"OP防火墙",
"tip":"soft",
"name":"op_waf",
"type":"其他插件",
+1 -1
View File
@@ -1 +1 @@
{"reqfile_path":"/Users/midoks/Desktop/fwww/server/openresty/nginx/conf/waf/html","retry":{"retry_time":180,"is_open_global":0,"retry":6,"retry_cycle":60},"log":true,"scan":{"status":444,"ps":"过滤常见扫描测试工具的渗透测试","open":true,"reqfile":""},"cc":{"status":444,"ps":"过虑CC攻击","limit":120,"endtime":300,"open":true,"reqfile":"","cycle":60},"get":{"status":403,"ps":"过滤uri、uri参数中常见sql注入、xss等攻击","open":true,"reqfile":"get.html"},"log_save":30,"user-agent":{"status":403,"ps":"通常用于过滤浏览器、蜘蛛及一些自动扫描器","open":true,"reqfile":"user_agent.html"},"other":{"status":403,"ps":"其它非通用过滤","reqfile":"other.html"},"cookie":{"status":403,"ps":"过滤利用Cookie发起的渗透攻击","open":true,"reqfile":"cookie.html"},"logs_path":"/www/wwwlogs/btwaf","post":{"status":403,"ps":"过滤POST参数中常见sql注入、xss等攻击","open":true,"reqfile":"post.html"},"open":true}
{"reqfile_path": "{$WAF_PATH}/html", "retry": {"retry_time": 180, "is_open_global": 0, "retry": 6, "retry_cycle": 60}, "log": true, "scan": {"status": 444, "ps": "\u8fc7\u6ee4\u5e38\u89c1\u626b\u63cf\u6d4b\u8bd5\u5de5\u5177\u7684\u6e17\u900f\u6d4b\u8bd5", "open": true, "reqfile": ""}, "cc": {"status": 444, "ps": "\u8fc7\u8651CC\u653b\u51fb", "limit": 120, "endtime": 300, "open": true, "reqfile": "", "cycle": 60}, "get": {"status": 403, "ps": "\u8fc7\u6ee4uri\u3001uri\u53c2\u6570\u4e2d\u5e38\u89c1sql\u6ce8\u5165\u3001xss\u7b49\u653b\u51fb", "open": true, "reqfile": "get.html"}, "log_save": 30, "user-agent": {"status": 403, "ps": "\u901a\u5e38\u7528\u4e8e\u8fc7\u6ee4\u6d4f\u89c8\u5668\u3001\u8718\u86db\u53ca\u4e00\u4e9b\u81ea\u52a8\u626b\u63cf\u5668", "open": true, "reqfile": "user_agent.html"}, "other": {"status": 403, "ps": "\u5176\u5b83\u975e\u901a\u7528\u8fc7\u6ee4", "reqfile": "other.html"}, "cookie": {"status": 403, "ps": "\u8fc7\u6ee4\u5229\u7528Cookie\u53d1\u8d77\u7684\u6e17\u900f\u653b\u51fb", "open": true, "reqfile": "cookie.html"}, "logs_path": "/www/wwwlogs/btwaf", "post": {"status": 403, "ps": "\u8fc7\u6ee4POST\u53c2\u6570\u4e2d\u5e38\u89c1sql\u6ce8\u5165\u3001xss\u7b49\u653b\u51fb", "open": true, "reqfile": "post.html"}, "open": true}
+3 -3
View File
@@ -1,7 +1,7 @@
local cpath = "/Users/midoks/Desktop/fwww/server/openresty/nginx/conf/waf/"
local rpath = "/Users/midoks/Desktop/fwww/server/openresty/nginx/conf/waf/rule/"
local logdir = "/Users/midoks/Desktop/fwww/wwwlogs/waf/"
local cpath = "{$WAF_PATH}/"
local rpath = "{$WAF_PATH}/rule/"
local logdir = "{$ROOT_PATH}/wwwlogs/waf/"
local json = require "cjson"
local ngx_match = ngx.re.find
+90
View File
@@ -0,0 +1,90 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
actionType=$1
version=$2
LIBNAME=openssl
LIBV=0
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20131226/${LIBNAME}.so
sysName=`uname`
if [ "$sysName" == "Darwin" ];then
BAK='_bak'
else
BAK=''
fi
Install_lib()
{
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
if [ "${isInstall}" != "" ];then
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
cd $sourcePath/php${version}/ext/${LIBNAME}
if [ ! -f "config.m4" ];then
mv config0.m4 config.m4
fi
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config
make clean && make && make install && make clean
fi
echo "" >> $serverPath/php/$version/etc/php.ini
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
echo '==========================================================='
echo 'successful!'
}
Uninstall_lib()
{
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
echo "php-$version 未安装,请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
return
fi
echo $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+87
View File
@@ -0,0 +1,87 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
actionType=$1
version=$2
LIBNAME=mcrypt
LIBV=0
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20160303/${LIBNAME}.so
sysName=`uname`
if [ "$sysName" == "Darwin" ];then
BAK='_bak'
else
BAK=''
fi
Install_lib()
{
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
if [ "${isInstall}" != "" ];then
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
cd $sourcePath/php${version}/ext/${LIBNAME}
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config
make clean && make && make install && make clean
fi
echo "" >> $serverPath/php/$version/etc/php.ini
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
echo '==========================================================='
echo 'successful!'
}
Uninstall_lib()
{
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
echo "php-$version 未安装,请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
return
fi
echo $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+90
View File
@@ -0,0 +1,90 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
actionType=$1
version=$2
LIBNAME=openssl
LIBV=0
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20160303/${LIBNAME}.so
sysName=`uname`
if [ "$sysName" == "Darwin" ];then
BAK='_bak'
else
BAK=''
fi
Install_lib()
{
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
if [ "${isInstall}" != "" ];then
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
cd $sourcePath/php${version}/ext/${LIBNAME}
if [ ! -f "config.m4" ];then
mv config0.m4 config.m4
fi
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config
make clean && make && make install && make clean
fi
echo "" >> $serverPath/php/$version/etc/php.ini
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
echo '==========================================================='
echo 'successful!'
}
Uninstall_lib()
{
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
echo "php-$version 未安装,请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
return
fi
echo $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+1 -1
View File
@@ -11,7 +11,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
version=7.2.32
version=7.2.34
PHP_VER=72
Install_php()
{
+87
View File
@@ -0,0 +1,87 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
actionType=$1
version=$2
LIBNAME=mcrypt
LIBV=0
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20170718/${LIBNAME}.so
sysName=`uname`
if [ "$sysName" == "Darwin" ];then
BAK='_bak'
else
BAK=''
fi
Install_lib()
{
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
if [ "${isInstall}" != "" ];then
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
cd $sourcePath/php${version}/ext/${LIBNAME}
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config
make clean && make && make install && make clean
fi
echo "" >> $serverPath/php/$version/etc/php.ini
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
echo '==========================================================='
echo 'successful!'
}
Uninstall_lib()
{
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
echo "php-$version 未安装,请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
return
fi
echo $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+90
View File
@@ -0,0 +1,90 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
actionType=$1
version=$2
LIBNAME=openssl
LIBV=0
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20170718/${LIBNAME}.so
sysName=`uname`
if [ "$sysName" == "Darwin" ];then
BAK='_bak'
else
BAK=''
fi
Install_lib()
{
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
if [ "${isInstall}" != "" ];then
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
cd $sourcePath/php${version}/ext/${LIBNAME}
if [ ! -f "config.m4" ];then
mv config0.m4 config.m4
fi
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config
make clean && make && make install && make clean
fi
echo "" >> $serverPath/php/$version/etc/php.ini
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
echo '==========================================================='
echo 'successful!'
}
Uninstall_lib()
{
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
echo "php-$version 未安装,请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
return
fi
echo $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+1 -1
View File
@@ -11,7 +11,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
version=7.4.15
version=7.4.16
PHP_VER=74
Install_php()
{
+1 -1
View File
@@ -11,7 +11,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
version=8.0.2
version=8.0.3
PHP_VER=80
Install_php()
{
+23
View File
@@ -48,6 +48,29 @@
"shell": "opcache.sh",
"check": "opcache.so"
},
{
"name": "openssl",
"versions": [
"56",
"71",
"72"
],
"type": "通用扩展",
"msg": "SSL!",
"shell": "openssl.sh",
"check": "openssl.so"
},
{
"name": "mcrypt",
"versions": [
"71",
"72"
],
"type": "通用扩展",
"msg": "加密软件!",
"shell": "mcrypt.sh",
"check": "mcrypt.so"
},
{
"name": "pcntl",
"versions": [
@@ -7,7 +7,7 @@ import sys
sys.path.append("/usr/local/lib/python2.7/site-packages")
class mysql:
class simdht_mysql:
__DB_PASS = None
__DB_USER = 'root'
__DB_PORT = 3306
+3 -3
View File
@@ -24,7 +24,7 @@ def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
sys.path.append(getPluginDir() + "/class")
import mysql
import simdht_mysql
def getServerDir():
@@ -216,7 +216,7 @@ def getDbConfInfo():
def pMysqlDb():
data = getDbConfInfo()
conn = mysql.mysql()
conn = simdht_mysql.simdht_mysql()
conn.setHost(data['DB_HOST'])
conn.setUser(data['DB_USER'])
conn.setPwd(data['DB_PASS'])
@@ -271,7 +271,7 @@ def getTrendData():
three = getMinData(pdb, 10)
return mw.getJson([one, two, three])
except Exception as e:
print str(e)
# print str(e)
return mw.getJson([0, 0, 0])
+3 -5
View File
@@ -4,7 +4,7 @@
indexer
{
mem_limit = 32M
mem_limit = 128M
}
searchd
@@ -39,9 +39,7 @@ source search_hash
sql_range_step = 1000
sql_query_pre = SET NAMES utf8
sql_query = \
SELECT id, name, CRC32(category) AS category, length, UNIX_TIMESTAMP(create_time) AS create_time, UNIX_TIMESTAMP(last_seen) AS last_seen\
FROM search_hash where id >= $start AND id <= $end AND is_has=1
sql_query = SELECT * from ( SELECT s1.id id, s1.name name, s1.category category, s1.length length, UNIX_TIMESTAMP(s1.create_time) as create_time, UNIX_TIMESTAMP(s1.last_seen) as last_seen, s2.file_list file_list, s1.info_hash info_hash FROM search_hash s1 left join search_filelist s2 on s1.info_hash=s2.info_hash where s1.is_has=1 and s1.id >= $start AND s1.id <= $end ) as s WHERE s.file_list is not null
sql_attr_bigint = length
sql_attr_timestamp = create_time
@@ -53,7 +51,7 @@ source search_hash_delta : search_hash
{
sql_query_range = SELECT (SELECT max_doc_id FROM `sph_counter` where counter_id=1) as min, (SELECT max(id) FROM search_hash) as max
sql_query_pre = SET NAMES utf8
sql_query = SELECT id, name, CRC32(category) AS category, length, UNIX_TIMESTAMP(create_time) AS create_time, UNIX_TIMESTAMP(last_seen) AS last_seen FROM search_hash where id >= $start AND id <= $end AND is_has=1
sql_query = SELECT * from ( SELECT s1.id id, s1.name name, s1.category category, s1.length length, UNIX_TIMESTAMP(s1.create_time) as create_time, UNIX_TIMESTAMP(s1.last_seen) as last_seen, s2.file_list file_list, s1.info_hash info_hash FROM search_hash s1 left join search_filelist s2 on s1.info_hash=s2.info_hash where s1.is_has=1 and s1.id >= $start AND s1.id <= $end ) as s WHERE s.file_list is not null
sql_attr_bigint = length
sql_attr_timestamp = create_time
sql_attr_timestamp = last_seen
+21
View File
@@ -0,0 +1,21 @@
#! /bin/bash
#禁止弱口令登录改良版
cat /var/log/secure|awk '/Failed/{print $(NF-3)}'|sort|uniq -c|awk '{print $2"="$1;}' > black.txt #尝试登录的次数和ip
DEFINE="5" #单个ip尝试登录最大值
for i in `cat /root/black.txt`
do
IP=`echo $i |awk -F= '{print $1}'`
NUM=`echo $i|awk -F= '{print $2}'`
if [ $NUM -gt $DEFINE ]; then
grep $IP /etc/hosts.deny > /dev/null
if [ $? -gt 0 ]; then
echo "sshd:$IP" >> /etc/hosts.deny #扔到hosts文件中
fi
fi
done
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+19
View File
@@ -0,0 +1,19 @@
<div class="bt-form">
<div class="bt-w-main">
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('zimg');">服务</p>
<p onclick="pluginInitD('zimg');">自启动</p>
<p onclick="pluginConfig('zimg');">配置修改</p>
<p onclick="pluginLogs('zimg','','run_log');">运行日志</p>
<p onclick="readme();">说明</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con"></div>
</div>
</div>
</div>
<script type="text/javascript">
$.getScript( "/plugins/file?name=zimg&f=js/zimg.js", function(){
pluginService('zimg');
});
</script>
+189
View File
@@ -0,0 +1,189 @@
# coding:utf-8
import sys
import io
import os
import time
import shutil
import subprocess
sys.path.append(os.getcwd() + "/class/core")
import mw
app_debug = False
if mw.isAppleSystem():
app_debug = True
def getPluginName():
return 'zimg'
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
def getServerDir():
return mw.getServerDir() + '/' + getPluginName()
def getInitDTpl():
path = getPluginDir() + "/init.d/zimg.tpl"
return path
def getArgs():
args = sys.argv[2:]
tmp = {}
args_len = len(args)
if args_len == 1:
t = args[0].strip('{').strip('}')
t = t.split(':')
tmp[t[0]] = t[1]
elif args_len > 1:
for i in range(len(args)):
t = args[i].split(':')
tmp[t[0]] = t[1]
return tmp
def initDreplace():
file_tpl = getInitDTpl()
service_path = os.path.dirname(os.getcwd())
initD_path = getServerDir() + '/init.d'
file_bin = initD_path + '/' + getPluginName()
if not os.path.exists(initD_path):
os.mkdir(initD_path)
# initd replace
content = mw.readFile(file_tpl)
content = content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(file_bin, content)
mw.execShell('chmod +x ' + file_bin)
return file_bin
def checkArgs(data, ck=[]):
for i in range(len(ck)):
if not ck[i] in data:
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
return (True, mw.returnJson(True, 'ok'))
def status():
cmd = "ps -ef|grep zimg |grep -v grep | grep -v 'mdserver-web'| awk '{print $2}'"
data = mw.execShell(cmd)
if data[0] == '':
return 'stop'
return 'start'
def start():
file = initDreplace()
data = mw.execShell(file + ' start')
if data[1] == '':
return 'ok'
return data[1]
def stop():
file = initDreplace()
data = mw.execShell(file + ' stop')
# print data
if data[1] == '':
return 'ok'
return data[1]
def restart():
file = initDreplace()
data = mw.execShell(file + ' reload')
if data[1] == '':
return 'ok'
return data[1]
def reload():
file = initDreplace()
data = mw.execShell(file + ' reload')
if data[1] == '':
return 'ok'
return data[1]
def getPathFile():
return getServerDir() + '/bin/conf/zimg.lua'
def getInitDFile():
if app_debug:
return '/tmp/' + getPluginName()
return '/etc/init.d/' + getPluginName()
def initdStatus():
if not app_debug:
if mw.isAppleSystem():
return "Apple Computer does not support"
initd_bin = getInitDFile()
if os.path.exists(initd_bin):
return 'ok'
return 'fail'
def initdInstall():
source_bin = initDreplace()
initd_bin = getInitDFile()
shutil.copyfile(source_bin, initd_bin)
mw.execShell('chmod +x ' + initd_bin)
if not app_debug:
mw.execShell('chkconfig --add ' + getPluginName())
return 'ok'
def initdUinstall():
if not app_debug:
mw.execShell('chkconfig --del ' + getPluginName())
initd_bin = getInitDFile()
if os.path.exists(initd_bin):
os.remove(initd_bin)
return 'ok'
def getLog():
return getServerDir() + '/bin/log/zimg.log'
if __name__ == "__main__":
func = sys.argv[1]
if func == 'status':
print status()
elif func == 'start':
print start()
elif func == 'stop':
print stop()
elif func == 'restart':
print restart()
elif func == 'reload':
print reload()
elif func == 'conf':
print getPathFile()
elif func == 'initd_status':
print initdStatus()
elif func == 'initd_install':
print initdInstall()
elif func == 'initd_uninstall':
print initdUinstall()
elif func == 'run_log':
print getLog()
else:
print 'error'
+15
View File
@@ -0,0 +1,15 @@
{
"title":"zimg",
"tip":"soft",
"name":"zimg",
"type":"其他插件",
"ps":"轻量级图片服务器软件",
"versions":"1.0",
"shell":"install.sh",
"checks":"server/zimg",
"path": "server/zimg",
"author":"midoks",
"home":"https://github.com/buaazp/zimg",
"date":"2021-04-13",
"pid": "5"
}
+50
View File
@@ -0,0 +1,50 @@
#!/bin/sh
# chkconfig: 2345 55 25
# description: zimg Service
### BEGIN INIT INFO
# Provides: zimg
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts zimg
# Description: starts the MDW-Web
### END INIT INFO
app_start(){
# aria2c -D
cd {$SERVER_PATH}/zimg/bin
./zimg -d {$SERVER_PATH}/zimg/bin/conf/zimg.lua </dev/null &>/dev/null
echo "zimg started"
}
app_stop(){
echo "Stopping ..."
arr=`ps -ef | grep "zimg" | grep -v 'grep' | grep -v '/bin/sh'|grep -v 'index.py' | awk '{print $2}'`
echo $arr
for p in ${arr[@]}
do
kill -9 $p &>/dev/null
done
echo "zimg stopped"
}
case "$1" in
start)
app_start
;;
stop)
app_stop
;;
restart|reload)
app_stop
sleep 0.3
app_start
;;
*)
echo "Please use start or stop as first argument"
;;
esac
+73
View File
@@ -0,0 +1,73 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
zimgSourceDir=${serverPath}/source/zimg
install_tmp=${rootPath}/tmp/mw_install.pl
SYSOS=`uname`
Install_libjpeg_turbo(){
mkdir -p $zimgSourceDir/libjpeg-turbo
cd $zimgSourceDir/libjpeg-turbo
if [ ! -d $zimgSourceDir/libjpeg-turbo ];then
wget https://downloads.sourceforge.net/project/libjpeg-turbo/1.3.1/libjpeg-turbo-1.3.1.tar.gz
tar zxvf libjpeg-turbo-1.3.1.tar.gz
cd libjpeg-turbo-1.3.1
./configure --prefix=/usr/local --with-jpeg8
make && make install
fi
}
Install_zimg_source(){
mkdir -p $zimgSourceDir
cd $zimgSourceDir
if [ ! -d $zimgSourceDir/zimg ];then
git clone https://github.com/buaazp/zimg -b master --depth=1
cd zimg
make
fi
if [ -f $zimgSourceDir/zimg/bin/zimg ];then
cp -r $zimgSourceDir/zimg/bin $serverPath/zimg
fi
}
Install_zimg()
{
isStart=""
echo '正在安装脚本文件...' > $install_tmp
mkdir -p $serverPath/zimg
echo '1.0' > $serverPath/zimg/version.pl
if [ "Darwin" == "$SYSOS" ];then
echo 'macosx unavailable' > $install_tmp
else
if [ ! -f $serverPath/zimg/bin ];then
yum install nasm -y
Install_libjpeg_turbo
Install_zimg_source
fi
fi
echo 'Install complete' > $install_tmp
}
Uninstall_zimg()
{
rm -rf $serverPath/zimg
echo "Uninstall completed" > $install_tmp
}
action=$1
if [ "${1}" == 'install' ];then
Install_zimg
else
Uninstall_zimg
fi
+92
View File
@@ -0,0 +1,92 @@
function str2Obj(str){
var data = {};
kv = str.split('&');
for(i in kv){
v = kv[i].split('=');
data[v[0]] = v[1];
}
return data;
}
function lpPost(method,args,callback, title){
var _args = null;
if (typeof(args) == 'string'){
_args = JSON.stringify(str2Obj(args));
} else {
_args = JSON.stringify(args);
}
var _title = '正在获取...';
if (typeof(title) != 'undefined'){
_title = title;
}
var loadT = layer.msg(_title, { icon: 16, time: 0, shade: 0.3 });
$.post('/plugins/run', {name:'aria2', func:method, args:_args}, function(data) {
layer.close(loadT);
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function lpAsyncPost(method,args){
var _args = null;
if (typeof(args) == 'string'){
_args = JSON.stringify(str2Obj(args));
} else {
_args = JSON.stringify(args);
}
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
return syncPost('/plugins/run', {name:'l2tp', func:method, args:_args});
}
function userList(){
lpPost('user_list', '' ,function(data){
var rdata = $.parseJSON(data['data']);
if (!rdata['status']){
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
var list = rdata['data'];
var con = '';
con += '<div class="divtable" style="margin-top:5px;"><table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">';
con += '<thead><tr>';
con += '<th>用户</th>';
con += '<th>密码</th>';
con += '<th>操作(<a class="btlink" onclick="addUser()">添加</a>)</th>';
con += '</tr></thead>';
con += '<tbody>';
for (var i = 0; i < list.length; i++) {
con += '<tr>'+
'<td>' + list[i]['user']+'</td>' +
'<td>' + list[i]['pwd']+'</td>' +
'<td><a class="btlink" onclick="modUser(\''+list[i]['user']+'\')">改密</a>|<a class="btlink" onclick="delUser(\''+list[i]['user']+'\')">删除</a></td></tr>';
}
con += '</tbody>';
con += '</table></div>';
$(".soft-man-con").html(con);
});
}
function readme(){
var readme = '<ul class="help-info-text c7">';
readme += '<li>使用时,查看对应的端口</li>';
readme += '</ul>';
$('.soft-man-con').html(readme);
}
+10 -8
View File
@@ -1,21 +1,23 @@
werkzeug==0.16.1
setuptools==33.1.1
wheel
wheel==0.33.6
flask==1.0.2
flask-session==0.3.2
flask-socketio
flask-helper==0.19
cache==1.0.3
flask-caching==1.8.0
gunicorn==19.9
gevent==1.3.7
gevent-websocket
psutil
pillow
chardet
flask-sqlalchemy
requests
ConfigParser
psutil==5.6.6
pillow==6.2.2
chardet==3.0.4
flask-sqlalchemy==2.3.2
cryptography==3.3.2
requests==2.20.0
ConfigParser==3.5.0
MySQL-python==1.2.5
mysql-connector-python
flask-socketio==3.0.1
python-engineio==3.9.0
# pytest-shutil
+2 -2
View File
@@ -67,7 +67,7 @@ fi
systemctl stop firewalld
yum install -y libevent libevent-devel mysql-devel libjpeg* libpng* gd* zip unzip
yum install -y libevent libevent-devel mysql-devel libjpeg* libpng* gd* zip unzip libmcrypt libmcrypt-devel
if [ ! -d /www/server/mdserver-web ];then
wget -O /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
@@ -87,7 +87,7 @@ yum -y install MySQL-python
yum -y install epel-release
if [ ! -f '/usr/bin/pip' ];then
wget https://bootstrap.pypa.io/get-pip.py
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
pip install --upgrade pip
fi
+1 -1
View File
@@ -17,7 +17,7 @@ rm -rf /tmp/master.zip
rm -rf /tmp/mdserver-web-master
yum install -y curl-devel
yum install -y curl-devel libmcrypt libmcrypt-devel
cd /www/server/mdserver-web/scripts && sh lib.sh
pip install -r /www/server/mdserver-web/requirements.txt