tomer8007 / kik-bot-api-unofficial

Python API for writing unoffical Kik bots that act like humans
MIT License
128 stars 77 forks source link

Functions for retrieving unread/unreceived history #173

Closed kopf closed 3 years ago

kopf commented 3 years ago

As far as I'm aware, there's no functionality in the new client for fetching history. Is this correct, or am I overlooking something? If it's missing, is it planned?

I see here there is some information on the message formats for this action. I could contribute, but I'm not sure where this functionality should be placed or how it should look.

tomer8007 commented 3 years ago

You can contribute this functionality by subclassing XMPPElement, and placing the XML in the serialise function.

Then under KikClient there should be a new method that creates and sends an instance of this class. Just look at how other similar methods are implemented.

I hope this helps.

kopf commented 3 years ago

It does, thanks @tomer8007 ! I'll have a look.

bluemods commented 3 years ago

I will try and work on a PR for this

IMPORTANT NOTE:

Currently there are exploits that can clog the message history, meaning there are ways to spoof who the message is coming from. If this is done, old history messages become unack-able.

Considering how Kik requires you to send message acks that require who the message came from and what message id the message was under to continue pulling more messages in your history queue, it is possible to clog this up as the sender is unknown, which means that you can get stuck with the history and it becomes useless for accounts that have been exploited, as Kik will just send the last batch over and over and you cannot ack the batch.

Only use this if you need to, but dont rely on it to try and "catch up" if your bot is offline or misses messages somehow. At least until the exploit is fixed.

kopf commented 3 years ago

Awesome, thank you @bluemods ! I'd only begun looking at the source properly last night, so.. Be my guest!

kopf commented 3 years ago

What is the status of this?

bluemods commented 3 years ago

The way the API is designed, it would require a major rewrite to get it to work properly

gowthamr-math commented 3 years ago

You can contribute this functionality by subclassing XMPPElement, and placing the XML in the serialise function.

Then under KikClient there should be a new method that creates and sends an instance of this class. Just look at how other similar methods are implemented.

I hope this helps.

I will try and work on a PR for this

IMPORTANT NOTE:

Currently there are exploits that can clog the message history, meaning there are ways to spoof who the message is coming from. If this is done, old history messages become unack-able.

Considering how Kik requires you to send message acks that require who the message came from and what message id the message was under to continue pulling more messages in your history queue, it is possible to clog this up as the sender is unknown, which means that you can get stuck with the history and it becomes useless for accounts that have been exploited, as Kik will just send the last batch over and over and you cannot ack the batch.

Only use this if you need to, but dont rely on it to try and "catch up" if your bot is offline or misses messages somehow. At least until the exploit is fixed.

I see this is already implemented, client.py have history request api and in the bot send_acks.py it has a response. If we just properly ack as in send_ack py there will be no issue right?

tomer8007 commented 3 years ago

It should work since #200.