Last active
May 24, 2021 02:18
-
-
Save sulincix/b4f15e3487c5a99bcb9d1c15a6003bf8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from pyrogram import Client, filters | |
import subprocess | |
import time | |
import os | |
bindir=os.getcwd() | |
# Get hash from here https://my.telegram.org/apps | |
app = Client("shellbot",api_id=123456, | |
api_hash="your telegram app hash") | |
admin_id="1234234" | |
def block_shell(txt): | |
txt=txt.replace(";","") | |
txt=txt.replace("$","") | |
txt=txt.replace("&","") | |
txt=txt.replace("|","") | |
txt=txt.replace("{","") | |
txt=txt.replace("}","") | |
txt=txt.replace(">","") | |
txt=txt.replace("<","") | |
return txt | |
@app.on_message(filters.command("start")) | |
def start_command(client, message): | |
print("This is the /start command") | |
def calc(txt): | |
numeric="1234567890" | |
character="*/\\+-)(sctfi<>=!%" | |
txt2="" | |
txt=txt.replace("/calc ","") | |
for a in txt: | |
if (a in numeric): | |
txt2=txt2+a | |
elif(a in character): | |
txt2=txt2+a | |
txt2=txt2.replace("f","float") | |
txt2=txt2.replace("s","sin") | |
txt2=txt2.replace("c","cot") | |
txt2=txt2.replace("t","tan") | |
txt2=txt2.replace("**","*") | |
data=subprocess.getoutput("echo \"from math import *\\nprint("+txt2+")\" | timeout 3 python3 2>&1") | |
if len(data)>=1: | |
return(txt2+":\n"+data) | |
else: | |
return("Math Error") | |
@app.on_message(filters.all) | |
async def hello(client, message): | |
txt=message.text | |
if txt[0] != "/": | |
return | |
if txt == "/info": | |
await message.reply_text(message) | |
elif str(message.from_user.id) != str(admin_id): | |
await message.reply_text("Permission error!") | |
elif "/cd" in txt: | |
txt=txt.replace("/cd","") | |
os.chdir(txt.strip()) | |
await message.reply_text(os.getcwd()) | |
elif "/pwd" in txt: | |
await message.reply_text(os.getcwd()) | |
elif "/send" in txt: | |
txt=txt.replace("/send","").strip() | |
if os.path.isfile(txt): | |
await app.send_document(message.chat.id,txt) | |
else: | |
await message.reply_text("File not found in this area:\n"+os.getcwd()) | |
elif "/exit" in txt: | |
exit(0) | |
elif "/calc" in txt: | |
txt=txt.replace("/calc","") | |
await message.reply_text(calc(txt)) | |
elif "/.." in txt: | |
os.chdir("..") | |
await message.reply_text(os.getcwd()) | |
else: | |
txt=txt[1:] | |
repl=subprocess.getoutput(txt+"&") | |
if len(repl.strip())>0: | |
await message.reply_text(repl) | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment