summaryrefslogtreecommitdiffstats
path: root/shodan/icon.py
blob: 040702b06341c373ed177ea1ec1f6108797c7de9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" mmh3 favicon hash """

import codecs
import requests
import mmh3

print('Please enter the favicon site to hash (e.g. www.google.com): ')
fav = input()
URL = "https://"+f"{fav}"+"/favicon.ico"
print('The hash for ' + str(URL) + ' is: ')
response = requests.get(URL, data=None, headers={'User-Agent': 'Mozilla/5.0 (X11; Linux; rv:113.0) Gecko/20100101 Firefox/113.0'}, timeout=10)
favicon = codecs.encode(response.content,"base64")
favhash = mmh3.hash(favicon)
print(favhash)