This article explains the process of creating a favicon hash using the mmh3 library in Python. It involves making a GET request and hashing the content, which can be utilized with Shodan or ZoomEye to search for websites that have the same favicon.
To create favicon hash, run:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import requestsimport mmh3import codecsdef perform_get_request_with_insecure_and_redirects (url: str ):response = requests.get(url, verify=False , allow_redirects=True , timeout=15 ) return responsedef get_favicon_url (url: str ):return f"{url} /favicon.ico" def process_url_and_get_favicon_hash (url: str ):favicon_url = get_favicon_url(url) response perform_get_request_with_insecure_and_redirects(favicon_url) favicon = codecs.encode(response.content, "base64" ) _hash = mmh3.hash (favicon) _hash = str (_hash ) return _hash if __name__ == "__main__" :url = "https://www.baidu.com" icon_hash = process_url_and_get_favicon_hash(url) print (f"icon hash for url '{url} ':" , icon_hash)
You can use favicon hash in Shodan like: http.favicon.hash:<favicon_hash>
In ZoomEye like: iconhash:"<favicon_hash>"