#!/usr/bin/env python
from os import environ
from telethon import TelegramClient
from telethon.tl.functions.messages import ForwardMessagesRequest
from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.types import ChannelParticipantsRecent
from telethon.tl.types import ChannelParticipantsSearch
from telethon.tl.types import PeerChannel
from telethon.tl.types import PeerChat
import json
import sys
import mysql.connector
client = TelegramClient('/home/telega', xxx, 'xxx')
resourse_id = sys.argv[1]
client.connect()
resourse = client.get_entity(resourse_id)
queryKey = ['а', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','a','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я', '1']
all_participants = []
for key in queryKey:
offset = 0
limit = 100
i=True
while i==True:
participants = client(GetParticipantsRequest(resourse, ChannelParticipantsSearch(key), offset, limit,hash=0))
client.send_message(client.get_entity("ramm4816"), key)
if not participants.users:
i=False
for user in participants.users:
if user.first_name and user.first_name[0].lower() == key:
all_participants.append(user.id)
offset += len(participants.users)
client.send_message(client.get_entity("ramm4816"), "step3")
json_participants = json.dumps(all_participants)
client.send_message(client.get_entity("ramm4816"), "step4")
cnx = mysql.connector.connect(user='root', password='xxxx', host='xxxx', database='xxx')
cursor = cnx.cursor()
add_subscribers = ("INSERT INTO capture_subscribers" "(channel_id, subscribers)" "VALUES (%s, %s)")
data_subscribers = (resourse_id, json_participants)
cursor.execute(add_subscribers, data_subscribers)
cnx.commit()
cursor.close()
cnx.close()
system('python3 /home/createSubscribersCaptype.py https://t.me/joinchat/EDAtHkvkc_771XZl8hdTdw', $retval);
exec("python3 /home/createSubscribersCaptype.py https://t.me/joinchat/EDAtHkvkc_771XZl8hdTdw > /dev/null &");
<?php
include('Net/SSH2.php');
$ssh = new Net_SSH2('www.domain.tld');
$ssh->login('username', 'password');
$ssh->read('[prompt]');
$ssh->write("sudo command\n");
$ssh->read('Password:');
$ssh->write("Password\n");
echo $ssh->read('[prompt]');
?>