diff --git a/README.md b/README.md index 474e5c1..53d4542 100644 --- a/README.md +++ b/README.md @@ -113,12 +113,42 @@ Different ways to get your `SESSION`: --- +# Core Contributor Team + + + + + + + + + + + + + + + + + +

@xditya

@1danish_00

@buddhhu

@TechiError

@New-dev0

@Arnab431

@sppidy

@hellboi_atul

@iAkashPattnaik
+ +## Contributors + + + + + +We are highly grateful for all the contributions made by our amazing community! ❤️ + +--- + # License [![License](https://www.gnu.org/graphics/agplv3-155x51.png)](LICENSE) Ultroid is licensed under [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html) v3 or later. ---- +--- # Credits * [![TeamUltroid-Devs](https://img.shields.io/static/v1?label=Teamultroid&message=devs&color=critical)](https://t.me/UltroidDevs) * [Lonami](https://github.com/LonamiWebs/) for [Telethon.](https://github.com/LonamiWebs/Telethon) diff --git a/multi_client.py b/multi_client.py new file mode 100644 index 0000000..a53cfe7 --- /dev/null +++ b/multi_client.py @@ -0,0 +1,39 @@ +import asyncio +import os +import subprocess +import sys + +vars = ["API_ID", "API_HASH", "SESSION"] + +def _check(z): + new = [] + for var in vars: + ent = os.environ.get(var + z) + if not ent: + return False, new + new.append(ent) + return True, new + +for z in range(5): + n = str(z + 1) + if z == 0: + z = "" + fine, out = _check(str(z)) + if fine: + subprocess.Popen( + [sys.executable, "-m", "pyUltroid", out[0], out[1], out[2], out[3], out[4], n], + stdin=None, + stderr=None, + stdout=None, + cwd=None, + ) + +loop = asyncio.get_event_loop() + +try: + loop.run_forever() +except Exception as er: + print(er) +finally: + loop.close() + diff --git a/plugins/devtools.py b/plugins/devtools.py index 40af9a7..4e6ce44 100644 --- a/plugins/devtools.py +++ b/plugins/devtools.py @@ -321,19 +321,34 @@ def _stringify(text=None, *args, **kwargs): async def aexec(code, event): - exec( - ( - "async def __aexec(e, client): " - + "\n print = p = _stringify" - + "\n message = event = e" - + "\n u.r = reply = await event.get_reply_message()" - + "\n chat = event.chat_id" - + "\n u.lr = locals()" - ) - + "".join(f"\n {l}" for l in code.split("\n")) + # Create a dedicated namespace for execution + exec_globals = { + 'print': _stringify, + 'p': _stringify, + 'message': event, + 'event': event, + 'client': event.client, + 'reply': await event.get_reply_message(), + 'chat': event.chat_id, + 'u': u, + '__builtins__': __builtins__ + } + + # Format the async function definition + wrapped_code = ( + 'async def __aexec(e, client):\n' + + '\n'.join(f' {line}' for line in code.split('\n')) ) - - return await locals()["__aexec"](event, event.client) + + try: + # Execute the wrapped code in our custom namespace + exec(wrapped_code, exec_globals) + # Get the defined async function + func = exec_globals['__aexec'] + # Execute it with proper parameters + return await func(event, event.client) + except Exception as e: + raise Exception(f"Failed to execute code: {str(e)}") DUMMY_CPP = """#include diff --git a/startup b/startup index 4c75a10..f0ff9a1 100644 --- a/startup +++ b/startup @@ -16,4 +16,4 @@ echo " " if [ -f .env ] ; then set -o allexport; source .env; set +o allexport ; fi -if [ $SESSION1 ] ; then wget https://gist.github.com/1Danish-00/6554f034549197e5824972b01f631e0c/raw/main.py && python3 main.py ; else python3 -m pyUltroid ; fi +if [ $SESSION1 ] ; then python3 multi_client.py ; else python3 -m pyUltroid ; fi