GithubHelp home page GithubHelp logo

Client delivery report about whatsapi HOT 16 CLOSED

venomous0x avatar venomous0x commented on July 27, 2024
Client delivery report

from whatsapi.

Comments (16)

cdesjardins avatar cdesjardins commented on July 27, 2024

If someone could just make an unencrypted/decrypted capture of the client delivery report message from the recipient phone to the whatsapp server and send it to me then I will write the code myself. Or if someone knows a good way to capture the data myself, I will do my own captures as well. Unfortunately I have not figured out a way to sniff whatsup traffic from real phones or emulators.
Thanks!

from whatsapi.

xTraXx avatar xTraXx commented on July 27, 2024

Don't know if there is something like wireshark for iPhone?

from whatsapi.

cdesjardins avatar cdesjardins commented on July 27, 2024

I am using android and I have run TCPdump on my phone already, but all of the messages of interest are encrypted.

from whatsapi.

cdesjardins avatar cdesjardins commented on July 27, 2024

I finally figured it out, for the client delivery message, the format is as follows:
0x00, [total msg length], 0xf8, 0x08, 0x5d, 0xa0, 0xfa, 0xfc, [Number Length], [UTF8 to number], 0x8a, 0xa2, 0x1b, 0x43, 0xfc, [id length], [UTF8 msg ID], 0xf8, 0x01, 0xf8, 0x03, 0x7f, 0xbd, 0xad,

Where the UTF8 to number is the phone number that you are responding to, and the UTF8 message ID is the same message ID that you are responding to. Unfortunately I do not have time to code this up right now, but I thought I would post this info along in case someone else wants to add it.

from whatsapi.

xTraXx avatar xTraXx commented on July 27, 2024

Are you sure this is correct? (I can't get it to work)

from whatsapi.

cdesjardins avatar cdesjardins commented on July 27, 2024

Yup, here is a full dump:

0x00, 0x2c, 0xf8, 0x08, 0x5d, 0xa0, 0xfa, 0xfc, 0x0b, 0x31, 0x39, 0x31, 0x39, 0x31, 0x32, 0x33,   .,..]....1919123
0x34, 0x35, 0x36, 0x37, 0x8a, 0xa2, 0x1b, 0x43, 0xfc, 0x0d, 0x31, 0x31, 0x31, 0x32, 0x32, 0x32,   4567...C..111222
0x33, 0x33, 0x33, 0x33, 0x2d, 0x31, 0x30, 0xf8, 0x01, 0xf8, 0x03, 0x7f, 0xbd, 0xad,               3333-10....⌂..

Where 19191234567 is the phone number that I want to send the ack to, and 1112223333-10 is the message ID from the message that person just sent me. I have a test project in c# that does this and I get the double check marks every time. I cannot post the code unfortunately.

from whatsapi.

xTraXx avatar xTraXx commented on July 27, 2024

Oke, then I'll try again.

from whatsapi.

xTraXx avatar xTraXx commented on July 27, 2024

function MessageReceived($msg_length,$to_length,$to,$msgid_length,$msgid){
$content = "\x00$msg_length";
$content .= "\xf8\x08\x5d\xa0\xfa\xfc$to_length";
$content .=$to;
$content .= "x8a\xa2\x1b\x43\xfc$msgid_length";
$content .= $msgid;
$content .= "\xf8\x01\xf8\x03\x7f\xbd\xad";
$this->send($content);
}

What am I doing wrong? (Normally I don't work with php, so maybe a dumb mistake?)

from whatsapi.

cdesjardins avatar cdesjardins commented on July 27, 2024

I think you are doing the lengths wrong, for example the msg_length is typically computed like this:

$msg_length = hex2str(_hex(strlen($content)));

There are also some places where they do this:

$to_length = chr(mb_strlen($to,"UTF-8"));

It is not clear if you are doing that or not.

Here is a function I wrote to debug this type of stuff:

public function printhexstr($data, $name)
{
    $len = strlen($data);
    print("Len: $len - $name\n");
    for ($i = 0; $i < $len; $i++)
    {
        print(" ". dechex(ord($data[$i])));
        if (($i % 16) == 15)
        {
            print("\n");
        }
    }
    print("\n");
}

To see what you are really sending just call:

printhexstr($context, "message rx");

from whatsapi.

xTraXx avatar xTraXx commented on July 27, 2024

I just took the length which I receive.

$msg = $this->parse_received_message($v);
echo json_encode($msg); // Do something with the message here ?

    $this->MessageReceived($msg['length'],$msg['from_number_length'],$msg['from_number'],$msg['message_id_length'],$msg['message_id']);

from whatsapi.

cdesjardins avatar cdesjardins commented on July 27, 2024

OK, I just pushed the php up in my fork, feel free to merge it wherever.

from whatsapi.

xTraXx avatar xTraXx commented on July 27, 2024

Thx, it's working now :D

from whatsapi.

cdesjardins avatar cdesjardins commented on July 27, 2024

Just for the record, the issues were:
On one line you didn't have x8a escaped.
The message length is supposed to be the message length of the message you are sending, not the one you are acking.

from whatsapi.

xTraXx avatar xTraXx commented on July 27, 2024

Oh oke, I see hehe.

from whatsapi.

xTraXx avatar xTraXx commented on July 27, 2024

BTW, did you port this API to C# or do you use this API (PHP) with C#?

from whatsapi.

eslamo avatar eslamo commented on July 27, 2024

Hello,

Can u please provide us with the full php code to add into our file and get it working ..

from whatsapi.

Related Issues (20)

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.