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):
response = requests.get(url, verify=False, allow_redirects=True, timeout=15)
return response
def 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>"