-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
94 lines (70 loc) · 2.46 KB
/
main.py
File metadata and controls
94 lines (70 loc) · 2.46 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import random, dhooks, json, threading
from os import system
from dhooks import Embed
from mcstatus import JavaServer
from colorama import Fore
system("title "+"WMS Server Scanner")
with open("config.json", "r") as jsonfile:
config = json.load(jsonfile)
shouldSendWebhook = config["enable_webhook"]
webhookUrl = config["webhook_url"]
verbose = config["verbose"]
def magenta(string):
print(Fore.MAGENTA + string + Fore.RESET)
magenta("-" * 75)
magenta("-- Christopher Columbus Scanner by WMS https://wmsgaming.github.io/WMS/ --")
magenta("-" * 75)
magenta(f"-Loaded Settings... ")
magenta(f"-Send to webhook: {shouldSendWebhook}")
magenta(f"-Verbose: {verbose}")
magenta("-" * 75)
threads = int(input("How many threads would you like to use? "))
magenta("-" * 75)
magenta(f"Scanning in Progress... Please be patient.")
magenta("-" * 75)
checkIPS = []
def checkStatus(ip):
if verbose:
print(f"{Fore.WHITE}[{Fore.BLUE}...{Fore.WHITE}]{Fore.MAGENTA} Checking {ip}")
try:
status = JavaServer.lookup(ip)
s = status.status()
logIP(ip, s.version.name)
except:
print(f"{Fore.WHITE}[{Fore.RED}-{Fore.WHITE}]{Fore.MAGENTA} {ip} is invalid. {Fore.RESET}")
pass
def randIP():
ip = f"{random.randint(0, 255)}.{random.randint(0, 255)}.{random.randint(0, 255)}.{random.randint(0, 255)}"
while ip not in checkIPS:
checkIPS.append(ip)
return ip
def writeFile(s):
with open("Server.txt", "a") as f:
f.write(f"{s}\n")
def logIP(ip, version):
print(f"{Fore.WHITE}[{Fore.GREEN}+{Fore.WHITE}]{Fore.MAGENTA} {ip} is a minecraft server, Version: {version} {Fore.RESET}")
writeFile(f"IP: {ip} Version: {version}")
if shouldSendWebhook == "on":
sendWebhook(ip, version)
def sendWebhook(ip, version):
try:
hook = dhooks.Webhook(webhookUrl)
embed = Embed(
description="Found a server!",
color=0xFF0000,
timestamp='now'
)
embed.set_author("Christopher Columbus Scanner")
embed.add_field(name="IP: ", value=str(ip))
embed.add_field(name="Version: ", value=str(version))
hook.send(embed=embed)
except Exception as error:
print(error, " (Make sure that a webhook is in config.json!)")
def startSearch():
while True:
checkStatus(randIP())
def startThreads():
for i in range(threads):
t = threading.Thread(target=startSearch)
t.start()
startThreads()