Auties00 / Cobalt

Standalone unofficial fully-featured Whatsapp Web and Mobile API for Java and Kotlin
MIT License
625 stars 183 forks source link

CAPTCHA is not handled correctly #371

Closed wangxingge closed 8 months ago

wangxingge commented 1 year ago

I use local stored keys.smile and stores.smile file to logon, but i found my socket is not connected. I use wireshark to track socket data, i found server send fin ack to my client.

my code as following: ` public static void main(String[] args) throws InterruptedException, ExecutionException, TimeoutException { MobileTest rt = new MobileTest(); // rt.createApi(); rt.createApiByUUID(UUID.fromString("eeaa936b-6562-45fd-a9ed-ab29838b37b4")); api.connectAwaitingLogout(); latch = new CountDownLatch(3);

    rt.log("store: %s", api.store().toJson());
    rt.log("keys: %s", api.keys().toJson());
    rt.log("Connected:%s", api.isConnected());

    // test send message
    Chat chat = Chat.ofJid(ContactJid.of("__my_phone_no___"));
    api.sendMessage(chat, TextMessage.of("Hi,here is from test message!")).thenApply(messageInfo -> messageInfo.message());
    api.store().contacts().forEach(contact -> System.out.println(contact));
    List<Chat> chats = api.socketHandler().store().chats();
    chats.forEach(chat1 -> System.out.println(chat1));

    latch.await();
    rt.log("All threads have finished.");
}

` my wireshark screenshot as following: image

can you help me to figure out the reason? or is there any document to describe whatsapp risk rule?

wangxingge commented 1 year ago

and i always get response from whatsapp server following mesage. VerificationCodeResponse[number=my_mobile_no, lid=0, status=ERROR, errorReason=CAPTCHA, method=null, codeLength=0, notifyAfter=0, retryAfter=0, voiceLength=0, voiceWait=0, smsWait=0, whatsappOtpWait=0, flashType=0, oldWait=0, securityCodeSet=false, whatsappOtpEligible=false, imageCaptcha=null, audioCaptcha=null]

how to login android when this no already logon my iphone client.

wangxingge commented 1 year ago

after register, i use following code to get my last connection.

        api = Whatsapp.mobileBuilder()
                .lastConnection()
                .registered()
                .get()
                .addListener(this);
    future = api.connectAwaitingLogout();

i found socket fire an event readMessage(), and this message was server fin request.

is that means the server address and server port should be change?? current address and port is hardcode in static class Whatsapp.

    public static final String APP_ENDPOINT_HOST = "g.whatsapp.net";
    public static final int APP_ENDPOINT_PORT = 443;
Auties00 commented 1 year ago

I use local stored keys.smile and stores.smile file to logon, but i found my socket is not connected. I use wireshark to track socket data, i found server send fin ack to my client.

my code as following: ` public static void main(String[] args) throws InterruptedException, ExecutionException, TimeoutException { MobileTest rt = new MobileTest(); // rt.createApi(); rt.createApiByUUID(UUID.fromString("eeaa936b-6562-45fd-a9ed-ab29838b37b4")); api.connectAwaitingLogout(); latch = new CountDownLatch(3);

    rt.log("store: %s", api.store().toJson());
    rt.log("keys: %s", api.keys().toJson());
    rt.log("Connected:%s", api.isConnected());

    // test send message
    Chat chat = Chat.ofJid(ContactJid.of("__my_phone_no___"));
    api.sendMessage(chat, TextMessage.of("Hi,here is from test message!")).thenApply(messageInfo -> messageInfo.message());
    api.store().contacts().forEach(contact -> System.out.println(contact));
    List<Chat> chats = api.socketHandler().store().chats();
    chats.forEach(chat1 -> System.out.println(chat1));

    latch.await();
    rt.log("All threads have finished.");
}

` my wireshark screenshot as following: image

can you help me to figure out the reason? or is there any document to describe whatsapp risk rule?

Add a onNodeReceived and onNodeSent listener and send here the logs

Auties00 commented 1 year ago

and i always get response from whatsapp server following mesage. VerificationCodeResponse[number=my_mobile_no, lid=0, status=ERROR, errorReason=CAPTCHA, method=null, codeLength=0, notifyAfter=0, retryAfter=0, voiceLength=0, voiceWait=0, smsWait=0, whatsappOtpWait=0, flashType=0, oldWait=0, securityCodeSet=false, whatsappOtpEligible=false, imageCaptcha=null, audioCaptcha=null]

how to login android when this no already logon my iphone client.

This is the actual reason

wangxingge commented 1 year ago

I use local stored keys.smile and stores.smile file to logon, but i found my socket is not connected. I use wireshark to track socket data, i found server send fin ack to my client. my code as following: ` public static void main(String[] args) throws InterruptedException, ExecutionException, TimeoutException { MobileTest rt = new MobileTest(); // rt.createApi(); rt.createApiByUUID(UUID.fromString("eeaa936b-6562-45fd-a9ed-ab29838b37b4")); api.connectAwaitingLogout(); latch = new CountDownLatch(3);

    rt.log("store: %s", api.store().toJson());
    rt.log("keys: %s", api.keys().toJson());
    rt.log("Connected:%s", api.isConnected());

    // test send message
    Chat chat = Chat.ofJid(ContactJid.of("__my_phone_no___"));
    api.sendMessage(chat, TextMessage.of("Hi,here is from test message!")).thenApply(messageInfo -> messageInfo.message());
    api.store().contacts().forEach(contact -> System.out.println(contact));
    List<Chat> chats = api.socketHandler().store().chats();
    chats.forEach(chat1 -> System.out.println(chat1));

    latch.await();
    rt.log("All threads have finished.");
}

` my wireshark screenshot as following: image can you help me to figure out the reason? or is there any document to describe whatsapp risk rule?

Add a onNodeReceived and onNodeSent listener and send here the logs

thanks for your response, i'll update code and test it.

Auties00 commented 8 months ago

Captcha is no longer necessary