Created
June 15, 2021 21:11
-
-
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.
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
#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