项目作者: gildasio

项目描述 :
h2t (HTTP Hardening Tool) scans a website and suggests security headers to apply
高级语言: Python
项目地址: git://github.com/gildasio/h2t.git
创建时间: 2019-03-07T23:10:46Z
项目社区:https://github.com/gildasio/h2t

开源协议:MIT License

下载


h2t - HTTP Hardening Tool

Description

h2t is a simple tool to help sysadmins to hardening their websites.

Until now h2t checks the website headers and recommends how to make it better.

Dependences

Install

  1. $ git clone https://github.com/gildasio/h2t
  2. $ cd h2t
  3. $ pip install -r requirements.txt
  4. $ ./h2t.py -h

… or the Docker way:

  1. $ git clone https://github.com/gildasio/h2t
  2. $ cd h2t
  3. $ docker build -t h2t .
  4. $ docker run --rm h2t -h

You also can put alias h2t='docker run --rm h2t' on a file (such as ~/.bash_aliases) and run as follows:

  1. $ h2t -h

Usage

h2t has subcommands: list and scan.

  1. $ ./h2t.py -h
  2. usage: h2t.py [-h] {list,l,scan,s} ...
  3. h2t - HTTP Hardening Tool
  4. positional arguments:
  5. {list,l,scan,s} sub-command help
  6. list (l) show a list of available headers in h2t catalog (that can
  7. be used in scan subcommand -H option)
  8. scan (s) scan url to hardening headers
  9. optional arguments:
  10. -h, --help show this help message and exit

List Subcommand

The list subcommand lists all headers cataloged in h2t and can show informations about it as a description, links for more information and for how to’s.

  1. $ ./h2t.py list -h
  2. usage: h2t.py list [-h] [-p PRINT [PRINT ...]] [-B]
  3. [-a | -H HEADERS [HEADERS ...]]
  4. optional arguments:
  5. -h, --help show this help message and exit
  6. -p PRINT [PRINT ...], --print PRINT [PRINT ...]
  7. a list of additional information about the headers to
  8. print. For now there are two options: description and
  9. refs (you can use either or both)
  10. -B, --no-banner don't print the h2t banner
  11. -a, --all list all available headers [default]
  12. -H HEADERS [HEADERS ...], --headers HEADERS [HEADERS ...]
  13. a list of headers to look for in the h2t catalog

Scan Subcommand

The scan subcommand perform a scan in a website looking for their headers.

  1. $ ./h2t.py scan -h
  2. usage: h2t.py scan [-h] [-v] [-a] [-g] [-b] [-H HEADERS [HEADERS ...]]
  3. [-p PRINT [PRINT ...]]
  4. [-i IGNORE_HEADERS [IGNORE_HEADERS ...]] [-B] [-E] [-n]
  5. [-u USER_AGENT] [-r | -s]
  6. url
  7. positional arguments:
  8. url url to look for
  9. optional arguments:
  10. -h, --help show this help message and exit
  11. -v, --verbose increase output verbosity: -v print response headers,
  12. -vv print response and request headers
  13. -a, --all scan all cataloged headers [default]
  14. -g, --good scan good headers only
  15. -b, --bad scan bad headers only
  16. -H HEADERS [HEADERS ...], --headers HEADERS [HEADERS ...]
  17. scan only these headers (see available in list sub-
  18. command)
  19. -p PRINT [PRINT ...], --print PRINT [PRINT ...]
  20. a list of additional information about the headers to
  21. print. For now there are two options: description and
  22. refs (you can use either or both)
  23. -i IGNORE_HEADERS [IGNORE_HEADERS ...], --ignore-headers IGNORE_HEADERS [IGNORE_HEADERS ...]
  24. a list of headers to ignore in the results
  25. -B, --no-banner don't print the h2t banner
  26. -E, --no-explanation don't print the h2t output explanation
  27. -o {normal,csv,json}, --output {normal,csv,json}
  28. choose which output format to use (available: normal,
  29. csv, json)
  30. -n, --no-redirect don't follow http redirects
  31. -u USER_AGENT, --user-agent USER_AGENT
  32. set user agent to scan request
  33. -k, --insecure don't verify SSL certificate as valid
  34. -r, --recommendation output only recommendations [default]
  35. -s, --status output actual status (eg: existent headers only)

Output

For now the output is only in normal mode. Understant it as follows:

  • [+] Red Headers are bad headers that open a breach on your website or maybe show a lots of information. We recommend fix it.
  • [+] Yellow Headers are good headers that is not applied on your website. We recommend apply them.
  • [-] Green Headers are good headers that is already used in your website. It’s shown when use -s flag.

Example:

h2t agains hack.me

  • Cookie HTTP Only would be good to be applied
  • Cookie over SSL/TLS would be good to be applied
  • Server header would be good to be removed
  • Referrer-Policy would be good to be applied
  • X-Frame-Options is already in use, nothing to do here
  • X-XSS-Protection is already in use, nothing to do here

Screenshots

List h2t catalog

h2t catalog

Scan from file

h2t against my website

Scan url

h2t against hackme

Scan verbose

h2t against my website in verbose mode

Headers information

h2t against my website and print headers information

Contribute

For contribute guidelines look at CONTRIBUTING