from pyrogram import Client
from pyrogram import types, filters
CHANNEL_ID = -11012345678
app = Client(
"my_account",
api_id=12345,
api_hash="0123456789abcdef0123456789abcdef"
)
@app.on_message(filters=filters.channel)
def my_handler(client: Client, message: types.Message):
if message.chat.id != CHANNEL_ID:
return
print("Получено новое сообщение с ID", message.message_id)
# Как-то обработать сообщение с канала, например, напечатать его текст
print("Текст:", message.text)
app.run()
@app.on_message(filters=filters.channel & ~filters.edited)
isoinfo -l -i <образ>
isoinfo -f -i <образ>
sudo apt install genisoimage
pip install python_arptable
from typing import Optional
from python_arptable import get_arp_table
def get_ip_by_mac(macaddr: str) -> Optional[str]:
if record := next(filter(lambda i: i['HW address'].lower() == macaddr.lower(), get_arp_table()), None):
return record['IP address']
print(get_ip_by_mac('00:50:56:96:31:06')) # 10.0.20.91
import requests
http = requests.Session()
my_cookies = {'Abc': '123', 'Def': '456'}
http.cookies.update(my_cookies)
r = http.post('https://auth.roblox.com/v2/login', ...)
import glob
import shutil
files_to_copy = glob.glob('C:/Users/kolom/Desktop/Main programm/Auto_EGAIS/exe/*.ovpn')
destination_path = (r'C:/Program Files/OpenVPN/config/')
for file in files_to_copy:
shutil.copy2(file, destination_path)
import operator
def arithmetic(a: int, b: int, operation):
if operation not in (operator.add, operator.sub, operator.mul, operator.truediv):
print('Unknown operation')
else:
print(operation(a, b))
arithmetic(1, 2, operator.mul)
operators = {
'+': operator.add,
'-': operator.sub,
'*': operator.mul,
'/': operator.truediv
}
arithmetic(1, 2, operators['*'])
import re
s = "новая версия вчера - version1"
r = re.search(r'[a-zA-Z]{7}\d', s)
print(r.group())
class Client:
def __init__(self, client_id, name, phone, location, time):
self.client_id = client_id
self.name = name
self.phone = phone
self.location = location
self.time = time
my_client = Client(123456, "Vasya", "123456", "Lviv", 1234567890)
print(my_client.client_id)