-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathshodanish.py
78 lines (60 loc) · 2.49 KB
/
shodanish.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
# Shodan Favicon MurmurHash Converter
# pip install mmh3
import sys
import requests, mmh3
import argparse
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
if sys.version_info[0] < 3:
# Python 2
get_input = raw_input
def get_hash(content):
return mmh3.hash(content.encode('base64'))
else:
# Python 3
import codecs
get_input = input
def get_hash(content):
return mmh3.hash(codecs.encode(content, 'base64'))
def print_banner():
banner = """
__ _ _ _____ _
/ _\ |__ ___ __| | __ _ _ __ \_ \___| |__
\ \| '_ \ / _ \ / _` |/ _` | '_ \ / /\/ __| '_ \
_\ \ | | | (_) | (_| | (_| | | | /\/ /_ \__ \ | | |
\__/_| |_|\___/ \__,_|\__,_|_| |_\____/ |___/_| |_|
"""
print(banner)
print("\t\tShodan Favicon MurmurHash Converter")
print("\t\tCoded with <3 By Aziz Hakim @eternyle\n")
def get_target(unprocessed_target):
if unprocessed_target.startswith('http'):
if unprocessed_target.endswith('favicon.ico'):
# Input https://github.com/favicon.ico -> https://github.com/favicon.ico
return unprocessed_target
else:
if unprocessed_target.endswith('/'):
# Input https://github.com/ -> https://github.com/favicon.ico
return '%sfavicon.ico' % unprocessed_target
else:
# Input https://github.com -> https://github.com/favicon.ico
return '%s/favicon.ico' % unprocessed_target
else:
return 'http://%s/favicon.ico' % unprocessed_target
def run(arguments):
if arguments.url is None or arguments.url.strip() == '':
target = get_target(get_input("Enter Domain/URL : "))
else:
target = get_target(arguments.url)
var = requests.get(target, verify=False)
shodan_img_hash = get_hash(var.content)
print("\nShodan Dork : http.favicon.hash:%s" % shodan_img_hash)
print("\nVisit this URL : https://www.shodan.io/search?query=http.favicon.hash:%s" % shodan_img_hash)
print("\n\t\t\tHave a nice day 1337")
if __name__ == '__main__':
print_banner()
parser = argparse.ArgumentParser()
parser.add_argument('--url', type=str, required=False, help='The url of the favicon to process')
args = parser.parse_args()
run(args)