Favicon Hashes Creation And Usage
favicon
mmh3 library
Python
Shodan
ZoomEye
website search
content hashing
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:
import requests
import mmh3
import codecs
def perform_get_request_with_insecure_and_redirects(url: str):
= requests.get(url, verify=False, allow_redirects=True, timeout=15)
response return response
def get_favicon_url(url: str):
return f"{url}/favicon.ico"
def process_url_and_get_favicon_hash(url: str):
= get_favicon_url(url)
favicon_url
response perform_get_request_with_insecure_and_redirects(favicon_url)= codecs.encode(response.content, "base64")
favicon = mmh3.hash(favicon)
_hash = str(_hash)
_hash return _hash
if __name__ == "__main__":
= "https://www.baidu.com"
url = process_url_and_get_favicon_hash(url)
icon_hash 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>"