Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
| from itertools import product | |
| from typing import List, Tuple | |
| def __find_neighbours(x: int, y: int, size: int) -> List[Tuple]: | |
| """ | |
| Finds neighbours for a cell. Those which fall out of the field are skipped | |
| :param x: current cell's X coord | |
| :param y: current cell's Y coord | |
| :param size: field single dimension size (because field is square) |
| from Crypto.Hash import SHA | |
| from Crypto.Signature import PKCS1_v1_5 | |
| from Crypto.PublicKey import RSA | |
| from base64 import urlsafe_b64encode | |
| from requests import get | |
| def get_version_signature(version, private_key): | |
| signed_data = b'TelegramBeta_%x'%int(version) |
| FROM ubuntu | |
| RUN apt update \ | |
| && apt install -y firefox \ | |
| openssh-server \ | |
| xauth \ | |
| && mkdir /var/run/sshd \ | |
| && mkdir /root/.ssh \ | |
| && chmod 700 /root/.ssh \ | |
| && ssh-keygen -A \ | |
| && sed -i "s/^.*PasswordAuthentication.*$/PasswordAuthentication no/" /etc/ssh/sshd_config \ |
| # implementation of Telegram site authorization checking algorithm | |
| # for more information https://core.telegram.org/widgets/login#checking-authorization | |
| import collections | |
| import hmac | |
| import hashlib | |
| def check_string(data, token): | |
| secret = hashlib.sha256() | |
| secret.update(token.encode('utf-8')) |
| vi /etc/environment | |
| add these lines... | |
| LANG=en_US.utf-8 | |
| LC_ALL=en_US.utf-8 |
| from telethon.tl.functions import InitConnectionRequest, InvokeWithLayerRequest | |
| from telethon.tl.functions import langpack # GetLangPackRequest, GetDifference | |
| from telethon.tl import all_tlobjects # for LAYER | |
| from telethon.tl.types import LangPackString, LangPackStringPluralized, LangPackStringDeleted | |
| from telethon.tl.functions import InitConnectionRequest, InvokeWithLayerRequest | |
| from telethon.tl.functions import langpack # GetLangPackRequest, GetDifference | |
| from telethon.tl import all_tlobjects | |
| from telethon.tl.types import LangPackString, LangPackStringPluralized, LangPackStringDeleted |
| :) CREATE TABLE test.nested (EventDate Date, UserID UInt64, Attrs Nested(Key String, Value String)) ENGINE = MergeTree(EventDate, UserID, 8192) | |
| CREATE TABLE test.nested | |
| ( | |
| EventDate Date, | |
| UserID UInt64, | |
| Attrs Nested( | |
| Key String, | |
| Value String) | |
| ) ENGINE = MergeTree(EventDate, UserID, 8192) |
| #!/bin/bash | |
| sudo mount -o remount,size=10G,noatime /tmp | |
| echo "Done. Please use 'df -h' to make sure folder size is increased." |