Skip to content

Commit

Permalink
Add IP Address
Browse files Browse the repository at this point in the history
  • Loading branch information
narbehaj committed Nov 5, 2023
1 parent 7de0a31 commit 0c0820e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ssl_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ def get_cert(self, host, port, socks_host=None, socks_port=None):
oscon.set_connect_state()
oscon.do_handshake()
cert = oscon.get_peer_certificate()
resolved_ip = socket.gethostbyname(host)
sock.close()

return cert
return cert, resolved_ip

def border_msg(self, message):
"""Print the message in the box."""
Expand Down Expand Up @@ -178,6 +179,7 @@ def print_status(self, host, context, analyze=False):
print('\t\tIssued domain: {}'.format(context[host]['issued_to']))
print('\t\tIssued to: {}'.format(context[host]['issued_o']))
print('\t\tIssued by: {} ({})'.format(context[host]['issuer_o'], context[host]['issuer_c']))
print('\t\tServer IP: {}'.format(context[host]['resolved_ip']))
print('\t\tValid from: {}'.format(context[host]['valid_from']))
print('\t\tValid to: {} ({} days left)'.format(context[host]['valid_till'], context[host]['valid_days_to_expire']))
print('\t\tValidity days: {}'.format(context[host]['validity_days']))
Expand Down Expand Up @@ -233,12 +235,13 @@ def show_result(self, user_args):
print('{}Socks proxy enabled, connecting via proxy{}\n'.format(Clr.YELLOW, Clr.RST))

socks_host, socks_port = self.filter_hostname(user_args.socks)
cert = self.get_cert(host, port, socks_host, socks_port)
cert, resolved_ip = self.get_cert(host, port, socks_host, socks_port)
else:
cert = self.get_cert(host, port)
cert, resolved_ip = self.get_cert(host, port)

context[host] = self.get_cert_info(host, cert)
context[host]['tcp_port'] = int(port)
context[host]['resolved_ip'] = resolved_ip

# Analyze the certificate if enabled
if user_args.analyze:
Expand Down

0 comments on commit 0c0820e

Please sign in to comment.