Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
ce9bbe0
1
Parent(s):
749e796
Update dev.py
Browse files- Powers/plugins/dev.py +30 -10
Powers/plugins/dev.py
CHANGED
@@ -133,6 +133,21 @@ async def aexec(code, c, m):
|
|
133 |
return await locals()["__aexec"](c, m)
|
134 |
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
@Gojo.on_message(command(["exec", "sh"], dev_cmd=True))
|
137 |
async def execution(c: Gojo, m: Message):
|
138 |
if len(m.text.split()) == 1:
|
@@ -140,13 +155,7 @@ async def execution(c: Gojo, m: Message):
|
|
140 |
return
|
141 |
sm = await m.reply_text("`Processing...`")
|
142 |
cmd = m.text.split(maxsplit=1)[1]
|
143 |
-
|
144 |
-
if not m.from_user.id == 1344569458:
|
145 |
-
await sm.edit_text("Access denied ❌")
|
146 |
-
await c.send_message(
|
147 |
-
MESSAGE_DUMP, f"{m.from_user.username} tried to fetch env of the bot"
|
148 |
-
)
|
149 |
-
return
|
150 |
reply_to_id = m.id
|
151 |
if m.reply_to_message:
|
152 |
reply_to_id = m.reply_to_message.id
|
@@ -157,18 +166,29 @@ async def execution(c: Gojo, m: Message):
|
|
157 |
stderr=subprocess.PIPE,
|
158 |
)
|
159 |
stdout, stderr = await process.communicate()
|
160 |
-
e = stderr.decode()
|
161 |
if not e:
|
162 |
e = "No Error"
|
163 |
-
o = stdout.decode()
|
164 |
if not o:
|
165 |
o = "No Output"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
OUTPUT = ""
|
168 |
OUTPUT += f"<b>QUERY:</b>\n<u>Command:</u>\n<code>{cmd}</code> \n"
|
169 |
OUTPUT += f"<u>PID</u>: <code>{process.pid}</code>\n\n"
|
170 |
OUTPUT += f"<b>stderr</b>: \n<code>{e}</code>\n\n"
|
171 |
-
OUTPUT += f"<b>stdout</b>: \n<code>{
|
172 |
|
173 |
try:
|
174 |
await sm.edit_text(OUTPUT)
|
|
|
133 |
return await locals()["__aexec"](c, m)
|
134 |
|
135 |
|
136 |
+
HARMFUL = [
|
137 |
+
"base64",
|
138 |
+
"bash",
|
139 |
+
"get_me()",
|
140 |
+
"phone",
|
141 |
+
"os.system",
|
142 |
+
"sys.stdout",
|
143 |
+
"sys.stderr",
|
144 |
+
"subprocess",
|
145 |
+
"DATABASE_URL",
|
146 |
+
"BOT_TOKEN",
|
147 |
+
"API_HASH",
|
148 |
+
"APP_ID",
|
149 |
+
]
|
150 |
+
|
151 |
@Gojo.on_message(command(["exec", "sh"], dev_cmd=True))
|
152 |
async def execution(c: Gojo, m: Message):
|
153 |
if len(m.text.split()) == 1:
|
|
|
155 |
return
|
156 |
sm = await m.reply_text("`Processing...`")
|
157 |
cmd = m.text.split(maxsplit=1)[1]
|
158 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
reply_to_id = m.id
|
160 |
if m.reply_to_message:
|
161 |
reply_to_id = m.reply_to_message.id
|
|
|
166 |
stderr=subprocess.PIPE,
|
167 |
)
|
168 |
stdout, stderr = await process.communicate()
|
169 |
+
e = stderr.decode().strip()
|
170 |
if not e:
|
171 |
e = "No Error"
|
172 |
+
o = stdout.decode().strip()
|
173 |
if not o:
|
174 |
o = "No Output"
|
175 |
+
out = o
|
176 |
+
cmd = o.split()
|
177 |
+
for x in cmd:
|
178 |
+
xx = x.split("=")
|
179 |
+
if xx and xx[0] in harm:
|
180 |
+
if m.from_user.id != 1344569458:
|
181 |
+
out = "You can't access them"
|
182 |
+
else:
|
183 |
+
pass
|
184 |
+
else:
|
185 |
+
pass
|
186 |
|
187 |
OUTPUT = ""
|
188 |
OUTPUT += f"<b>QUERY:</b>\n<u>Command:</u>\n<code>{cmd}</code> \n"
|
189 |
OUTPUT += f"<u>PID</u>: <code>{process.pid}</code>\n\n"
|
190 |
OUTPUT += f"<b>stderr</b>: \n<code>{e}</code>\n\n"
|
191 |
+
OUTPUT += f"<b>stdout</b>: \n<code>{out}</code>"
|
192 |
|
193 |
try:
|
194 |
await sm.edit_text(OUTPUT)
|