Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

account banned #824

Closed
izzzzzi opened this issue May 29, 2018 · 189 comments
Closed

account banned #824

izzzzzi opened this issue May 29, 2018 · 189 comments

Comments

@izzzzzi
Copy link

izzzzzi commented May 29, 2018

When using the library, the account is immediately banished
How to avoid this?


(edit from @Lonami)

For everyone still coming here, see my comment:

Even official applications have these problems, not only libraries. Bans probably depend on a lot of factors, such as country, IP, use of the application, maybe even some random bans to accounts so people who care recover them and spambots won't bother with emails so those are gone, etc. For completeness sake:

Emails: [email protected], [email protected].

If those don't work, [email protected], https://telegram.org/support and DM to https://twitter.com/smstelegram may be worth trying.

@Lonami
Copy link
Member

Lonami commented May 29, 2018

I have never had this issue. Maybe Telegram restricts new apps. Maybe you're using a virtual phone number. Maybe it's location based.

@JMIdeaMaker
Copy link

Did you ever get unbanned?

@izzzzzi
Copy link
Author

izzzzzi commented May 31, 2018

@mike-johnson-jr
began to use a proxy, and use an older version of the library, the latest version 0.19 immediately banned the account from me

@Lonami
Copy link
Member

Lonami commented May 31, 2018

the latest version 0.19 immediately banned the account from me

It would be wonderful if you could find out what version starts to "ban your phones"… I really doubt the version matters.

@JMIdeaMaker
Copy link

JMIdeaMaker commented May 31, 2018

@goldeneagle66 what version are you using? and how are you using a proxy? do you think it may be location based? I tried signing up again multiple times on various US phone numbers and kept getting banned, with Telethon and with other libraries too

@izzzzzi
Copy link
Author

izzzzzi commented May 31, 2018

@Lonami
if I work with 0.19 then right away I get the ban on authorization, at 0.18. + everything works well
@mike-johnson-jr
I use the version 0.18. + and the ipv4 proxy, I would like to try more on ipv6 but not any examples found

@JMIdeaMaker
Copy link

I downgraded to Telethon 0.18 and I no longer get banned

@Lonami
Copy link
Member

Lonami commented May 31, 2018

Would you mind trying to upgrade one by one version until you got banned so we can find what version "breaks" it?

@JMIdeaMaker
Copy link

JMIdeaMaker commented May 31, 2018

