Skip to content

Instantly share code, notes, and snippets.

@Shadow0ps
Created June 15, 2021 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shadow0ps/566ed35302e3254bacaddb5723f1f83b to your computer and use it in GitHub Desktop.
Save Shadow0ps/566ed35302e3254bacaddb5723f1f83b to your computer and use it in GitHub Desktop.
A silly little script I fixed up to generate a list of Shodan results with Minecraft Server Information.
#Use Shodan Search API Query product:minecraft to return a list of minecraft servers and their details
#Example Output:
#Players: 0 online - 250 maximum
#Version: Paper 1.16.5 (protocol 754)
#Description: Welcome to USC FOP 2021's Minecraft Server!
#51.79.242.64
#['ovh.ca']
#Minecraft Server
#Don't forget to add your own Shodan API Key below first
#Usage is python3 minecraftfinder.py product:minecraft
import shodan
import sys
# Configuration
API_KEY = "INSERT_YOUR_API_KEY_HERE"
# Input validation
if len(sys.argv) == 1:
print('Usage: %s <search query>') % sys.argv[0]
sys.exit(1)
try:
# Setup the api
api = shodan.Shodan(API_KEY)
# Perform the search
query = ' '.join(sys.argv[1:])
result = api.search(query)
# Loop through the matches and print each servers basic information
for service in result['matches']:
print(service['data'])
print(service['ip_str'])
print(service['domains'])
except Exception as e:
print ('Error: %s' % e)
sys.exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment