franccesco/getaltname: Get Subject Alt Name from SSL Certificates
2018-03-26 22:36:36 Author: github.com(查看原文) 阅读量:150 收藏

Python Version Build Status Coverage Status GitHub license

GetAltName (or GAN) is a tool that can extract Subject Alternative Names found in SSL Certificates directly from HTTPS web sites which can provide you with DNS names (subdomains) or virtual servers.

This code extract subdomain names from https sites and return a list or json output of its findings. It is not a subdomain brute-force tool, and you can actually find those subdomains manually, this tools is about the automation of that process, it also offers the following features:

  • Input a host or Nmap XML file to scan and return subdomains.
  • List or JSON output, useful if you want to export data into other tools.
  • You can optionally filter out domain names that doesn't match the domain name that you're analyzing.
  • Copy to your clipboard the domain names as a list or string if you don't want to deal with files, this is also useful for tools that doesn't accept file input.

You can read more about how this tool works from my post in getroot.info (in Spanish).

usage: getaltname.py [-h] [-p PORT] [-s [timeout]] [-m] [-o OUTPUT]
                     [-f {json,text}] [-c {l,s}] [-d] [-V]
                     hostname

positional arguments:
  hostname                              Host or Nmap XML to analyze.

optional arguments:
  -h, --help                            show this help message and exit
  -p PORT, --port PORT                  Destiny port (default 443)
  -s [timeout], --search-crt [timeout]  Retrieve subdomains found in crt.sh
  -m, --match-domain                    Show match domain name only
  -o OUTPUT, --output OUTPUT            Set output filename
  -f {json,text}, --format {json,text}  Set output format
  -c {l,s}, --clipboard {l,s}           Copy the output to the clipboard as a
                                        List or a Single string
  -d, --debug                           Set debug enable
  -V, --version                         Print version information.

In this case the tool give you sub-domains that you probably didn't find with a sub-domain brute force tool.

Example Image

asciicast

Required libraries:

  • colorama
  • ndg-httpsclient
  • pyperclip
  • requests
  • tldextract
  • termcolor
  • tqdm

Installation with pipenv:

$ git clone https://github.com/franccesco/getaltname.git
$ pipenv install

Installation with Pip:

$ git clone https://github.com/franccesco/getaltname.git
$ pip install -r requirements.txt

For the copy&paste mechanism you will have to install xclip package. Debian/Ubuntu/Mint:

  • File output
  • Output to clipboard
  • Clean sub-domains wildcards
  • Remove duplicates
  • A filter system for main domain and TLD's.
  • Add colors (so l33t. /s)
  • Get additional sub-domains from crt.sh
  • Read Nmap XML and analyze them
  • JSON Output
  • Unit Tests
  • Coverage Reports
  • Multithreading

Contribution is welcome, just remember:

  • Fork the repo.
  • Make changes to the develop branch.
  • Make a Pull Request.

If you like the project and would like to support me you can buy me a cup of coffee, you will also be inmortalized as a patreon, thank you 🙏

Buy Me A Coffee Buy Me a Coffee at ko-fi.com

文章来源: https://github.com/franccesco/getaltname
如有侵权请联系:admin#unsafe.sh