-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFivemServerInfo.py
247 lines (223 loc) · 11.4 KB
/
FivemServerInfo.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# -*- coding: utf-8 -*-
#Made with love by Mat
### IMPORT ###
import os
import os, sys, time, os.path, ctypes, getpass
from pystyle import Center, Anime, Colors, Colorate, System
from colorama import Fore
from requests import get
#0.0.2
import requests
### COLORI E VAR ###
VERSIONETOOL = "0.0.3"
c = Fore.LIGHTCYAN_EX
g = Fore.LIGHTGREEN_EX
y = Fore.LIGHTYELLOW_EX
b = Fore.LIGHTBLUE_EX
w = Fore.LIGHTWHITE_EX
m = Fore.LIGHTMAGENTA_EX
### SCHERMATA ###
def impostatitolo(_str):
system = os.name
if system == 'nt':
ctypes.windll.kernel32.SetConsoleTitleW(f"{_str} | github.com/itsmat")
elif system == 'posix':
sys.stdout.write(f"\x1b]0;{_str} | github.com/itsmat\x07")
else:
pass
def clear():
system = os.name
if system == 'nt':
os.system('cls')
elif system == 'posix':
os.system('clear')
else:
print('\n'*120)
return
def titolohome():
print(f"""\n\n
$$\ $$\ $$\ $$$$$$\ $$$$$$\ $$$$$$\
$$$\ $$$ | $$ | $$ __$$\ \_$$ _| $$ __$$\
$$$$\ $$$$ | $$$$$$\ $$$$$$\ $$ / \__| $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\ $$$$$$\ $$ | $$$$$$$\ $$ / \__|$$$$$$\
$$\$$\$$ $$ | \____$$\\_$$ _| \$$$$$$\ $$ __$$\ $$ __$$ \$$\ $$ |$$ __$$\ $$ __$$\ $$ | $$ __$$\ $$$$\ $$ __$$\
$$ \$$$ $$ | $$$$$$$ | $$ | \____$$\ $$$$$$$$ |$$ | \__|\$$\$$ / $$$$$$$$ |$$ | \__| $$ | $$ | $$ |$$ _| $$ / $$ |
$$ |\$ /$$ |$$ __$$ | $$ |$$\ $$\ $$ |$$ ____|$$ | \$$$ / $$ ____|$$ | $$ | $$ | $$ |$$ | $$ | $$ |
$$ | \_/ $$ |\$$$$$$$ | \$$$$ | \$$$$$$ |\$$$$$$$\ $$ | \$ / \$$$$$$$\ $$ | $$$$$$\ $$ | $$ |$$ | \$$$$$$ |
\__| \__| \_______| \____/ \______/ \_______|\__| \_/ \_______|\__| \______|\__| \__|\__| \______/
\n""".replace('█', f'{g}█{y}'))
banner = r"""
░█████╗░░█████╗░██████╗░██╗░█████╗░░█████╗░███╗░░░███╗███████╗███╗░░██╗████████╗░█████╗░
██╔══██╗██╔══██╗██╔══██╗██║██╔══██╗██╔══██╗████╗░████║██╔════╝████╗░██║╚══██╔══╝██╔══██╗
██║░░╚═╝███████║██████╔╝██║██║░░╚═╝███████║██╔████╔██║█████╗░░██╔██╗██║░░░██║░░░██║░░██║
██║░░██╗██╔══██║██╔══██╗██║██║░░██╗██╔══██║██║╚██╔╝██║██╔══╝░░██║╚████║░░░██║░░░██║░░██║
╚█████╔╝██║░░██║██║░░██║██║╚█████╔╝██║░░██║██║░╚═╝░██║███████╗██║░╚███║░░░██║░░░╚█████╔╝
░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░╚════╝░╚═╝░░╚═╝╚═╝░░░░░╚═╝╚══════╝╚═╝░░╚══╝░░░╚═╝░░░░╚════╝░
"""[1:]
def transizione():
clear()
caricamento()
clear()
def caricamento():
carattere = ['|', '/', '-', '\\']
for i in carattere+carattere+carattere:
sys.stdout.write(f"""\r{y}[{b}#{y}]{w} Caricamento... {i}""")
sys.stdout.flush()
time.sleep(0.2)
#0.0.2
global server
class cercamelo:
def link():
global server
headers = {
"accept": "application/json, text/plain, */*",
"accept-language": "fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7",
"sec-ch-ua": '"Chromium";v="96", "Opera GX";v="82", ";Not A Brand";v="99"',
"origin": "https://servers.fivem.net",
"referer": "https://servers.fivem.net/",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36 OPR/82.0.4227.25"
}
data = requests.get(f"https://servers-frontend.fivem.net/api/servers/single/{server['id']}", headers=headers)
return {
"ip": data.json()["Data"]["connectEndPoints"][0],
"hostname": data.json()["Data"]["hostname"]
}
pass
#0.0.1
global ipserver
ipserver = 'Nessun server impostato'
global portaserver
portaserver = '30120'
def main():
global ipserver
global portaserver
impostatitolo(f"Mat Server Info Tool {VERSIONETOOL} - Caricamento")
#System.Size(160, 40) #120, 30
Anime.Fade(Center.Center(banner), Colors.green_to_red, Colorate.Vertical, time=1)
clear()
impostatitolo(f"Mat Server Info Tool {VERSIONETOOL}")
titolohome()
print(f""" {y}[{b}+{y}]{g} Main: {y}[{b}+{y}]{c} Settings:
{y}[{w}1{y}]{g} Info server {y}[{w}10{y}]{c} Imposta porta server (default 30120)
{y}[{w}2{y}]{g} Lista players {y}[{w}11{y}]{c} Imposta ip server
{y}[{w}3{y}]{g} Lista players con identifiers
{y}[{w}4{y}]{g} Ottieni ip da link (cfx.re/join/*)
{y}[{w}5{y}]{g} Lista risorse
{m}Made by Mat#3616 | github.com/itsmat
{m}IP Server : {b}{ipserver}
{m}Porta : {b}{portaserver}
\t\t\t\t\t\t\t\t\t\t\t\t\t""")
global scelta
scelta = input(f"""{y}[{b}#{y}]{w} : """)
if scelta == '1' or scelta == '01':
if ipserver != 'Nessun server impostato':
try:
dynamic = get(f'http://{ipserver}:{portaserver}/dynamic.json', timeout=5)
print('Attendi...')
getdynamic = dynamic.json()
hostname = getdynamic["hostname"]
online = str(getdynamic["clients"])
massimi = str(getdynamic["sv_maxclients"])
iv = str(getdynamic["iv"])
gametype = str(getdynamic["gametype"])
mapname = str(getdynamic["mapname"])
print(f'''
{y}Info ricavate:{m} github.com/itsmat {w}
HostName: {hostname}
Players: {online}/{massimi}
IV: {iv}
GameType: {gametype}
MapName: {mapname}''')
input(f"{y}[{b}#{y}]{w} Premi invio per tornare alla home")
main()
except Exception as errore:
input(f"{y}[{Fore.LIGHTRED_EX }!{y}]{w} Errore [{errore}]!")
main()
else:
input(f"{y}[{Fore.LIGHTRED_EX }!{y}]{w} IP Server mancante [tasto 11 nella home]!")
main()
elif scelta == '2' or scelta == '02':
if ipserver != 'Nessun server impostato':
try:
players = get(f'http://{ipserver}:{portaserver}/players.json', timeout=5)
print('Attendi...')
getplayers = players.json()
for player in getplayers:
print(f"{y}[{player['id']}] {w}| {g}{player['name']} {w}| {c}Ping:{player['ping']}{w}")
input(f"{y}[{b}#{y}]{w} Premi invio per tornare alla home")
main()
except Exception as errore:
input(f"{y}[{Fore.LIGHTRED_EX }!{y}]{w} Errore [{errore}]!")
main()
else:
input(f"{y}[{Fore.LIGHTRED_EX }!{y}]{w} IP Server mancante [tasto 11 nella home]!")
main()
elif scelta == '3' or scelta == '03':
if ipserver != 'Nessun server impostato':
try:
players = get(f'http://{ipserver}:{portaserver}/players.json', timeout=5)
print('Attendi...')
getplayers = players.json()
for player in getplayers:
print(f"{y}[{player['id']}] {w}| {g}{player['name']} {w}| {c}{player['identifiers']}{w}")
input(f"{y}[{b}#{y}]{w} Premi invio per tornare alla home")
main()
except Exception as errore:
input(f"{y}[{Fore.LIGHTRED_EX }!{y}]{w} Errore [{errore}]!")
main()
else:
input(f"{y}[{Fore.LIGHTRED_EX }!{y}]{w} IP Server mancante [tasto 11 nella home]!")
main()
elif scelta == '4' or scelta == '04': #0.0.2
try:
diocane = input(f'''{y}[{b}#{y}]{w} Inserisci il link del server (esempio: cfx.re/join/vjarme): ''')
print(F'{y}[{b}#{y}]{w} Caricamento... Ricerca ip {diocane}')
global server
server = {}
s2 = server['link'] = diocane
server['id'] = os.path.basename(s2)
server['data'] = cercamelo.link()
print(f"""{g}Operazione Completata{w}
{b}URL: {diocane} {w}---> {c}IP: {server['data']['ip']}{w}""")
input(f"{y}[{b}#{y}]{w} Premi invio per tornare alla home")
main()
except Exception as errore:
input(f"{y}[{Fore.LIGHTRED_EX }!{y}]{w} Errore [{errore}]!")
main()
elif scelta == '5' or scelta == '05': #0.0.3
if ipserver != 'Nessun server impostato':
try:
info = get(f'http://{ipserver}:{portaserver}/info.json', timeout=5)
print('Attendi...')
getinfo = info.json()
risorse = getinfo["resources"]
print(f"{y}{risorse}{w}")
input(f"{y}[{b}#{y}]{w} Premi invio per tornare alla home")
main()
except Exception as errore:
input(f"{y}[{Fore.LIGHTRED_EX }!{y}]{w} Errore [{errore}]!")
main()
else:
input(f"{y}[{Fore.LIGHTRED_EX }!{y}]{w} IP Server mancante [tasto 11 nella home]!")
main()
elif scelta == '10' or scelta == '010':
transizione()
diocaporta = input(f'''{y}[{b}#{y}]{w} Inserisci la porta del server: ''')
portaserver = diocaporta
main()
elif scelta == '11' or scelta == '011':
transizione()
diocane = input(f'''{y}[{b}#{y}]{w} Inserisci l'ip NUMERICO del server: ''')
ipserver = diocane
main()
elif scelta == 'exit' or scelta == 'chiudi':
transizione()
sys.exit()
else:
clear()
main()
main()