Converts tdata folder to a GramJS session for usage in a userbot.
Usage is simple. the main() function accepts a folder path (absolute or relative) and will return and print the session string if it found one.
Converts tdata folder to a GramJS session for usage in a userbot.
Usage is simple. the main() function accepts a folder path (absolute or relative) and will return and print the session string if it found one.
| # copied from https://github.com/tulir/mautrix-telegram/blob/master/mautrix_telegram/util/parallel_file_transfer.py | |
| # Copyright (C) 2021 Tulir Asokan | |
| import asyncio | |
| import hashlib | |
| import inspect | |
| import logging | |
| import math | |
| import os | |
| from collections import defaultdict | |
| from typing import Optional, List, AsyncGenerator, Union, Awaitable, DefaultDict, Tuple, BinaryIO |
| import { StoreSession} from "telegram/sessions"; | |
| import { TelegramClient } from "telegram/client/TelegramClient"; | |
| import { Api } from "./tl"; | |
| import { generateRandomBigInt, readBigIntFromBuffer, readBufferFromBigInt, sha256 } from "telegram/Helpers"; | |
| import bigInt from "big-integer"; | |
| const apiId = ; |
| import marshal | |
| a = marshal.loads("your marshal string data that is a code object here") | |
| import py_compile | |
| import time | |
| import uncompyle6 | |
| #This is taken from https://github.com/LonamiWebs/Telethon-calls/blob/master/calls.py and modified | |
| import hashlib | |
| import os | |
| import random | |
| from pyrogram import Client | |
| from pyrogram.api.functions.messages import GetDhConfig | |
| from pyrogram.api.functions.phone import RequestCall | |
| from pyrogram.api.types import PhoneCallProtocol |
| from time import sleep | |
| from selenium import webdriver | |
| from selenium.webdriver.common.by import By | |
| from selenium.webdriver.support import expected_conditions as EC | |
| from selenium.webdriver.support.wait import WebDriverWait | |
| driver = webdriver.Chrome() | |
| driver.get("https://humanbenchmark.com/tests/reactiontime") | |
| input("ready ?") |
| <?php | |
| function get_client_ip() | |
| { | |
| $ipaddress = ''; | |
| if (isset($_SERVER['HTTP_CLIENT_IP'])) $ipaddress = $_SERVER['HTTP_CLIENT_IP']; | |
| else if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
| else if (isset($_SERVER['HTTP_X_FORWARDED'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED']; | |
| else if (isset($_SERVER['HTTP_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; | |
| else if (isset($_SERVER['HTTP_FORWARDED'])) $ipaddress = $_SERVER['HTTP_FORWARDED']; | |
| else if (isset($_SERVER['REMOTE_ADDR'])) $ipaddress = $_SERVER['REMOTE_ADDR']; |
| import matplotlib.pyplot as plt | |
| from timeit import timeit | |
| time_taken = [] | |
| number_elements = [*range(15)] | |
| for x in range(1, 16): | |
| string = 'a' * x | |
| best = timeit("for _ in TrashGuy(inp): pass", setup=f"from trashguy import TrashGuy;inp='{string}'", number=1000) | |
| time_taken.append(best) | |
| plt.plot(time_taken, number_elements, color='g', marker='o') |