Skip to content

Instantly share code, notes, and snippets.

@averagesecurityguy
Created November 2, 2015 17:44
Show Gist options
  • Save averagesecurityguy/c4060c4763abee94b1b2 to your computer and use it in GitHub Desktop.
Save averagesecurityguy/c4060c4763abee94b1b2 to your computer and use it in GitHub Desktop.
Calculate Hashes for HTML Structure
#!/usr/env/bin python3
import requests
import re
import hashlib
import sys
tag_re = re.compile(r'<.*?>')
if len(sys.argv) != 2:
print('USAGE: html_structure_hash.py url')
sys.exit()
resp = requests.get(sys.argv[1])
tags = tag_re.findall(resp.content)
html = ''.join(tags)
print('MD5: {0}'.format(hashlib.md5(html).hexdigest()))
print('SHA1: {0}'.format(hashlib.sha1(html).hexdigest()))
print('SHA256: {0}'.format(hashlib.sha256(html).hexdigest()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment