-
Notifications
You must be signed in to change notification settings - Fork 0
/
silver.py
110 lines (82 loc) · 3.09 KB
/
silver.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#// SUPER SILVER SCANNER FOR Minecrap
#// Excludes version and players from output file.
from mcstatus import JavaServer
import os
import threading
import time
ports = (25565,8080)
masscan = []
print('Silverfork of deathsiefat scanner')
print('V2.1')
print('Beeep Booop! Beeep Booop?')
print(' /"-. ')
print(' / \--`. __..-,O ')
print(' : \ -- _..- . ')
print(' | . .- . . ')
print(' : . . . ')
print(' \ . / .. ')
print(' \ . . ')
print(' , . \ ')
print(' ,|, . -.\ ')
print(' .|| -. __..-" ')
print(' | | ')
print(' |__| ')
print(' /||\ ')
print(' //||\\ ')
print(' // || \\ ')
print(' __//__||__\\__ ')
print(' -------------- ')
time.sleep(1)
inputfile = input('Raw server ips file? (Including the .txt): ')
outputfile = input('File name to save output into? (Including the .txt): ')
publicserverlist = input('Public ips to exclude? (Including the .txt): ')
searchterm = input('Target game version? (null=all): ')
outfile = open(outputfile, 'a+')
outfile.close
fileHandler = open (inputfile, "r")
listOfLines = fileHandler.readlines()
fileHandler.close()
for line in listOfLines:
if line.strip()[0] != "#":
masscan.append(line.strip().split(' ',4)[3])
def split_array(L,n):
return [L[i::n] for i in range(n)]
threads = int(input('Threads to use (Recommended 20): '))
time.sleep(2)
if len(masscan) < int(threads):
threads = len(masscan)
split = list(split_array(masscan, threads))
exitFlag = 0
class myThread (threading.Thread):
def __init__(self, threadID, name):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
def run(self):
print ("Starting Thread " + self.name)
print_time(self.name)
print ("Exiting Thread " + self.name)
def print_time(threadName):
for z in split[int(threadName)]:
if exitFlag:
threadName.exit()
try:
ip = z
server = JavaServer(ip,-ports)
status = server.status()
except:
print("No Server Found:" + ip)
else:
print("Server:" + ip)
if searchterm in status.version.name:
with open(outputfile) as f:
if ip not in f.read():
with open(publicserverlist) as g:
if ip not in g.read():
text_file = open(outputfile, "a")
text_file.write(ip)
# + " " + status.version.name.replace(" ", "_") + " " + str(status.players.online)
text_file.write(os.linesep)
text_file.close()
for x in range(threads):
thread = myThread(x, str(x)).start()