From df171e0e3a5508cd92e2aba404b598a8445cf3b1 Mon Sep 17 00:00:00 2001 From: Timo Trinks Date: Thu, 1 Jun 2023 15:27:42 +1000 Subject: - more sophisticated icon.py Signed-off-by: Timo Trinks --- shodan/icon.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/shodan/icon.py b/shodan/icon.py index 0bebab6..040702b 100644 --- a/shodan/icon.py +++ b/shodan/icon.py @@ -1,12 +1,16 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ mmh3 favicon hash """ - -import mmh3 -import requests + import codecs - -response = requests.get('https://domain.com/favicon.ico') +import requests +import mmh3 + +print('Please enter the favicon site to hash (e.g. www.google.com): ') +fav = input() +URL = "https://"+f"{fav}"+"/favicon.ico" +print('The hash for ' + str(URL) + ' is: ') +response = requests.get(URL, data=None, headers={'User-Agent': 'Mozilla/5.0 (X11; Linux; rv:113.0) Gecko/20100101 Firefox/113.0'}, timeout=10) favicon = codecs.encode(response.content,"base64") -hash = mmh3.hash(favicon) -print(hash) +favhash = mmh3.hash(favicon) +print(favhash) -- cgit