sqlmap源碼解析(二)

sqlmap源碼解析(二)

init()

_basicOptionValidation

這里檢查了所有的參數(shù)的正確性并給出使用建議


-w856

_listTamperingFunctions

這里有一個(gè)可以列舉tamper 的方法=。=
以前居然不知道

-w848

-w651

可以找到用--list-tamper就可以打開
-w918

__priority__通過這個(gè)做標(biāo)識(shí)符來匹配下面的介紹

_setTamperingFunctions

加載插件

首先判斷文件存在不存在以及更改工作路徑等事情
然后用內(nèi)置函數(shù)import()將文件導(dǎo)入

-w540

在對(duì)插件的優(yōu)先級(jí)進(jìn)行判斷

_setTrafficOutputFP

沒想到sqlmap還可以將http記錄到文件中
只要-t參數(shù)就好了

_setHostname

從url中取出hostname

_doSearch

之前全是很簡(jiǎn)單的給請(qǐng)求頭賦值
這里看樣子有點(diǎn)意思了

    This function performs search dorking, parses results
    and saves the testable hosts into the knowledge base.

可以直接獲得google搜索的結(jié)果
可以這樣用
sqlmap -g "inurl:\".php?id=1\""
不過我的命令行好像連接不到google

_setBulkMultipleTargets()

sqlmap 的 -m參數(shù)
getFileItems
在這里讀取文件
將文件中的url一個(gè)一個(gè)讀取放到kb.target

_setSitemapTargets

sqlmap的-x的參數(shù)
通過parseSitemap來解析target
將url從Sitemap中提取出來

_setCrawler

--crawl:從起始位置爬站深度
如果沒有標(biāo)簽
訪問一個(gè)網(wǎng)站用
r'(?i)<a[^>]+href="(?P<href>[^>"]+)"'這個(gè)正則
將別的url提取出來

checkSameHost

sqlmap 在爬蟲的時(shí)候?qū)ο嗤瑄rl的處理

findPageForms

Parses given page content for possible forms (Note: still not implemented for Python3)

>> findPageForms('<html><form action="/input.php" method="POST"><input type="text" name="id" value="1"><input type="submit" value="Submit"></form></html>', '')
set([(u'/input.php', 'POST', u'id=1', None, None)])

從form中獲得所有的參數(shù)

使用了clientform的ParseResponse來解析


-w427

沒了解過這個(gè)第三方庫以后學(xué)習(xí)一下

loadBoundaries

-w203

接下來都是一些set來初始化的
-w689

這兩個(gè)差不多最后都用了parseXmlNode來解析了xml

parseXmlNode

    for element in node.getiterator("boundary"):
        boundary = AttribDict()

        for child in element.getchildren():
            if child.text:
                values = cleanupVals(child.text, child.tag)
                boundary[child.tag] = values
            else:
                boundary[child.tag] = None

        conf.boundaries.append(boundary)

    for element in node.getiterator("test"):
        test = AttribDict()

        for child in element.getchildren():
            if child.text and child.text.strip():
                values = cleanupVals(child.text, child.tag)
                test[child.tag] = values
            else:
                if len(child.getchildren()) == 0:
                    test[child.tag] = None
                    continue
                else:
                    test[child.tag] = AttribDict()

                for gchild in child.getchildren():
                    if gchild.tag in test[child.tag]:
                        prevtext = test[child.tag][gchild.tag]
                        test[child.tag][gchild.tag] = [prevtext, gchild.text]
                    else:
                        test[child.tag][gchild.tag] = gchild.text

        conf.tests.append(test)

差不多就是解析處理了之后放入到conf中

update

--update這個(gè)命令行可以更新
首先先檢查有沒有.git文件
然后會(huì)詢問要不要通過zip來下載安裝

一個(gè)通過https://github.com/sqlmapproject/sqlmap/zipball/master下來zip來更新

另一個(gè)這樣更新git checkout . && git pull %s HEAD

后記

終于看完了init要往下繼續(xù)看了=。=
是我看的太不認(rèn)真了

?著作權(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)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

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

  • sqlmap用戶手冊(cè) 說明:本文為轉(zhuǎn)載,對(duì)原文中一些明顯的拼寫錯(cuò)誤進(jìn)行修正,并標(biāo)注對(duì)自己有用的信息。 ======...
    wind_飄閱讀 2,206評(píng)論 0 5
  • http://192.168.136.131/sqlmap/mysql/get_int.php?id=1 當(dāng)給sq...
    xuningbo閱讀 10,560評(píng)論 2 22
  • sqlmap是一個(gè)開源的滲透測(cè)試工具,可以用來進(jìn)行自動(dòng)化檢測(cè),利用SQL注入漏洞,獲取數(shù)據(jù)庫服務(wù)器的權(quán)限。它具有功...
    道書簡(jiǎn)閱讀 1,568評(píng)論 0 0
  • sqlmap也是滲透中常用的一個(gè)注入工具,其實(shí)在注入工具方面,一個(gè)sqlmap就足夠用了,只要你用的熟,秒殺各種工...
    linkally閱讀 7,199評(píng)論 1 40
  • linux基礎(chǔ)命令findfind / -name targetfilename 查找文件按時(shí)間查找也有參數(shù) -a...
    AQ王浩閱讀 1,568評(píng)論 0 5

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