Skip to content

Commit 1812da5

Browse files
committed
Merge branch 'develop'
2 parents 7180493 + 1685a83 commit 1812da5

File tree

7 files changed

+24
-12
lines changed

7 files changed

+24
-12
lines changed
-28 Bytes
Binary file not shown.
-28 Bytes
Binary file not shown.
26 Bytes
Binary file not shown.
883 Bytes
Binary file not shown.

main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import ssh_connection
33
import page_with_not_installed_xray
44
import page_with_installed_xray
5-
from termcolor import colored
5+
from colorama import init, Fore
66

77
logged = False
88

@@ -19,12 +19,12 @@
1919

2020
if xray_installed:
2121
logged = True # Mark as logged in
22-
print(colored("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", 'yellow'))
22+
print(Fore.YELLOW + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + Fore.RESET)
2323
print("""1. Добавить пользователя
2424
2. Удалить пользователя
2525
3. Список пользователей
2626
4. Сгенерировать/Перегенерировать ключи (все пользователи будут удалены)""")
27-
print(colored("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", 'yellow'))
27+
print(Fore.YELLOW + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + Fore.RESET)
2828

2929
digit = page_with_installed_xray.digit_input()
3030

@@ -73,8 +73,8 @@
7373
ssh_connection.generate_keys(ssh)
7474

7575
logged = True # Mark successful installation
76-
print(colored("XRay успешно установлен и настроен!", "green"))
76+
print(Fore.GREEN + "XRay успешно установлен и настроен!" + Fore.RESET)
7777

7878
except Exception as e:
79-
print(colored(f"Ошибка: {str(e)}", "red"))
79+
print(Fore.RED + f"Ошибка: {str(e)}" + Fore.RESET)
8080
logged = False

ssh_connection.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import paramiko
22
import re
3-
import json
4-
from termcolor import colored, cprint
5-
3+
from colorama import init, Fore
64

75
@staticmethod
86
def connect_ssh(server):
@@ -144,7 +142,7 @@ def add_user(ssh, server_ip):
144142
public_key = stdout.read().decode('utf-8')
145143

146144
print("Необходимо вставить конфиг в VLESS клиент:")
147-
print(colored(f"vless://{uuid}@{server_ip}:443?security=reality&sni=google.com&alpn=h2&fp=chrome&pbk={public_key}&pbk=su1LPoVoA44umUYDWskmuEwAvGvx9bg8nVfiSgK3Fiw&sid=aabbccdd&type=tcp&flow=xtls-rprx-vision&encryption=none#manul",'green'))
145+
print(Fore.GREEN + f"vless://{uuid}@{server_ip}:443?security=reality&sni=google.com&alpn=h2&fp=chrome&pbk={public_key}&pbk=su1LPoVoA44umUYDWskmuEwAvGvx9bg8nVfiSgK3Fiw&sid=aabbccdd&type=tcp&flow=xtls-rprx-vision&encryption=none#manul" + Fore.RESET)
148146

149147
stdin, stdout, stderr = ssh.exec_command("systemctl restart xray")
150148

start_page.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
import pwinput
2-
2+
import msvcrt
33

44
def account_message():
55
ip = input("Введите IP адрес сервера: ").strip()
66
login = input("Введите логин: ").strip()
7+
if login != "root":
8+
is_root = root_warning()
9+
if is_root:
10+
login = "root"
711
password = pwinput.pwinput("Введите пароль: ", mask='*')
812
server = Server(ip, login, password)
913
return server
10-
14+
1115
class Server:
1216
def __init__(self, ip, login, password):
1317
self.login = login
1418
self.ip = ip
15-
self.password = password
19+
self.password = password
20+
21+
def root_warning():
22+
print("Вы собираетесь войти не под пользователем root, для корректной работы скрипта необходимы права администратора, они есть у текущего пользователя?")
23+
print("""1. Нет, войти под root
24+
2. Да, я подтверждаю, что заблаговременно повысил права пользователю""")
25+
char = msvcrt.getch().decode('utf-8')
26+
if char == '1':
27+
return True
28+
if char == '2':
29+
return False

0 commit comments

Comments
 (0)