Created
May 2, 2021 22:46
-
-
Save Zeyad-Azima/9fd9e70869c93baf1165664b7091edfa to your computer and use it in GitHub Desktop.
A simple shodan recon script for bug bounty
This file contains 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
#By: Zeyad Azima (https://github.com/Zeyad-Azima) | |
# install: | |
## pip3 install requests | |
## pip3 install shodan | |
# Run: python3 shodrecon.py target | |
import shodan, requests, json, threading, sys | |
# Your Api key here | |
API_KEY = "" | |
api = shodan.Shodan(API_KEY) | |
def shoder(target): | |
try: | |
results = api.search(target) | |
print('Results found: {}'.format(results['total'])) | |
print('') | |
for result in results['matches']: | |
r = requests.get('https://api.shodan.io/shodan/host/{0}?key={1}'.format(result['ip_str'],API_KEY)) | |
print('IP: {0}\nPort: {1}'.format(result['ip_str'],result['port'])) | |
ips = result['ip_str'] | |
print(result['data']) | |
d = json.loads(r.text) | |
try: | |
print('Hostname: {0}'.format(d['hostnames'])) | |
print('Open Ports: {0}'.format(d['ports'])) | |
print('Vulnerabilities:\n{0}'.format(d['vulns'])) | |
except Exception as e: | |
pass | |
print('') | |
print('------------------------------------------------------------------------------------------------------------') | |
except shodan.APIError as e: | |
print('Error: {}'.format(e)) | |
try: | |
thread = threading.Thread(target=shoder(sys.argv[1])) | |
thread.start() | |
thread.join() | |
except IndexError: | |
print('Please Set a Target ;( \nex: python3 Shodan.py google.com') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment