腳本基本結構
def preprocess(req):
# req={
# 'url': 'http://target.com/vuln.php',
# 'method': 'GET',
# 'data': 'id=1',
# 'headers': {
# 'User-Agent': 'sqlmap'
# },
# 'cookie': 'PHPSESSID=123456'
# }
return req
假設驗證碼是POST的captcha=XXX
須在該腳本同目錄下創建__init__.py
空檔
此腳本無法辨識所有驗證碼,須自己調整
import requests
from PIL import Image
import pytesseract
from io import BytesIO
class colors:
Captcha_DEBUG='\033[38;5;176m'
Captcha_ERROR='\033[38;5;196m'
Captcha_RESET='\033[0m'
def CaptchaBypass(CaptchaURL,cookie=''):
resp = requests.get(CaptchaURL,cookies=cookie)
img = Image.open(BytesIO(resp.content))
code = pytesseract.image_to_string(img).strip()
return code
def preprocess(req):
url='https://example.com/captcha_URL'
cookie = {
'JSESSIONID': 'aaa3K8MGirMb-5CNBzBzz'
}
if req.data:
GetCaptcha=''
try:
GetCaptcha=CaptchaBypass(url,cookie)
except Exception as err_msg:
print(f"{colors.Captcha_ERROR}[ERROR] => {err_msg}{colors.Captcha_RESET}")
req.data += f"&captcha={GetCaptcha}".encode()
print(f'{colors.Captcha_DEBUG}[DEBUG] captcha => {GetCaptcha}{colors.Captcha_RESET}')
return req
基本必須參數(快速) # 單純只掃網站根目錄 # 例如 http://example.com/home/page,只掃 http://example.com/ dirsearch -u "http://example.com/" 常用參數 # 使用情境通常發生在,某些登入後的頁面或部分資源才可以存取,不加cookie就存取不到 # 當然也有些網站即使沒登入,但是沒cookie一樣存取不到 --cookie "SESSION_ID=xxx;abc=xxx;" # POST data
May 27, 2025當手動測試確定存在注入但是SQLmap檢測不到時
May 22, 2025假設寫一個叫做 test123<!-- -->.py 的腳本
May 2, 2025開啟 ~/bash.bashrc 檔,你可以使用 vi 或者 nano 來進行文字上的編輯,或者你也可以使用內建的文字編輯器,如下:
Feb 23, 2025or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up