Back

Set up a multi-threaded SSL vulnerability audit scanner using the QUALYS API on CentOS 7

Image Slider

March 29, 2019

By J. Fau – Cybersecurity Expert at SQUAD

Description: Thegoal is to set up a server that can evaluate the proper implementation of SSL certificates on servers accessible from the internet.

The advantage of this script is that it allows you to provide an input file containing all the URLs to be scanned. All URLs will be subjected to QUALYS API security tests. Once the scan is complete, you will receive an easy-to-read CSV file that can be reused to manipulate the data in a spreadsheet.

This tutorial was created using the following version: CentOS Linux release 7.6.1810 (Core)

Prerequisites:

  • CentOS 7 minimal installation server
  • Internet connection from the server
  • Have privileged "root" or "sudo" access on the server
  • Have a user account on the server

Source:

Original script not functional asis
https://github.com/moheshmohan/pyssltest/blob/master/pyssltest.py
Do not use the link above in the context of this tutorial.

/!\ Commitment and responsibility /!\

You are solely responsible for the use of this script and the consequences and actions you may initiate as a result of using this solution. Even though the script does not perform any intrusive or destructive actions on the targets, under no circumstances can the author of the script, the author of this tutorial, or SQUAD be held responsible for any direct or indirect damage resulting from the use of this tutorial.

CentOS server configuration

Actions to be performed with "root" privileges or equivalent

Server update

yum -y update

Configuring the EPEL (Extra Packages for Enterprise Linux) third-party repository

yum -y install epel-release

Installing the "python-pip" package

yum -y install python-pip

Installation of the "unirest" module for "PIP"

pip install unirest

PIP update

pip install --upgrade pip

Check the version of "PIP"

pip --version

pip 19.0.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)

Check the version of "Python"

python -V

Python 2.7.5

Installing the "wget" package

yum -y install wget

The server configuration is complete.

Workspace configuration

Actions to be performed with a user account

Log in to the server with your user account.

Create a working directory

mkdir scanssl

Place yourself in the working directory

CD scanssl

Retrieve the script

wget "https://tinyurl.com/scanssl"

Add the Python extension to the script

mv scanssl scanssl.py

Add execution rights to the file

chmod +x scanssl.py

Create the file containing the URLs to be scanned

touch inputurl.txt

Enter the target URLs

vi inputurl.txt

Press the "Insert" or "Ins" key to switch to file edit mode. You must enter only one URL per line. You can enter as many URLs as you want.

Press the"Esc" key to exit edit mode, then press ":" followed by "wq!" and press the "Enter" key to exit and save.

Run the script

./scanssl.py -i inputurl.txt -o outputurl-01-31-2019.csv -n

Don't forget the "-n" so that the result is not published on the QUALYS website.

Press the " Enter " key

There are 1002 URLs read from the file.

The number of URLs identified is 1002.

The number of domains is 1002.

Press Enter to continue...

Press the "Enter" key to start scanning.

There are 902 pending

There are 0 Invalid

There are 0 errors

There are 0 ready

There are 101 threads

When the scans are complete, you will find the following items in the working directory:

A "results" directory that contains a text file for each URL, grouping together all the results for each test performed.

You will also find the overall results file in CSV format in our case "outputurl-31-01-2019.csv."

After a little formatting using filters, you can obtain the following result:

To retrieve files locally on your workstation, you can use WinSCP if you are using Windows, or use the SCP if you are using Linux.
 

If the result of a URL particularly catches your attention and you want more details, I recommend performing an additional scan at the following address: https://www.ssllabs.com/ssltest/index.html https://www.ssllabs.com/ssltest/index.html

Thank you for reading 😊

Happy scanning, everyone!