Last active
January 3, 2024 04:22
-
-
Save faisalfs10x/8f36f8f89a41bd2d464ccf46a542056c to your computer and use it in GitHub Desktop.
Process a favicon.ico and calculate its hash based on https://twitter.com/brsn76945860/status/1171233054951501824
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import mmh3 | |
import requests | |
import argparse | |
import codecs | |
requests.packages.urllib3.disable_warnings() | |
parser = argparse.ArgumentParser(description='Process a favicon.ico and calculate its hash') | |
parser.add_argument('url', help='The URL path to favicon.ico') | |
args = parser.parse_args() | |
response = requests.get(args.url, verify=False, timeout=5) | |
favicon = codecs.encode(response.content, "base64") | |
hash = mmh3.hash(favicon) | |
print(hash) | |
# python3 favicon-hash.py http://site.com/img/favicon.ico |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment