-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
272 lines (254 loc) · 11.2 KB
/
main.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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
import platform
import sys
import sched
import time
import keyboard
import ctypes
import os
import subprocess
import PySimpleGUI as sg
import threading
import json
oss = platform.system()
import pathlib
file = pathlib.Path("setup.key")
import ctypes
import webbrowser
import signal
import re
import pyautogui
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if oss == "Windows":
if sys.argv[1] == "-setup":
if not file.exists():
if is_admin():
print("If You Want To Donate! Go To https://www.paypal.me/soldeveloperm")
os.system("netsh advfirewall firewall add rule name=\"SHORTCUT 80\" dir=in action=allow protocol=TCP localport=80")
E = open("setup.key", "w+")
E.write("" + oss)
E.close()
sys.exit()
else:
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)
else:
print("You Already Setuped it")
elif sys.argv[1] == "-run":
layout = [[sg.Text('Please Enter The IP that the Server will be running on')],
[sg.Text('IP Address:', size=(15, 1)), sg.InputText()],
[sg.Submit(), sg.Cancel()],[sg.Text('If You Want To Donate! Go To https://www.paypal.me/soldeveloperm')]]
window = sg.Window(title="RPCC", layout=layout, margins=(100, 50))
while True:
event, values = window.read()
if event == "Cancel" or event == sg.WIN_CLOSED:
window.close()
exit()
break
elif event == "Submit":
window.close()
layouts = [[sg.Text("Server is running")], [sg.Button("Exit")]]
windowd = sg.Window("RPCC", layouts)
if __name__ == '__main__':
t = "php -S " + values[0] + ":80"
proc = subprocess.Popen(t, shell=False)
os.remove("run.key")
run = open("run.key", "w+")
run.write("R")
run.close()
evente = windowd.read()
windowd.close()
if evente == "Exit" or evente == sg.WIN_CLOSED:
os.remove("run.key")
run = open("run.key", "w+")
run.write("N")
run.close()
sys.exit()
break
elif sys.argv[1] == "-load":
if sys.argv[2] == "sc":
run = open("run.key", "r")
if run.readline() == "R":
with open("load.key", "rt") as load:
for line in load:
key = json.loads(line)
LC = key[str(oss)][0]
SV = LC['SC']
if SV == "true" or SV == "True":
P = os.getcwd()
FP = P + "\\screenshot.png"
RFP = r'' + FP
SC = pyautogui.screenshot()
SC.save(RFP)
print("./screenshot.png")
else:
print("SCNT")
elif not sys.argv[2] == "command":
with open('load.key', 'rt') as load:
for line in load:
key = json.loads(line)
run = open("run.key", "r")
if run.readline() == "R":
WTO = sys.argv[2]
CV = key[str(oss)][0]
if WTO in CV:
Run = CV[str(WTO)]
subprocess.call([Run])
print("Done! " + WTO + " Is Running!")
else:
print("The Server Isnt Running?, You Seems sus!")
else:
run = open("run.key", "r")
if run.readline() == "R":
with open("command.key", "rt") as CK:
for line in CK:
CO = json.loads(line)
commandencode = sys.argv[3:]
CP = sys.argv[3]
CCP = CO[str(oss)][0]
if CP in CCP:
unlist = ' '
command = unlist.join(commandencode)
subprocess.Popen(str(command))
print("Done")
else:
print("Sorry But You Are Trying To Use Unallowed Command")
else:
print("The Server Isnt Running?, You Seem sus!")
elif oss == "Darwin":
if sys.argv[1] == "-setup":
if not file.exists():
print("If You Want To Donate! Go To https://www.paypal.me/soldeveloperm")
os.system("sudo nc -l 80")
E = open("setup.key", "w+")
E.write("Setup Completed\n OS: " + oss)
E.close()
sys.exit
else:
print("You Already Setuped it")
elif sys.argv[1] == "-run":
layout = [[sg.Text('Please Enter The IP that the Server will be running on')],
[sg.Text('IP Address:', size=(15, 1)), sg.InputText()],
[sg.Submit(), sg.Cancel()],
[sg.Text('If You Want To Donate! Go To https://www.paypal.me/soldeveloperm')]]
window = sg.Window(title="RPCC", layout=layout, margins=(100, 50))
while True:
event, values = window.read()
if event == "Cancel" or event == sg.WIN_CLOSED:
window.close()
exit()
break
elif event == "Submit":
window.close()
layouts = [[sg.Text("Server is running")], [sg.Button("Exit")]]
windowd = sg.Window("RPCC", layouts)
if __name__ == '__main__':
t = "sudo php -S " + values[0] + ":80"
proc = subprocess.Popen(t, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
os.remove("run.key")
run = open("run.key", "w+")
run.write("R")
run.close()
evente = windowd.read()
windowd.close()
if evente == "Exit" or evente == sg.WIN_CLOSED:
os.remove("run.key")
run = open("run.key", "w+")
run.write("N")
run.close()
os.system("kill " + proc.pid)
sys.exit()
break
elif sys.argv[1] == "-load":
if not sys.argv[2] == "command":
with open('load.key', 'rt') as load:
for line in load:
key = json.loads(line)
run = open("run.key", "r")
if run.readline() == "R":
WTO = sys.argv[2]
CV = key[str(oss)][0]
if WTO in CV:
Run = CV[str(WTO)]
os.system("open " + Run)
print("Done! " + WTO + " Is Running!")
else:
print("The Server Isnt Running?, You Seems sus!")
else:
run = open("run.key", "r")
if run.readline() == "R":
with open("command.key", "rt") as CK:
for line in CK:
CO = json.loads(line)
commandencode = sys.argv[3:]
CP = sys.argv[3]
CCP = CO[str(oss)][0]
if CP in CCP:
unlist = ' '
command = unlist.join(commandencode)
subprocess.Popen(str(command))
print("Done")
else:
print("Sorry But You Are Trying To Use Unallowed Command")
else:
print("The Server Isnt Running?, You Seem sus!")
elif oss == "Linux":
if sys.argv[1] == "-setup":
if not file.exists():
print("If You Want To Donate! Go To https://www.paypal.me/soldeveloperm")
os.system("sudo firewall-cmd --add-port=80/tcp")
E = open("setup.key", "w+")
E.write("Setup Completed\n For OS: " + oss)
E.close()
sys.exit
else:
print("You Already Setuped it")
elif sys.argv[1] == "-run":
layout = [[sg.Text('Please Enter The IP that the Server will be running on')],
[sg.Text('IP Address:', size=(15, 1)), sg.InputText()],
[sg.Submit(), sg.Cancel()],
[sg.Text('If You Want To Donate! Go To https://www.paypal.me/soldeveloperm')]]
window = sg.Window(title="RPCC", layout=layout, margins=(100, 50))
while True:
event, values = window.read()
if event == "Cancel" or event == sg.WIN_CLOSED:
window.close()
exit()
break
elif event == "Submit":
window.close()
layouts = [[sg.Text("Server is running")], [sg.Button("Exit")]]
windowd = sg.Window("RPCC", layouts)
if __name__ == '__main__':
t = "sudo php -S " + values[0] + ":80"
proc = subprocess.Popen(t, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
os.remove("run.key")
run = open("run.key", "w+")
run.write("R")
run.close()
evente = windowd.read()
windowd.close()
if evente == "Exit" or evente == sg.WIN_CLOSED:
os.remove("run.key")
run = open("run.key", "w+")
run.write("N")
run.close()
proc.terminate()
sys.exit()
break
elif sys.argv[1] == "-load":
with open('load.key', 'rt') as load:
for line in load:
key = json.loads(line)
run = open("run.key", "r")
if run.readline() == "R":
WTO = sys.argv[2]
CV = key[str(oss)][0]
if WTO in CV:
Run = CV[str(WTO)]
os.system(Run)
print("Done! " + WTO + " Is Running!")
else:
print("The Server Isnt Running?, You Seem sus!")