Favicon hashing and hunting with Shodan

Use the following python script/s to pull a website's favourite icon and hash it using MurmurHash3.

Shodan uses mmh3 to hash favicons and these are indexed during their periodic crawls.

-----------------------------
# python 2
import mmh3
import requests
 
response = requests.get('https://domain.com/favicon.ico')
favicon = response.content.encode('base64')
hash = mmh3.hash(favicon)
print hash

-----------------------------

# python 3

import mmh3
import requests
import codecs
 
response = requests.get('https://domain.com/favicon.ico')
favicon = codecs.encode(response.content,"base64")
hash = mmh3.hash(favicon)
print(hash)

Shodan search query;

http.favicon.hash:{hash}

Last updated