Run SSL cert scan with nmap --script ssl-cert 192.168.1.1
In this step, we will use Nmap to perform an SSL certificate scan on a specified IP address. Nmap is a powerful network scanning tool, and its scripting engine allows us to extend its functionality. The ssl-cert
script is designed to retrieve and display information about SSL/TLS certificates from a target server.
First, let's understand the basic command structure:
nmap --script ssl-cert <target_ip>
Here, <target_ip>
is the IP address of the server you want to scan. In this case, we'll be scanning the IP address 192.168.1.1
.
Now, open your Xfce terminal. Ensure you are in the ~/project
directory. If not, navigate to it using the cd
command:
cd ~/project
Next, execute the following command to run the SSL certificate scan:
sudo nmap --script ssl-cert 192.168.1.1
You might be prompted for your password. Since the labex
user has sudo
privileges without a password, just press Enter.
Note: 192.168.1.1
is a private IP address and may not be accessible from your current network configuration. If you don't have a server at that address, the scan might not return any results or might time out. For testing purposes, you can use a public IP address that you know has an SSL certificate, such as scanme.nmap.org
, or 8.8.8.8
.
Let's try scanning scanme.nmap.org
instead:
sudo nmap --script ssl-cert scanme.nmap.org
This command will attempt to connect to scanme.nmap.org
and retrieve its SSL certificate information. The output will display details such as the certificate's subject, issuer, validity period, and any Subject Alternative Names (SANs).
Example output (the actual output will vary):
Starting Nmap 7.80 ( https://nmap.org ) at 2023-10-27 10:00 UTC
Nmap scan report for scanme.nmap.org (45.33.32.156)
Host is up (0.031s latency).
Other addresses for scanme.nmap.org (not scanned): 2600:3c01::f03c:91ff:fe18:bb2f
PORT STATE SERVICE
22/tcp open ssh
| ssl-cert: Subject: commonName=scanme.nmap.org
| Issuer: commonName=Let's Encrypt Authority X3
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2020-03-18T14:23:03+00:00
| Not valid after: 2020-06-16T14:23:03+00:00
| MD5: ...
| SHA1: ...
| -----BEGIN CERTIFICATE-----
| ...
| -----END CERTIFICATE-----
Nmap done: 1 IP address (1 host up) scanned in 2.18 seconds
This output shows the SSL certificate details for scanme.nmap.org
, including the subject, issuer, and validity dates.