Git Product home page Git Product logo

bitlbee-whatsapp-nt's Introduction

bitlbee-whatsapp-nt

NOTICE NOTICE NOTICE

NOT WORKING AS OF 2022-01-11. MAYBE IN THE SUMMER OF 2022. SORRY.

OK, so in this repository I will try to create a bitlbee plugin for whatsapp. With C. Dunno what will happen. Lets see.

Why the name? It means the next try of creating bilbee plugin for whatsapp. Because other people have tried and projects are now non-functioning or dormant. Or written with exotic languages. This project will die also one day but I will try now to make it work.

Research

Protocol

Protocol specs for Whatsapp Web api (we will use this) is here: https://github.com/sigalor/whatsapp-web-reveng

Websocket library

It seems we need Websockets library for C.

Somebody has made a list:

https://github.com/facundofarias/awesome-websockets#c

This is available on both Debian 9 and 10 and Ubuntu 16.04 LTS: https://libwebsockets.org/

This is available on Debian 10 only: https://github.com/tatsuhiro-t/wslay

So maybe eventually libwebsockets7 (v. 1.7.1) as in Ubuntu?

QR-code library

Need some kind of library for QR-code authorization, one that can output the authorization code to a .gif or .png for authroization.

So maybe minimum libqrencode3 as it is also with that old Ubuntu LTS?

http://megaui.net/fukuchi/works/qrencode/index.en.html

PNG library

The QR code needs to be actually outputted as a valid format. PNG is cool. So its something like libpng16. Exists also in that old LTS.

http://libpng.org/pub/png/libpng.html

AES library

Some kind of AES library is needed probably. This looks good: https://github.com/kokke/tiny-AES-c

Ideas / random thoughts

Make test binary for writing big arbitrary QR code PNG files.

Make test binary for authorizing clients. It will store encryption keys which can be transferred to the plugin resource directory. Or via irc AUTH? Need to think a bit.

Build system should be more or less the same as with bitlbee-facebook, right? I have never used anything like this before, only pure makefiles.

Best to start on Ubuntu 16.04 LTS. Then learn autogen/autowhatever framework by copying and modifying files until shit compiles. There were alternatives, but better not rock the boat with something different from for example bitlbee-facebook.

Confirming from Debian 10 that autogen.sh is successful. Going back to Ubuntu 16.04 to continue development though.

It seems Whatsapp Web version keeps changing, so keep it configurable easily.

Damn, things are getting so fragmented if we keep clinging on Ubuntu 16.04 LTS. We already needed, or "needed" external curve 25519 and base64 libraries. A big problem will be possible SSL certificate verification and extraction.

Good example: https://stackoverflow.com/questions/30904560/libwebsocket-client-example

Probably even better example: https://github.com/iamscottmoyers/simple-libwebsockets-example/blob/master/client.c

Ok nice, it seems https://www.websocket.org/echo.html works with current implemation. And the current Whatsapp connection does not.

Why have separate setting for Whatsapp Web version? See: sigalor/whatsapp-web-reveng#272 It says: "JS demo is not working I tried to run the latest index_jsdemo.js in local and share the web session. I am able to start the local server , the QR code that got generated is not valid to start the web session sharing. Any idea?? You need to update Whatsapp Web version to "0,4,2081"."

Every websocket library has some stupidities so at some point I started to create my own.

bitlbee-whatsapp-nt's People

Contributors

usvi avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

bitlbee-whatsapp-nt's Issues

Ubable to connecto Whatsapp server, but public echo server is fine

Funny thing is going on. Latest implementation is able to connect to public echo server, but not to Whatsapp Web server.

Example:
Calling u8BBWANT_AllocateConnection("wss://echo.websocket.org/?encoding=text", "https://www.websocket.org", &pxTempConnection); :
bitlbee-whatsapp-nt-client v. 0.0.1
[1592071856:0982] NOTICE: Initial logging level 7
[1592071856:0982] NOTICE: Libwebsockets version: 1.7.1 unknown-build-hash
[1592071856:0982] NOTICE: IPV6 not compiled in
[1592071856:0982] NOTICE: libev support not compiled in
[1592071856:0983] NOTICE: Threads: 1 each 1024 fds
[1592071856:0983] NOTICE: mem: platform fd map: 8192 bytes
[1592071856:0983] NOTICE: mem: per-conn: 376 bytes + protocol rx buf
[1592071856:0983] NOTICE: canonical_hostname = seleniumVM
[1592071856:0996] NOTICE: SSL ECDH curve 'prime256v1'
[1592071856:0996] NOTICE: LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS
[1592071856:0997] NOTICE: LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS
[1592071856:0997] NOTICE: LWS_CALLBACK_PROTOCOL_INIT
[1592071856:0997] NOTICE: LWS_CALLBACK_CHANGE_MODE_POLL_FD
[1592071856:3898] NOTICE: LWS_CALLBACK_LOCK_POLL
[1592071856:3898] NOTICE: LWS_CALLBACK_ADD_POLL_FD
[1592071856:3899] NOTICE: LWS_CALLBACK_UNLOCK_POLL
[1592071856:3903] NOTICE: LWS_CALLBACK_LOCK_POLL
[1592071856:3903] NOTICE: LWS_CALLBACK_CHANGE_MODE_POLL_FD
[1592071856:3904] NOTICE: LWS_CALLBACK_UNLOCK_POLL
[1592071856:3904] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:4159] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:4418] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:4677] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:4944] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:5232] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:5501] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:5549] NOTICE: LWS_CALLBACK_LOCK_POLL
[1592071856:5549] NOTICE: LWS_CALLBACK_CHANGE_MODE_POLL_FD
[1592071856:5549] NOTICE: LWS_CALLBACK_UNLOCK_POLL
[1592071856:5550] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:5835] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:6094] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:6347] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:6606] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:6871] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:7143] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:7199] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:7478] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:7736] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:7995] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:8262] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:8523] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:8781] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:8894] NOTICE: LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER
[1592071856:8895] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:9152] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:9410] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:9669] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071856:9927] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071857:0195] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071857:0455] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592071857:0582] NOTICE: LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH
[1592071857:0582] NOTICE: LWS_CALLBACK_CLIENT_ESTABLISHED
Retval was 0
[1592071857:0582] NOTICE: lws_context_destroy
[1592071857:0582] NOTICE: LWS_CALLBACK_LOCK_POLL
[1592071857:0582] NOTICE: LWS_CALLBACK_DEL_POLL_FD
[1592071857:0582] NOTICE: LWS_CALLBACK_UNLOCK_POLL
[1592071857:0584] NOTICE: LWS_CALLBACK_WSI_DESTROY
[1592071857:0584] NOTICE: LWS_CALLBACK_PROTOCOL_DESTROY

Calling
u8BBWANT_AllocateConnection("wss://web.whatsapp.com/ws", "https://web.whatsapp.com", &pxTempConnection); :
bitlbee-whatsapp-nt-client v. 0.0.1
[1592072122:3297] NOTICE: Initial logging level 7
[1592072122:3298] NOTICE: Libwebsockets version: 1.7.1 unknown-build-hash
[1592072122:3298] NOTICE: IPV6 not compiled in
[1592072122:3299] NOTICE: libev support not compiled in
[1592072122:3300] NOTICE: Threads: 1 each 1024 fds
[1592072122:3300] NOTICE: mem: platform fd map: 8192 bytes
[1592072122:3301] NOTICE: mem: per-conn: 376 bytes + protocol rx buf
[1592072122:3302] NOTICE: canonical_hostname = seleniumVM
[1592072122:3318] NOTICE: SSL ECDH curve 'prime256v1'
[1592072122:3323] NOTICE: LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS
[1592072122:3326] NOTICE: LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS
[1592072122:3326] NOTICE: LWS_CALLBACK_PROTOCOL_INIT
[1592072122:3327] NOTICE: LWS_CALLBACK_CHANGE_MODE_POLL_FD
[1592072122:3777] NOTICE: LWS_CALLBACK_LOCK_POLL
[1592072122:3778] NOTICE: LWS_CALLBACK_ADD_POLL_FD
[1592072122:3778] NOTICE: LWS_CALLBACK_UNLOCK_POLL
[1592072122:3779] NOTICE: LWS_CALLBACK_LOCK_POLL
[1592072122:3779] NOTICE: LWS_CALLBACK_CHANGE_MODE_POLL_FD
[1592072122:3779] NOTICE: LWS_CALLBACK_UNLOCK_POLL
[1592072122:3779] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:4032] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:4291] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:4550] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:4810] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:5069] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:5328] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:5582] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:5837] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:6090] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:6286] NOTICE: LWS_CALLBACK_LOCK_POLL
[1592072122:6286] NOTICE: LWS_CALLBACK_CHANGE_MODE_POLL_FD
[1592072122:6286] NOTICE: LWS_CALLBACK_UNLOCK_POLL
[1592072122:6287] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:6545] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:6676] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:6701] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:6954] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:7074] NOTICE: LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER
[1592072122:7075] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:7333] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:7584] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:7842] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:8101] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:8360] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:8611] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:8815] NOTICE: LWS_CALLBACK_LOCK_POLL
[1592072122:8815] NOTICE: LWS_CALLBACK_CHANGE_MODE_POLL_FD
[1592072122:8815] NOTICE: LWS_CALLBACK_UNLOCK_POLL
[1592072122:8815] NOTICE: LWS_CALLBACK_GET_THREAD_ID
[1592072122:8815] NOTICE: LWS_CALLBACK_LOCK_POLL
[1592072122:8815] NOTICE: LWS_CALLBACK_DEL_POLL_FD
[1592072122:8815] NOTICE: LWS_CALLBACK_UNLOCK_POLL
[1592072122:8815] NOTICE: WS_CALLBACK_CLIENT_CONNECTION_ERROR
[1592072122:8816] NOTICE: LWS_CALLBACK_WSI_DESTROY
Retval was 0
[1592072122:8816] NOTICE: lws_context_destroy
[1592072122:8817] NOTICE: LWS_CALLBACK_PROTOCOL_DESTROY

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.