-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrcon.py
71 lines (54 loc) · 2.6 KB
/
rcon.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
#!/usr/bin/python3
'''
Специально разработано для канала Meta Hacker.
Присоиденяйся к нам! -> https://t.me/metah4cker
Specially developed for the Meta Hacker channel.
Join us now! -> https://t.me/metah4cker
================================================
MCBrutal
Copyright (C) 2023 Meta Hacker
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import mcrcon
import time
import sys
import argparse
from colorama import init, just_fix_windows_console, Fore, Style
printi = lambda *a, **kw: print(f' {Style.BRIGHT}[{Fore.CYAN}i{Fore.RESET}]{Style.RESET_ALL}', *a, **kw)
printe = lambda *a, **kw: print(f' {Style.BRIGHT}[{Fore.LIGHTRED_EX}-{Fore.RESET}]', *a, **kw)
prints = lambda *a, **kw: print(f' {Style.BRIGHT}[{Fore.LIGHTGREEN_EX}+{Fore.RESET}]', *a, **kw)
def rcon(host='localhost', port=25575, password='test'):
printi(f'RCON | Connection to host: {host} by port: {port}')
printi('Specially written for the Meta Hacker channel | https://t.me/metah4cker')
try:
mr = mcrcon.MCRcon(host, password, port)
mr.connect()
except Exception as e:
printe(f'Cannot connect to the server{Style.RESET_ALL}')
return
try:
while 1: print(mr.command(input('> ')))
except Exception as e:
printe('Error occurred while sending command:', e)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('host',
help='IP-address of server')
parser.add_argument('-P', '--port',
type=int,
default=25575,
help='rcon service port (default -> 25575)')
parser.add_argument('-p', '--password',
default='123456',
help='path to the wordlist (file with passwords) (default -> passwords.txt)')
args = parser.parse_args()
rcon(args.host, args.port, args.password)