tomer8007 / kik-bot-api-unofficial Goto Github PK
View Code? Open in Web Editor NEWPython API for writing unoffical Kik bots that act like humans
License: MIT License
Python API for writing unoffical Kik bots that act like humans
License: MIT License
When i try to join to any group, server return this response:
https://pastebin.com/df4jmCm8
Why does this error occur and how to avoid it?
What is the format of the captcha result as done by the example expected to be?
The response token from the KIK server looks something like this:
xxxxxxxxxxxx.xxxxxxxxxxxxx|r=us-west-2|metabgclr=transparent|metatimeclr=%xxxxxx|meta=x|guitextcolor=%xxxxxx|metaiconclr=transparent|lang=en|pk=xxxxx-xxxxx-xx-xx-xxxx|injs=https://cdn.funcaptcha.com/fc/assets/graphics/kik/scripts/kik_help_8.js|at=xx|ps=id|ht=x|atp=x|cdn_url=https://cdn.funcaptcha.com/fc|lurl=https://audio-us-west-2.funcaptcha.com|surl=https://funcaptcha.com
I tried inputing all of it with no success.
Hi
I try to use any method (get roster, find group etc) after login
Authorization is correct, I see the answer
But after sending any other request, I can not get an answer
Either it is not there, or the reading goes on indefinitely, or the reader says that the end of the stream is reached
What can be wrong?
As far as I understand it, send_read_confirmation() only allows sending read receipts to PMs. I tried to implement it, but the official API is not help either (https://dev.kik.com/#/docs/messaging#receipts) with the only example being sending a receipt to a PM.
There's a couple of issues with the current codebase. First of all some methods are long and messy. It would be nice to do a major refactor. Let's gather some ideas.
class MyKikBot(KikClient):
def on_group_message(self, group_message: GroupMessage):
group.send(GroupMessage("You sent: {}".format(group_message.message)))
Maybe I could make a basic version of this. Anyway, we can use this thread for future plans.
Every time I try to sign in get this error. username/password pair is correct, of course.
[2018-06-16 16:18:56,880] INFO (thread Kik Connection): [-] Login error: Password mismatch
Why does every time authorize each account, CAPTCHA appears?
Is it the Device and Android ID or the kik's version?
private string device_id = "167da12427ee4dc4a36b40e8debafc25";
private string andr_id = "1fba6fa0a899e775";
private string kik_version = "11.1.1.12218";
I've been having the safetynet issue too. Here's steps to reproduce for me:
<kik timestamp="1530632332578" app="all" push="false" qos="false" hop="true" />
<request r="false" xmlns="kik:message:receipt" d="false" />
<xiphias-mobileremote-call method="TriggerSafetyNetCheck" service="mobileremote.antispam.safetynet.v1.MobileSafetyNet">
<body />
</xiphias-mobileremote-call>
</message>
I haven't recorded my phone for account creation yet.
Hi!
I was getting the following error after installing it locally
kikclient.py", line 16, in <module>
from kik_unofficial.protobuf import group_search_service_pb2
ModuleNotFoundError: No module named 'kik_unofficial.protobuf'
I fixed it by creating a file __init__.py
in the protobuf folder
This is the HMAC info on the latest kik version that came out yesterday (14.0) seems like they ended 13 after the 13.4 update.
Kik version: 14.0.0.11130
Classes Dex: 9nPRnohIOTbby7wU1+IVDqDmQiQ=
Hmac: zFu88/RkSPvAidkDT/JRkrUdzyY=
When your bot gets added to a group (the bot has chatted with the inviter, so it gets added immediately)
<message from="[NUMBERS][email protected]" to="[email protected]" type="groupchat" id="[GUID]" xmlns="jabber:client">
<kik qos="true" app="all" hop="true" timestamp="1510865418472" push="false"/>
<request d="false" r="false" xmlns="kik:message:receipt"/>
<roster/>
<g is-public="true" jid="[NUMBERS][email protected]"><!-- NUMBERS same as message.from -->
<code>#[PUBLIC_GROUP_HASH]</code>
<n>Bot testing ground</n>
<pic ts="1505911808105">http://profilepics.cf.kik.com/[REDACTED]</pic>
<m>[JID]@talk.kik.com</m><!-- The jid of the bot is also in the list -->
<m>[JID]@talk.kik.com</m><!-- Some other member -->
<m s="1" a="1">[JID]@talk.kik.com</m><!-- Owner account, S=owner A=admin -->
</g>
<sysmsg xmlns="kik:msg:info">[FIRSTNAME] [LASTNAME] has added you to the chat</sysmsg>
</message>
When someone leaves a (public) group your bot is a member of.
<message type="groupchat" xmlns="jabber:client" id="[GUID]" from="[NUMBERS][email protected]" to="[BOT_JID]@talk.kik.com"><!-- JID of group -->
<kik timestamp="1510911460608" push="false" app="all" qos="true" hop="true"/>
<request d="false" r="false" xmlns="kik:message:receipt"/>
<roster/>
<g jid="[NUMBERS][email protected]"> <!-- JID of group -->
<l>[USER_JID]@talk.kik.com</l><!-- JID of user that left -->
</g>
<status jid="[USER_JID]@talk.kik.com">[FIRSTNAME] [LASTNAME] has left the chat</status>
</message>
When someone starts or is typing:
<message id="[GUID]" type="groupchat" xmlns="kik:groups" from="[TYPING_USER_JID]@talk.kik.com" to="[BOT_JID]@talk.kik.com">
<pb/>
<kik timestamp="1510911793198" push="false" app="chat" qos="false" hop="true"/>
<is-typing val="true"/>
<g jid="[GROUP_JID]@groups.kik.com"/><!-- the group the user is typing in -->
</message>
When someone stops typing
<message id="[GUID]" type="groupchat" xmlns="kik:groups" from="[TYPING_USER_JID]@talk.kik.com" to="[BOT_JID]@talk.kik.com">
<pb/>
<kik timestamp="1510911793414" push="false" app="chat" qos="false" hop="true"/>
<is-typing val="false"/>
<g jid="[GROUP_JID]@groups.kik.com"/>
</message>
When someone sends a message in a group:
<message id="[GUID]" type="groupchat" cts="1510911505345" xmlns="kik:groups" from="[USER_JID]@talk.kik.com" to="[BOT_JID]@talk.kik.com">
<body>Is vervelend... aan de plus kant ik weet nu hoe het eruit ziet als iemand we gaat...</body><!-- This is the original message as captured during the test -->
<pb/>
<preview>Is vervele...</preview><!-- some shortened version of the body -->
<kik timestamp="1510911505345" push="true" app="chat" qos="true" hop="true"/>
<request d="true" r="true" xmlns="kik:message:receipt"/>
<ri/>
<g jid="[GROUP_JID]@groups.kik.com"/><!-- group the message was posted in -->
</message>
Hi. How to get "captcha_result" for sign_up?
Hi, I use my own library, which I wrote on the basis of those found on the github
The principle of work is the same, but I have a problem
When I authorize only 1 account - everything is fine
if I try to authorize 2 or more in a row there are errors
[R]error code="406"
type="modify"
not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"
password-mismatch xmlns="kik:error"
/error
[R] k ok="0" badhost k
But password is correct!
I know that the library is different, but what could be the reason?
Since recently I haven't been able to login without filling in a captcha where this used to be possible.
Some things I noted:
I'm not sure on what conditions they base this captcha requirement.
Is there proxy support?
Hi, is it possible to find group by keyword?
For example "games" and get the list as:
I have made a handler for receiving image messages in one-on-one chats that I plan on making a pull request for, but I can't seem to figure out group picture messages. When receiving a group picture message, nothing happens, not even raising a NotImplementedError. Does anybody have any ideas why this could be or has a capture of a group picture message?
Hi, i working only on C# and i don't quite understand what this file is for
I thought that the methods of obtaining and processing results after searching for groups
At the same time, I ran into a problem - I was able to repeat the request for a C # group search, but I can not figure out how to get a response
Does this mean that I need to transfer the code from this file to C #?
If I use a for loop to send a message to my other account, I get an error after sometime saying "Failed. Bad ack id"
I see that timestamp(ts) is hard coded https://github.com/tomer8007/kik-bot-api-unofficial/blob/master/kik_unofficial/kikclient.py#L152 Why is it so? When I use current unix timestamp, my bot fails.
Traceback (most recent call last):
File "examples/send_message.py", line 30, in <module>
main()
File "examples/send_message.py", line 12, in main
chat_partners = kik_client.get_chat_partners()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kik_unofficial/kikclient.py", line 196, in get_chat_partners
self._make_request(data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kik_unofficial/kikclient.py", line 666, in _make_request
response = self._get_response()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kik_unofficial/kikclient.py", line 672, in _get_response
raise KikEmptyResponseException(response, "Kik server returned empty response")
kik_unofficial.kik_exceptions.KikEmptyResponseException: Kik server returned empty response
Can my bot be banned because of I don't change my timestamp?
hello!
this seems very cool, i might use it myself :) (and even contribute back if needed)
only question is, does this take care of auto register and stuff? understandable if not :)
either way thanks for making this public!
Hello!
I have locked at you code for Kik API. How do you take endpoint for API? Thats amazing.
I would like to write kik bot too, but i dont know how can i capture traffic and enpoints.
Can you help me with this? I will be very grateful!
Hi, How i can do this request?
#19
what is signature and kik-pub-key
at what point should I create this request?
I need it to group joining
Any more examples?
Can I follow the link programmatically?
For example http://kik.me/g/2gW5hq_l11EbfogXIcNB0XGBSH8
This error only happens after removing someone from a group. The error happens regardless of who does the kick.
ERROR (thread Kik Connection): Exception in callback KikClient._on_new_data_received(b'<iq type="e...</error></iq>') handle: <Handle KikClient._on_new_data_received(b'<iq type="e...</error></iq>')>
Traceback (most recent call last): File "C:\Users\RM\AppData\Local\Programs\Python\Python37-32\lib\asyncio\events.py", line 88, in _run self._context.run(self._callback, *self._args) File "C:\Users\RM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kik_unofficial\client.py", line 245, in _on_new_data_received self._handle_received_iq_element(xml_element) File "C:\Users\RM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kik_unofficial\client.py", line 279, in _handle_received_iq_element self._handle_xmlns(iq_element.query['xmlns'], iq_element) File "C:\Users\RM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kik_unofficial\client.py", line 307, in _handle_xmlns raise NotImplementedError NotImplementedError
I want to change the version number in case kik decides to ban all bots running on that version like they did before few weeks ago but every time I change it I either get a captcha or it stops working all of the sudden (yes I know how to generate a hash for the right version but that didn't help either I tried to change it to 11.36.0.18816 with this classes.dex hash 2UIy3Mfb27X3WOC9tGSR7W7uBwU= and its result was 7Wf/GLP3AX8UKDjL29jsxwp071A= ). Any idea how can I fix this problem?
is there anyway to collect all the messages i had with a person by that persons username. i am new to python. Thanks in advance.
what parameters should i use on client.py?
Hi, i find some information about kik:auth:cert from issue #62
I found structures:
(Account adrianaabram23:1223344):
-Pub key on auth: https://pastebin.com/GnTA5B3b (check kik.auth.gen.pub.key)
-Some private put requests after auth: https://pastebin.com/PXbHpCgt
-When i open group searching: https://pastebin.com/tchLsh7K (check kik.auth.manager.store.signature)
-Some cryptographic: https://pastebin.com/aFpt4Dgu
I need help to understand how both parameters are created and what they depend on
P.S.
Update about group joining:
the join method does not always return 400 error
on one of the tested accounts there was no error - just an empty answer body
in this case, the account did join the groups, but I did not do any additional actions
on the remaining 500/400 error
if an error occurred - no accounts was entered into the groups
When creating a fresh account and not having any chats, you can't call any methods without running into errors.
For example, executing the example code from the README.MD
results in following error:
File "test.py", line 4, in <module>
kik.send_message("other_kik_username", "Hello from bot!")
File "/some/path/kik_unofficial/kikclient.py", line 365, in send_message
jid = username if groupchat else self._resolve_username(username)
File "/some/path/kik-bot-api-unofficial/kik_unofficial/kikclient.py", line 801, in _resolve_username
raise Exception("Failed to convert username to kik node")
This is because in kikclient.py on line 789 function _resolve_username
expects self.user_info
to have the key chat_list
(which a fresh account of course doesn't have).
This can be easily fixed by putting a check beforehand, such as
if self.user_info is not None:
if "chat_list" in self.user_info: # -> fix
for node in self.user_info["chat_list"]:
if node[:node.rfind('_')] == username:
return node + jid_domain
When we run echo_bot.py and if internet gets disconnected during the process. The program hangs and doesnt reconnect.
I'm having this output dump when i try to login
[2018-08-24 23:11:42,226] DEBUG (thread Kik Connection): [+] Sending raw data: b'ceticbita2b6d25f7305e955813485749bdc770962030843678b7376a707ca3d11e87837utm_source=google-play&utm_medium=organic3102601494078709023androidgeneric114.0.0.11130en_US190CAN849d4ffb0c020de7Samsung Galaxy S5 - 4.4.4 - API 19 - 1080x1920'
[2018-08-24 23:11:42,364] DEBUG (thread Kik Connection): [+] Received raw data: b''
[2018-08-24 23:11:42,540] DEBUG (thread Kik Connection): [+] Received raw data: b'ceticbita2b6d25f7305e955813485749bdc770962030843678b7376a707ca3d11e87837utm_source=google-play&utm_medium=organic3102601494078709023androidgeneric114.0.0.11130en_US190CAN849d4ffb0c020de7Samsung Galaxy S5 - 4.4.4 - API 19 - 1080x1920https://captcha.kik.com/?id=3-CAISnwFe7F0O9kA9SdwdWI5LRIJGCYmcWCBTngnzoKxRHvfsfrvPKun-urpExh6au9OGkGQQxlFQvtZiXNK0zFwzcRZIQ8mKluTgFmYTcIR-K8t6JMFLClhDQcghY0mtQ-63LR5kD81xfyFmvDCeaD1dIYwYIGbZlhSTXB7dLtCWjJme8yosKi4GKWSrlzL7OcQVAuziOFhsBRjSlclsHmpmRmkaEK0FD0hhLvuhDZYjquW-f_QiIPjwm1jTbvwJB-hLx4VjN6D2BfunWap-bInYUDc5YjlMKhCUaMtQMKhqkpuZ3W4T9dGq&lang=en'
[2018-08-24 23:11:42,547] INFO (thread Kik Connection): [-] Login error: a Captcha is required to continue
If it helps anything. Apparently captcha blocks it from logging in
I think having this publicly available was a cool idea to start but clearly needs to stop. Every account that's ever been logged into your client is getting deleted and the client is just going to get patched and end up getting other clients patched and essentially ruining the fun of the development community on Kik. Plus it's practically a trap now since anyone logging into it gets banned.
I have been trying to get the bot working with multiple people messaging it at once with no luck.
Has anyone been trying this?
help_wanted: I want to lurk on a number of conversation in chats.
Hi! Thank you for great API. Do you plan to add sending multimedia?
Maybe somebody have a function for sending images?
Hi! I received 406 error after login attempt. Any idea?
[-] Kik error code: 406
Traceback (most recent call last):
<error code="406" type="modify">
File "/kik-bot-api-unofficial/examples/send_message.py", line 29, in
<not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
main()
</error>
I tried using your API to send a simple text message to myself using my other accounts credentials in the code, but it says "Message seems to be sent but not delivered." When I was trying to send this message to my original account, my original was online as you said it should be.
Hey! It's me again. I'm working with the bot, I want to make it so whenever someone joins the group, it will send the rules! Whenever I do this however, I get an error
I am trying to get a list of my group but keep getting an unknown message error at every event that would provide the information I need.
[2018-08-14 16:35:38,724] ERROR (thread Kik Connection): Exception in callback KikClient._on_new_data_received(b'<message fr..."/></message>') handle: <Handle KikClient._on_new_data_received(b'<message fr..."/></message>')> Traceback (most recent call last): File "C:\Users\RM\AppData\Local\Programs\Python\Python37-32\lib\asyncio\events.py", line 88, in _run self._context.run(self._callback, *self._args) File "C:\Users\RM\Desktop\kik-bot-api-unofficial-new\kik_unofficial\client.py", line 247, in _on_new_data_received self._handle_xmpp_message(xml_element) File "C:\Users\RM\Desktop\kik-bot-api-unofficial-new\kik_unofficial\client.py", line 291, in _handle_xmpp_message self.callback.on_group_receipts_received(chatting.IncomingGroupReceiptsEvent(xmpp_message)) File "C:\Users\RM\Desktop\kik-bot-api-unofficial-new\kik_unofficial\datatypes\xmpp\chatting.py", line 215, in __init__ self.group_jid = data.g['jid'] TypeError: 'NoneType' object is not subscriptable [2018-08-14 16:35:38,744] ERROR (thread Kik Connection): Exception in callback KikClient._on_new_data_received(b'<message fr...sg></message>') handle: <Handle KikClient._on_new_data_received(b'<message fr...sg></message>')> Traceback (most recent call last): File "C:\Users\RM\AppData\Local\Programs\Python\Python37-32\lib\asyncio\events.py", line 88, in _run self._context.run(self._callback, *self._args) File "C:\Users\RM\Desktop\kik-bot-api-unofficial-new\kik_unofficial\client.py", line 247, in _on_new_data_received self._handle_xmpp_message(xml_element) File "C:\Users\RM\Desktop\kik-bot-api-unofficial-new\kik_unofficial\client.py", line 294, in _handle_xmpp_message self.xml_namespace_handlers['jabber:client'].handle(xmpp_message) File "C:\Users\RM\Desktop\kik-bot-api-unofficial-new\kik_unofficial\xmlns_handlers.py", line 82, in handle raise NotImplementedError NotImplementedError
I need help getting the users in a group, whenever I try I get an error, please help.
Kik server returned empty response
when I try to get_chat_partners
I am almost always met with the error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 16383: unexpected end of data
or AttributeError: 'NoneType' object has no attribute 'children'
When I run the interactive client code and type /f
it just sends the roster request but never receives an response. I can only see the following log and nothing after that. Can you please help me with whats the issue.
[2018-08-11 21:27:19,387] INFO (thread Kik Connection): [+] Authenticated successfully.
-Usage-
/c [first letters of username] - Chat with peer
/f - List peers
Type a line to send a message.
/f
[2018-08-11 21:28:11,731] INFO (thread Kik Connection): [+] Requesting roster (list of chat partners)...
Although echo_bot
and register_client
are working fine
Is there a way to get a list of Group members ? When I apply request_roster the Output is like:
Roster:
Group(jid=[jid][email protected], name=Test Group, code=#justtestit, members=7)
Nxxx Hx (nxxx_xx_xx)
Kik Team (kikteam)
But I dont get a list of the (seven) members of the group
I know this is old and I don't know if you still check this from time to time anyway...
I tried sniffing traffic from the kik api using burp with the NOPE proxy for non http protocols, I installed the burp certificate on my phone, unfortunately it seems KIK messenger is using ssl pinning which I can't remove yet (I didn't start reverse engineering, lazy mofo).
Yet the version you're using for this is the same as I'm using (11.1.1.12 something) and you succeeded at sniffing traffic, so did you have to ssl unpin it or it's not ssl pinned and it's not working for me for some other reason ?
Maybe I should try with MITM or SSLstrip or an older version ?
This is professional work that I admire hence why I'm trying to learn to.
Thanks sir.
<iq type="set" id="[GUID]">
<query xmlns="kik:groups:admin">
<g jid="[GUID]">
<n>[GROUPNAME]</n>
</g>
</query>
</iq>
This will change the group name of the groups if you are an admin
Had to work on XMPP's for my project so thought I would post it here so other people can get help from it :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.