I keep having to register new telephone numbers for testing. I've done so about 10 times now. I'd rather not continue to abuse their (and the telephone number app's) system by evading their bans and using their systems in a ways that were not originally intended.

@Lonami
Copy link
Member

Lonami commented May 31, 2018

Right… but I won't be maintaining an old version.

@JMIdeaMaker
Copy link

I'll get back to you on this.

@JMIdeaMaker
Copy link

I installed 0.18.3, started client from session started on 0.18, no problems

@Lonami
Copy link
Member

Lonami commented May 31, 2018

Thanks, the closer the working and failing versions, the easier to find what could have started causing these bans…

@ksandr310
Copy link

I installed 0.19.0.1 and I get the ban immediately after authorization. I don't use proxy or virtual phone number.

@Lonami
Copy link
Member

Lonami commented May 31, 2018

So the issue must be somewhere in v0.18.3...v0.19 I guess?

@JMIdeaMaker
Copy link

0.18.3 is right before 0.19.

@Lonami Lonami reopened this Jun 1, 2018
@Lonami
Copy link
Member

Lonami commented Jun 1, 2018

After reviewing the changes with @sovietspaceship, we think the most possible change in there is the change from layer 75 to layer 76. The layer75 branch reverts the current layer back to 75. @mike-johnson-jr would you mind testing this version? You can install it through pip with:

pip install --upgrade git+https://github.com/LonamiWebs/Telethon@layer75

@izzzzzi
Copy link
Author

izzzzzi commented Jun 1, 2018

the last working version after which I do not get a ban is 0.18.3

@Lonami
Copy link
Member

Lonami commented Jun 1, 2018

@goldeneagle66 yes, like @mike-johnson-jr pointed out. I'm now asking him (or anyone) to try installing the version suggested by my previous comment.

@Lonami
Copy link
Member

Lonami commented Jun 1, 2018

@goldeneagle66 @mike-johnson-jr how and were would it be possible to get some test phone numbers so I could try this out myself? I need some phone numbers if we want to tackle this issue.

If you could also provide some of the numbers that have already been banned, that would be helpful. Feel free to message them privately to me.

@remixsan
Copy link

remixsan commented Jun 1, 2018

@Lonami I think he used the "TextFree" app on Android. Good luck!

@izzzzzi
Copy link
Author

izzzzzi commented Jun 1, 2018

@Lonami today I'll try the code from your link I use the Russian SMS acceptance service :
sms-activate

@Lonami
Copy link
Member

Lonami commented Jun 1, 2018

@remixsan thanks, I had tried "Text Now" before.
@goldeneagle66 can you still give me the phone number of a banned phone?

@JMIdeaMaker
Copy link

JMIdeaMaker commented Jun 1, 2018

I get this error when trying to import TelegramClient after installing git+https://github.com/LonamiWebs/Telethon@layer75:

>>> from telethon import TelegramClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python36\lib\site-packages\telethon\__init__.py", line 2, in <module>

    from .telegram_bare_client import TelegramBareClient
  File "C:\Python36\lib\site-packages\telethon\telegram_bare_client.py", line 9,
 in <module>
    from . import version, utils
  File "C:\Python36\lib\site-packages\telethon\utils.py", line 13, in <module>
    from .tl.types import (
ImportError: cannot import name 'InputDialogPeer'

@Lonami
Copy link
Member

Lonami commented Jun 1, 2018

Right. Will fix in a bit.

@Lonami
Copy link
Member

Lonami commented Jun 1, 2018

@mike-johnson-jr please run pip install --no-cache --upgrade git+https://github.com/LonamiWebs/Telethon@layer75 and try again.

@JMIdeaMaker
Copy link

I need to wait 3 more hours before I can login again.

@leadron
Copy link

leadron commented Dec 18, 2023

Just a few hours ago I tried these code lines, directly copying and pasting from https://docs.telethon.dev/en/stable/basic/signing-in.html

from telethon import TelegramClient

# Use your own values from my.telegram.org
api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'

# The first parameter is the .session file name (absolute paths allowed)
with TelegramClient('anon', api_id, api_hash) as client:
    client.loop.run_until_complete(client.send_message('me', 'Hello, myself!'))

and a few minutes later my number was blocked, this still happens in current version 1.33.1
then I wrote to https://telegram.org/support, DM to https://twitter.com/smstelegram
Thanks, I was able to log in again after a few hours.
If I run the program again will I be banned again?
Can someone please tell me a safe code to do it?

@speauty
Copy link

speauty commented Dec 19, 2023

how to avoid this? it was ok when I loggined the offical app, after weeks, I authorized to telethon(1.24) with own app-id, a few seconds later, it was banned.

I found something in log:

mtprotosender-_handle_bad_server_salt, msg: Handling bad salt for message 7314208965694589988

@sergioamr
Copy link

sergioamr commented Dec 19, 2023

I think they just ban bots directly and automatically.

I had to explain my project:
img-api.com

So they unbanned the account that was doing the access using Telethon:

I eventually implemented it directly using the telegram api:
https://github.com/img-api/img-api-telegram
:(

https://github.com/img-api/img-api

@Lonami
Copy link
Member

Lonami commented Dec 19, 2023

Can someone please tell me a safe code to do it?

That code is safe. Telegram is the one deciding the bans.

I found something in log:

mtprotosender-_handle_bad_server_salt, msg: Handling bad salt for message 7314208965694589988

This is expected. The first message will fail until the correct salt can be acquired.

Nothing has changed since my last comments here.

@speauty
Copy link

speauty commented Dec 20, 2023

Can someone please tell me a safe code to do it?

That code is safe. Telegram is the one deciding the bans.

I found something in log:
mtprotosender-_handle_bad_server_salt, msg: Handling bad salt for message 7314208965694589988

This is expected. The first message will fail until the correct salt can be acquired.

Nothing has changed since my last comments here.

thanks for your reply, so that's because antispam is too abnormal? or there may be undiscovered instances of abuse?

@rawmind
Copy link

rawmind commented Jan 22, 2024

For tracking.

python -c "import telethon; print(telethon.__version__)"
1.33.1

I used the guide from (here)[https://docs.telethon.dev/en/stable/basic/signing-in.html#id2]

Please enter your phone (or bot token): <phone>
Please enter the code you received: <code>
Please enter your password: 
Invalid password. Please try again
Please enter your password: 
Invalid password. Please try again
Please enter your password: 
Signed in successfully as Andrei K; remember to not break the ToS or you will risk an account ban!

got a ban for ~2h.

@NNull13
Copy link

NNull13 commented Feb 1, 2024

Hi, im facing this same problem, only reading msg from one channel
There is any tips or suggestions on how to avoid or delay the bans?
What do u use? Real phones, virtual phones, main phone, burner?
VPN or/and proxy?
Thanks!

@en9inerd
Copy link

en9inerd commented Feb 7, 2024

I have two apps, one of them based on telethon, and it works without any issues. Another one is based on gramjs and every time when I try to use it - I'm going to be banned. The only difference between two apps is that I specify non-standard/default values for device_model and os_version for connection in case of app based on gramjs, maybe this is a problem 🤷‍♂️ I will check this hypothesis when two of my phone numbers are unbanned lol.

@apepenkov
Copy link
Contributor

Telegram used to use 6-bit signal security. This year they force switched to 7-bit. And not all frameworks have adopted or support this. The queue and processing of messages sent by the Api server have also changed. Because of this, using telethon for operation is currently not possible. since there is a high probability of getting a ban when connecting new numbers (old sessions work) (a solution was found in other frameworks, in other languages. And everything works there). We are waiting for changes in telethon

Can you please elaborate on what is x-bit signal security in this context? And provide source, if possible.

@alexsupa597
Copy link

Telegram used to use 6-bit signal security. This year they force switched to 7-bit. And not all frameworks have adopted or support this. The queue and processing of messages sent by the Api server have also changed. Because of this, using telethon for operation is currently not possible. since there is a high probability of getting a ban when connecting new numbers (old sessions work) (a solution was found in other frameworks, in other languages. And everything works there). We are waiting for changes in telethon

It sounds like a important information, can you please give some more details? It's a emergency.

@jacobsnum
Copy link

Is any decisions to fix it?

@NidhoogJX
Copy link

I think I have a lot of experience with account bans caused by the Telethon library
About last year, I used Telethon to write a simple script that listened to messages from multiple channels and used regular filtering to forward them. At first, I didn't limit my forwarding speed, but soon Telegram banned my account. So, in order to prevent being banned again by Telegram, I went to check the official rules of Telegram in this regard. Unfortunately, they only said they would monitor all accounts registered and logged in through the Telegram API. If you violate or initiate certain sensitive operations, you will receive a ban. In addition, I also found restrictions on Telegram Bot sending messages, which cannot exceed 30 messages per second https://core.telegram.org/bots/faq#my -Bot is hitting limits how to i avoid this
I don't think this applies to the Telegram API because my forwarding speed is much lower than this standard, so there is no clear standard for this rule restriction. Everything is subject to the internal anti spam system of Telegram. If you are unfortunately banned, you can only pray. Telegram has also stated in their protocol that they will not provide clear standards. Triggering restrictions will not cause account bans, and ignoring them will result in account bans. Therefore, if there are no restrictions in your code, it will definitely be banned
https://core.telegram.org/api/obtaining_api_id
So I added an interval between each send, and after trying it repeatedly, I found that setting it to 5 seconds would not trigger the ban rule. This simple script ran for several months and worked normally until about three months ago when my TG account was hacked. So, I reapplied to the Telegram API and related accounts, and a nightmare came. Because of my previous experience, I set a sufficient send interval of 10 seconds, but my account usually works for 1 to 3 days before being banned
The user has been deleted/deactivated
Then all the devices were kicked out and logged in, and I lost about a dozen or so accounts. So I checked my code, used message queues to cache message IDs, and set a limit of sending every 20 seconds. This time, the working time increased, and it was stable for a few days without being banned, but soon,
The user has been deleted/deactivated
Still coming,
So I checked my code again, because I set a buffer that would buffer 10 messages. Since I only cached the message ID, I would query the message content and then forward it every time I sent a message. I think this is because when I checked 10 messages at once, it triggered the Telegram restriction, which was a bit like a provocation to Telegram. So I adjusted the sending logic, no longer querying messages, but using memory to cache messages into memory and then delay sending. However, this still has problems. The file media content of the Telegram will expire quickly, about a few hours, and when you forward it again, an error will be reported. The file expires and an error must be retrieved again. The message content, so I had to add the message after sending failed, try to retrieve the file again, and send it again. Theoretically, this is enough, but I am not sure what restrictions will be triggered. Today, I triggered this error message
You're banned from sending messages in supergroups/channels (caused by SendMediaRequest)
But I didn't stop my program in time, which caused Telethon to try sending messages five times. When being banned from sending messages, it was like a provocation to Telegram, so it was not surprising that I was banned again,
So in summary, Telegram has a system for anti spam and checking for Tos
There will be many hidden restrictions that are not explicitly documented for you to refer to. All you can do is not to perform sensitive operations. If you need to do so, you need to be mentally prepared for being banned and take relevant measures, such as delaying the interval between these operations and minimizing the number of times
In addition, their restrictions are becoming increasingly strict, and I suspect there is a mechanism similar to a blacklist. If you use APIID and HASH with a history of being banned, there is no doubt that monitoring efforts will be increased. This is my experience of losing dozens of Telegram accounts. I am not sure if IP and geographical location will be marked together, but I have some evidence to suggest that IP may also be marked
Of course, I also summarized some limitations, such as
Get 10 historical messages per second
Sending a message every 5 seconds, of course, this is the safe range I tried last year, but it's not necessarily the same now. I suggest being pessimistic, once every minute or two (this is the safer range I tried)
Joining a group or channel for more than 50 to 100 channels in a short period of time will trigger a channel restriction warning and not result in account suspension. However, you cannot join related channels due to a time limit. It is best not to use the channel joining API within this time limit
Before you truly prepare to run your script, check your code to ensure that it does not trigger restrictions or impose corresponding restrictions. In addition, regarding third-party abuse issues, this restriction will definitely be triggered. Don't take chances and welcome to provide me with the restrictions you triggered

@NidhoogJX

This comment was marked as duplicate.

@NidhoogJX
Copy link

你好,我面临着同样的问题,只从一个频道读取消息 有关于如何避免或延迟延迟的任何提示或建议吗? 你用什么?真实电话、虚拟电话、主电话、刻录机? VPN 或/和代理? 谢谢!
我的建议是,你发送任何消息之前加上时间间隔限制 比如1分钟,这是我使用几十个账号得出的安全时间,当然你可以尝试更少的安全时间,那很容易触发 The user has been deleted/deactivated

@NidhoogJX
Copy link

你好,我面临着同样的问题,只从一个频道读取消息 有关于如何避免或延迟延迟的任何提示或建议吗? 你用什么?真实电话、虚拟电话、主电话、刻录机? VPN 或/和代理? 谢谢!

我最多的时候一天发送2000多条消息,但是第二天就会被封号

@NidhoogJX
Copy link

触发任何限制之后,建议不要忽视,并立即停止程序,这样能很大程度上避免被封号

@lgoo3
Copy link

lgoo3 commented May 30, 2024

触发任何限制之后,建议不要忽视,并立即停止程序,这样能很大程度上避免被封号

有没有遇到过这种报错,哥们还想私信你找不到入口
TypeError: 'coroutine' object is not iterable
sys:1: RuntimeWarning: coroutine 'DialogMethods.get_dialogs' was never awaited

@NidhoogJX
Copy link

触发任何限制之后,建议不要忽视,并立即停止程序,这样能很大程度上避免被封号

有没有遇到过这种报错,哥们还想私信你找不到入口 TypeError: 'coroutine' object is not iterable sys:1: RuntimeWarning: coroutine 'DialogMethods.get_dialogs' was never awaited

这是异步方法,你需要使用await 关键字调用

@KweezyCode
Copy link

i got banned too instantly. Just logged in

@atrdev-rgb
Copy link

Created an account. But the ban arrived 30 seconds after entering. Here is my code:

 from telethon.sync import TelegramClient
 from telethon.errors import SessionPasswordNeededError

      api_id = 'api_id'
      api_hash = 'api_hash'
 
      telegram_client= TelegramClient('session_name', api_id, api_hash)
      telegram_client.connect()
      if not telegram_client.is_user_authorized():
         phone = input('Enter your phone number: ')
         telegram_client.send_code_request(phone)
         code = input('Enter the code you received: ')
         try:
             telegram_client.sign_in(phone, code)
         except SessionPasswordNeededError:
             password = input('Enter your password: ')
             telegram_client.sign_in(password=password)
      print((telegram_client.get_me()).stringify())

Didn't even get to the code

print((telegram_client.get_me()).stringify())

@C0xi
Copy link

C0xi commented Jul 8, 2024

Banned for event listening for ~10 min:

from telethon import TelegramClient, events
import datetime

name = 'name'

api_id = id
api_hash = 'hash'
client = TelegramClient(name, api_id, api_hash)

@client.on(events.NewMessage())
async def newMessageListener(event):
    newMessage = event.message
    print(newMessage.date)
    print(newMessage.message)
    print("Current time: ", datetime.datetime.now(tz=datetime.timezone.utc))

with client:
    print("Client started!")
    client.run_until_disconnected()

@Yujiejiay123
Copy link

有处理办法吗?

@manicko
Copy link

manicko commented Nov 1, 2024

Same here got banned for listening the group. Got ban forever.

@manicko
Copy link

manicko commented Nov 4, 2024

Got new phone number and got banned just during the process of getting credentials. So Telegram blocked me after right after connection. I think the reason is that I were using the desktop telegram on the same computer launching the telethon script. Desktop version was working while I was launching the script.

@atrdev-rgb
Copy link

Got new phone number and got banned just during the process of getting credentials. So Telegram blocked me after right after connection. I think the reason is that I were using the desktop telegram on the same computer launching the telethon script. Desktop version was working while I was launching the script.

New phone numbers are flagged as spam when using this framework.

@manicko
Copy link

manicko commented Nov 4, 2024

Got new phone number and got banned just during the process of getting credentials. So Telegram blocked me after right after connection. I think the reason is that I were using the desktop telegram on the same computer launching the telethon script. Desktop version was working while I was launching the script.

New phone numbers are flagged as spam when using this framework.

This is not the case. I'm 100% sure the reason is the simultaneous usage of Telegram Desktop and the script. Somehow credentials got mixed and Telegram banned the phone number.

@atrdev-rgb
Copy link

atrdev-rgb commented Nov 4, 2024

Ban еven on a computer with a newly installed system without telegram. Even an account with a 3-year run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests