SQLMAPサポート自動擬似静的バッチテスト

0x00の序文


まだSQLインジェクションポイント(プロキシ+バッチSQLインジェクション検出sqlmapapiウェイバッチテストなど)をテストバッチのより適切なツールを見つけることなので、私の目はSQLMAPになりました。SQLMAPない支持擬似静的テスト注入点(手動注入マークを追加する必要がある)が、それはPythonで書かれているので、それは二次開発のための迅速かつ容易にすることができます。

0x01のアイデア


私の考えは.htmlのようなURLの.htmlサフィックス変更またはどちらか含まれている「?」することです。

擬似静的注入点は、一般的に数字で、私は番号の後に注入されたマークを追加します。従事し、ワークロードの多くに従事する擬似静的な文字列が追加されます。

以下のURLでテスト

#!bash
http://www.site.com/index.php/index/id/14
http://www.site.com/index.php/newsContent/id/341.html
http://www.site.com/show/?29-575.html

結果は以下の通りであります

#!bash
http://www.site.com/index.php/index/id/14*
http://www.site.com/index.php/newsContent/id/341*.html
http://www.site.com/show/?29*-575*.html

コードは以下の通りであります:

#!python
if re.search('html|htm|sthml',url) or url.find("?") == -1:
    flag = 0
    suffix = ""
    if re.search('html|htm|sthml',url):
        suffix = "." + re.search('html|htm|sthml',url).group()
    urlList = url.split("/")

    returnList = []

    for i in urlList:
        i = re.sub('\.html|\.htm','', i)
        if i.isdigit():
            returnList.append(i + "*")
            flag = 1
        else:
            returnList.append(i)
    url = '/'.join(returnList) + suffix

    returnList = []
    if flag == 0:
        for i in urlList:
            if re.search('html|htm|sthml',i):
                digitList = re.findall('\d+',i)
                for digit in digitList:
                    i = i.replace(digit, digit + "*")
                returnList.append(i)
            else:
                returnList.append(i)
        url = '/'.join(returnList)    
    print url

単一の擬似静的の0x02のSQLMAPサポート自動検出


関連ドキュメント

プロセス

Sqlmap.py 116行開始() - > controller.py 256行setupTargetEnv() - > target.py 72行_setRequestParams() - > target.py 117行

#!python
if kb.processUserMarks is None and CUSTOM_INJECTION_MARK_CHAR in conf.data:
message = "custom injection marking character ('%s') found in option " % CUSTOM_INJECTION_MARK_CHAR
message += "'--data'. Do you want to process it? [Y/n/q] "
test = readInput(message, default="Y")
if test and test[0] in ("q", "Q"):
raise SqlmapUserQuitException
else:
kb.processUserMarks = not test or test[0] not in ("n", "N")

if kb.processUserMarks:
kb.testOnlyCustom = True

ここでは、射出マークするかどうかを検出します。

あなたが指定したSQLMAP取得するすべての情報が完了した後、正式に注入し、検出射出マーク「かどうかがあるかどうかを検出開始する前に、*」、もしあれば、このプロセスの最初のポイントにテスト用のラベルに注入されます。

長い_setRequestParams関数呼び出しのURLの前に契約として、あなたは擬似静的テストの自動注入をサポートすることができますので、この注入は、プロセス印を理解しています。

添加ライン260限り

#!python
if re.search('html|htm|sthml',conf.url) or conf.url.find("?") == -1:
    flag = 0
    suffix = ""
    if re.search('html|htm|sthml',conf.url):
        suffix = "." + re.search('html|htm|sthml',conf.url).group()
    urlList = conf.url.split("/")

    returnList = []

    for i in urlList:
        i = re.sub('\.html|\.htm','', i)
        if i.isdigit():
            returnList.append(i + "*")
            flag = 1
        else:
            returnList.append(i)
    conf.url = '/'.join(returnList) + suffix

    returnList = []
    if flag == 0:
        for i in urlList:
            if re.search('html|htm|sthml',i):
                digitList = re.findall('\d+',i)
                for digit in digitList:
                    i = i.replace(digit, digit + "*")
                returnList.append(i)
            else:
                returnList.append(i)
        conf.url = '/'.join(returnList)
    logger.info(conf.url)

それだけです。

レンダリング

PIC1

ここでは注入点をサポートするためにテストするだけで、単一のバッチです。ここでの変更は十分ではありません。

0x03のSQLMAP支持バッチ自動的擬似静的検出


関連文書
https://github.com/sqlmapproject/sqlmap/blob/master/lib/core/option.py

583行で

#!python
for line in getFileItems(conf.bulkFile):
    if re.match(r"[^ ]+\?(.+)", line, re.I) or CUSTOM_INJECTION_MARK_CHAR in line:
        found = True
        kb.targets.add((line.strip(), conf.method, conf.data, conf.cookie, None))

URL内の行毎にファイルを読み込みます。限りがあり、「?」と一致するようにクエスチョンマークであるかテストする前に「*」マーク注射してきたように。

583を追加

#!python
    if re.search('html|htm|sthml',line) or line.find("?") == -1:
        flag = 0
        suffix = ""
        if re.search('html|htm|sthml',line):
            suffix = "." + re.search('html|htm|sthml',line).group()
        urlList = line.split("/")

        returnList = []

        for i in urlList:
            i = re.sub('\.html|\.htm','', i)
            if i.isdigit():
                returnList.append(i + "*")
                flag = 1
            else:
                returnList.append(i)
        line = '/'.join(returnList) + suffix

        returnList = []
        if flag == 0:
            for i in urlList:
                if re.search('html|htm|sthml',i):
                    digitList = re.findall('\d+',i)
                    for digit in digitList:
                        i = i.replace(digit, digit + "*")
                    returnList.append(i)
                else:
                    returnList.append(i)
            line = '/'.join(returnList)

レンダリング:

PIC2

おすすめ

転載: www.cnblogs.com/-hack-/p/12052397.html