v0.0.9 18/07/2021
Co-authored-by: New-dev0 <New-dev0@users.noreply.github.com> Co-authored-by: Aditya <me@xditya.me> Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: sppidy <sppidy@users.noreply.github.com> Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com> Co-authored-by: divkix <divkix@users.noreply.github.com> Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com> Co-authored-by: Programming Error <error@notavailable.live>
This commit is contained in:
@@ -27,6 +27,6 @@ apt-get upgrade -y
|
||||
pkg upgrade -y
|
||||
pkg install python wget -y
|
||||
wget https://raw.githubusercontent.com/TeamUltroid/ultroid/main/resources/session/ssgen.py
|
||||
pip install telethon
|
||||
pip install telethon pyrogram
|
||||
clear
|
||||
python3 ssgen.py
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2021 TeamUltroid
|
||||
#
|
||||
@@ -9,13 +9,6 @@
|
||||
import os
|
||||
from time import sleep
|
||||
|
||||
# https://www.tutorialspoint.com/how-to-clear-screen-in-python#:~:text=In%20Python%20sometimes%20we%20have,screen%20by%20pressing%20Control%20%2B%20l%20.
|
||||
if os.name == "posix":
|
||||
_ = os.system("clear")
|
||||
else:
|
||||
# for windows platfrom
|
||||
_ = os.system("cls")
|
||||
|
||||
a = r"""
|
||||
_ _ _ _ _ _
|
||||
| | | | | | (_) | |
|
||||
@@ -25,63 +18,137 @@ a = r"""
|
||||
\____/|_|\__|_| \___/|_|\__,_|
|
||||
"""
|
||||
|
||||
print(a)
|
||||
try:
|
||||
print("Checking if Telethon is installed...")
|
||||
|
||||
for x in range(3):
|
||||
def spinner(x):
|
||||
if x == "tele":
|
||||
print("Checking if Telethon is installed...")
|
||||
else:
|
||||
print("Checking if Pyrogram is installed...")
|
||||
for _ in range(3):
|
||||
for frame in r"-\|/-\|/":
|
||||
print("\b", frame, sep="", end="", flush=True)
|
||||
sleep(0.1)
|
||||
import telethon
|
||||
|
||||
x = "\bFound an existing installation of Telethon...\nSuccessfully Imported.\n\n"
|
||||
except BaseException:
|
||||
print("Installing Telethon...")
|
||||
os.system("pip install telethon")
|
||||
|
||||
x = "\bDone. Installed and imported Telethon."
|
||||
if os.name == "posix":
|
||||
_ = os.system("clear")
|
||||
else:
|
||||
# for windows platfrom
|
||||
_ = os.system("cls")
|
||||
print(a)
|
||||
print(x)
|
||||
def clear_screen():
|
||||
# https://www.tutorialspoint.com/how-to-clear-screen-in-python#:~:text=In%20Python%20sometimes%20we%20have,screen%20by%20pressing%20Control%20%2B%20l%20.
|
||||
if os.name == "posix":
|
||||
os.system("clear")
|
||||
else:
|
||||
# for windows platfrom
|
||||
os.system("cls")
|
||||
|
||||
# the imports
|
||||
|
||||
from telethon.errors.rpcerrorlist import ApiIdInvalidError, PhoneNumberInvalidError
|
||||
from telethon.sessions import StringSession
|
||||
from telethon.sync import TelegramClient
|
||||
|
||||
print(
|
||||
"Get your API ID and API HASH from my.telegram.org or @ScrapperRoBot to proceed.\n\n",
|
||||
)
|
||||
|
||||
try:
|
||||
API_ID = int(input("Please enter your API ID: "))
|
||||
except ValueError:
|
||||
print("APP ID must be an integer.\nQuitting...")
|
||||
exit(0)
|
||||
API_HASH = input("Please enter your API HASH: ")
|
||||
|
||||
# logging in
|
||||
try:
|
||||
with TelegramClient(StringSession(), API_ID, API_HASH) as ultroid:
|
||||
print("Generating a user session for Ultroid...")
|
||||
ult = ultroid.send_message(
|
||||
"me",
|
||||
f"**ULTROID** `SESSION`:\n\n`{ultroid.session.save()}`\n\n**Do not share this anywhere!**",
|
||||
)
|
||||
print("Your SESSION has been generated. Check your telegram saved messages!")
|
||||
def get_api_id_and_hash():
|
||||
print(
|
||||
"Get your API ID and API HASH from my.telegram.org or @ScrapperRoBot to proceed.\n\n",
|
||||
)
|
||||
try:
|
||||
API_ID = int(input("Please enter your API ID: "))
|
||||
except ValueError:
|
||||
print("APP ID must be an integer.\nQuitting...")
|
||||
exit(0)
|
||||
except ApiIdInvalidError:
|
||||
print("Your API ID/API HASH combination is invalid. Kindly recheck.\nQuitting...")
|
||||
exit(0)
|
||||
except ValueError:
|
||||
print("API HASH must not be empty!\nQuitting...")
|
||||
exit(0)
|
||||
except PhoneNumberInvalidError:
|
||||
print("The phone number is invalid!\nQuitting...")
|
||||
exit(0)
|
||||
API_HASH = input("Please enter your API HASH: ")
|
||||
return API_ID, API_HASH
|
||||
|
||||
|
||||
def telethon_session():
|
||||
try:
|
||||
spinner("tele")
|
||||
|
||||
x = "\bFound an existing installation of Telethon...\nSuccessfully Imported.\n\n"
|
||||
except BaseException:
|
||||
print("Installing Telethon...")
|
||||
os.system("pip install telethon")
|
||||
|
||||
x = "\bDone. Installed and imported Telethon."
|
||||
clear_screen()
|
||||
print(a)
|
||||
print(x)
|
||||
|
||||
# the imports
|
||||
|
||||
from telethon.errors.rpcerrorlist import ApiIdInvalidError, PhoneNumberInvalidError
|
||||
from telethon.sessions import StringSession
|
||||
from telethon.sync import TelegramClient
|
||||
|
||||
API_ID, API_HASH = get_api_id_and_hash()
|
||||
|
||||
# logging in
|
||||
try:
|
||||
with TelegramClient(StringSession(), API_ID, API_HASH) as ultroid:
|
||||
print("Generating a user session for Ultroid...")
|
||||
ult = ultroid.send_message(
|
||||
"me",
|
||||
f"**ULTROID** `SESSION`:\n\n`{ultroid.session.save()}`\n\n**Do not share this anywhere!**",
|
||||
)
|
||||
print(
|
||||
"Your SESSION has been generated. Check your telegram saved messages!"
|
||||
)
|
||||
exit(0)
|
||||
except ApiIdInvalidError:
|
||||
print(
|
||||
"Your API ID/API HASH combination is invalid. Kindly recheck.\nQuitting..."
|
||||
)
|
||||
exit(0)
|
||||
except ValueError:
|
||||
print("API HASH must not be empty!\nQuitting...")
|
||||
exit(0)
|
||||
except PhoneNumberInvalidError:
|
||||
print("The phone number is invalid!\nQuitting...")
|
||||
exit(0)
|
||||
|
||||
|
||||
def pyro_session():
|
||||
try:
|
||||
spinner("pyro")
|
||||
from pyrogram import Client
|
||||
|
||||
x = "\bFound an existing installation of Pyrogram...\nSuccessfully Imported.\n\n"
|
||||
except BaseException:
|
||||
print("Installing Pyrogram...")
|
||||
os.system("pip install pyrogram tgcrypto")
|
||||
x = "\bDone. Installed and imported Pyrogram."
|
||||
clear_screen()
|
||||
print(a)
|
||||
print(x)
|
||||
|
||||
# generate a session
|
||||
API_ID, API_HASH = get_api_id_and_hash()
|
||||
print("Enter phone number when asked.\n\n")
|
||||
with Client(":memory:", api_id=API_ID, api_hash=API_HASH) as pyro:
|
||||
ss = pyro.export_session_string()
|
||||
pyro.send_message(
|
||||
"me",
|
||||
f"`{ss}`\n\nAbove is your Pyrogram Session String for @TheUltroid music bot. **DO NOT SHARE it.**",
|
||||
)
|
||||
print("Session has been sent to your saved messages!")
|
||||
exit(0)
|
||||
|
||||
|
||||
def main():
|
||||
clear_screen()
|
||||
print(a)
|
||||
try:
|
||||
type_of_ss = int(
|
||||
input(
|
||||
"\nWhich session do you want to generate?\n1. User Session.\n2. VC Session.\n\nEnter choice: "
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
exit(0)
|
||||
if type_of_ss == 1:
|
||||
telethon_session()
|
||||
elif type_of_ss == 2:
|
||||
pyro_session()
|
||||
else:
|
||||
print("Lean English.")
|
||||
x = input("Run again? (y/n")
|
||||
if x == "y":
|
||||
main()
|
||||
else:
|
||||
exit(0)
|
||||
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user