Forked from yehgdotnet/get-shodan-favicon-hash.py
Last active
December 7, 2021 15:49
-
-
Save Esonhugh/f5fe4b62be97da51a51b53c814026deb to your computer and use it in GitHub Desktop.
Get Shodan FAVICON Hash (Eson modified)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://twitter.com/brsn76945860/status/1171233054951501824 | |
# pip install mmh3 | |
# | |
# in python 3 | |
# Author: https://gist.github.com/yehgdotnet | |
# | |
# Author: Esonhugh (https://gist.github.com/Esonhugh) more automatic | |
# date: 2021/12/07 23:38 UTC+0800 | |
import mmh3 | |
import requests | |
import codecs | |
import sys | |
content = b"" | |
def figerprintize( content = content ): | |
base64ed_favicon = codecs.encode( content, "base64" ) | |
return mmh3.hash(base64ed_favicon) | |
def main(): | |
if len(sys.argv) != 3: | |
print("usage:",sys.argv[0],"[f(ile)/h(ttp)] param(filename or website)") | |
else: | |
if sys.argv[1] in ["f","file"] : | |
with open(sys.argv[2],"rb") as f: | |
content = f.read() | |
elif sys.argv[1] in ["h","http"] : | |
resp = requests.get(sys.argv[2] + "/favicon.ico") | |
content = resp.content | |
else: | |
print("wrong input") | |
print( "ICO hash:",figerprintize(content) ) | |
if __name__ == "__main__": | |
main() | |
# real works part at the frist version | |
# response = requests.get('https://cybersecurity.wtf/favicon.ico') | |
# favicon = codecs.encode(response.content,"base64") | |
# hash = mmh3.hash(favicon) | |
# print(hash) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use the script like
python3 script.py file xxx.ico
python3 script.py http http://example.com