Coder Social home page Coder Social logo

wapi's Introduction

WAPI - The WhatsApp API

Connect your project to WhatsApp!

Installation

First, add the JitPack repository to your POM:

<repository>
	<id>jitpack.io</id>
	<url>https://jitpack.io</url>
</repository>

Then, add the following dependency to your POM:

<dependency>
	<groupId>com.github.ben221199</groupId>
	<artifactId>WAPI</artifactId>
	<version>master</version>
</dependency>

Usage

Verification

import nl.ben221199.wapi.Verification;

public class VerificationExample{

	public static void main(String... args){
		String userAgent = "";
		boolean encrypted = true;

		//Check if account already exists
		String[] existParams = {};
		Verification.exist(userAgent,encrypted,existParams);

		//Request code
		String[] codeParams = {};
		Verification.code(userAgent,encrypted,codeParams);

		//Register account using code
		String[] registerParams = {};
		Verification.register(userAgent,encrypted,registerParams);
	}

}

Connection

import com.whatsapp.proto.WA4Protos;
import java.security.KeyPair;
import java.security.PublicKey;
import nl.ben221199.wapi.Connection;

public class ConnectionExample{

	public static void main(String... args){
		//Connection arguments
		byte[] edge_routing_info = null;
		KeyPair client_static_keypair = null;
		PublicKey server_static_key = null;
		WA4Protos.ClientPayload payload = null;

		//Create connection
		Connection conn = new Connection("g.whatsapp.net",443)
			.setEdgeRoutingInfo(edge_routing_info)
			.setS(client_static_keypair)
			.setRS(server_static_key)
			.setPayload(payload);

		//Start connection
		conn.start();

		//Get IO
		FunInputStream in = conn.getInputStream();
		FunOutputStream out = conn.getOutputStream();
	}

}

wapi's People

Contributors

ben221199 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wapi's Issues

Exception in thread "main" java.lang.NullPointerException

        //Connection arguments
        byte[] edge_routing_info = null;
        KeyPair client_static_keypair = null;
        PublicKey server_static_key = null;
        WA4Protos.ClientPayload payload = null;

        //Create connection
        Connection conn = new Connection("g.whatsapp.net",443)
                .setEdgeRoutingInfo(edge_routing_info)
                .setS(client_static_keypair)
                .setRS(server_static_key)
                .setPayload(payload);

        //Start connection
        conn.start();

        //Get IO
        FunInputStream in = conn.getInputStream();
        FunOutputStream out = conn.getOutputStream();

Exception in thread "main" java.lang.NullPointerException
at nl.ben221199.wapi.Connection.doHandshakeXX(Connection.java:110)
at nl.ben221199.wapi.Connection.doHandshake(Connection.java:79)
at nl.ben221199.wapi.Connection.start(Connection.java:67)
at WaConnectTest.main(WaConnectTest.java:31)

我不知道该怎么办了

need help: "Unsupported parameter: javax.crypto.spec.IvParameterSpec"

I got the following error
java.security.InvalidAlgorithmParameterException: Unsupported parameter: javax.crypto.spec.IvParameterSpec@4667ae56 at java.base/com.sun.crypto.provider.CipherCore.init(CipherCore.java:520) at java.base/com.sun.crypto.provider.AESCipher.engineInit(AESCipher.java:346) at java.base/javax.crypto.Cipher.implInit(Cipher.java:871) at java.base/javax.crypto.Cipher.chooseProvider(Cipher.java:929) at java.base/javax.crypto.Cipher.init(Cipher.java:1444) at java.base/javax.crypto.Cipher.init(Cipher.java:1375) at nl.ben221199.wapi.Verification.encryptParameters(Verification.java:175)

Here is the data I captured to whatsapp server, can you check and analyze it?

Here is the data I captured to whatsapp server, can you check and analyze it?
All bytes in HEX format
First communication
45 44 00 01
00 00 04
08 0D 08 02
57 41 04 02
00 01 18 12 95 02 0A 20 C8 F6 07 9E 9D B2 FD 99 74 32 9B 1A 7C B6 BE 9C E9 B6 00 1C D0 B5 07 2B 95 BD 59 A6 54 58 C1 2F 12 30 ED 87 28 C9 C3 70 87 16 EF 0B 1E 70 16 D0 CE DD 0C D3 67 62 F9 7E 45 E0 87 09 3B B6 38 4D C2 A8 41 05 22 A2 9F F6 8D 16 E1 9D 4F 62 58 26 20 66 1A BE 01 AC BA FD 49 F2 77 35 DD 3A A8 94 80 E2 CB 3D CE 11 2C 0C 48 A3 B3 1D 03 20 77 34 FE CD A9 93 79 6F EC 7C FD A4 6F 05 76 48 D2 29 1F 70 55 B4 6B A3 B4 F4 8E 65 94 0B 3B 8E E1 0A 2B 96 FD E0 9E 5A 83 DB 81 09 A7 9D 6F 0A A5 27 5F AB 24 45 A8 89 C0 F3 82 E3 D0 05 D0 61 D1 12 89 30 E2 33 49 73 11 F4 65 49 D2 BE BE B2 CD A1 A0 2A 98 A5 5A F6 B7 96 5A 62 C4 28 60 ED 8A 75 CB 72 26 27 2E 62 96 E8 DB A1 2C 4F 08 E3 0D 2F CB 34 59 CD CE FA 7A 30 F4 33 51 21 E5 67 7A 02 49 2E A8 08 91 43 47 35 AB 82 CB 4B 21 DB 9F EB 12 0D 16 2E 80 64 AE A1 5F CC 83 09 C7 C7 99 E2 F4 57 E1

RECV:
00 00 36
1A 34 0A 20 7B 8D 3E F3 D4 50 36 42 FF 95 39 6D DC 8E E4 29 14 23 01 75 7A AB EF A2 CF 28 23 46 2A ED FC 4C 1A 10 D6 9C 55 25 EB 47 87 C2 0B BE 3E B5 42 01 C4 13
00 00 36
E8 B8 06 5E B1 08 A6 5D 0A 0D E3 8E 85 FB 99 94 D6 B7 8C 93 A1 69 1B C0 36 09 C1 8C 4E 49 BE EB C4 58 9B 1B 2B 44 0C 64 D8 A7 3F 27 00 99 5B 65 B4 CB 5B A7 78 6C
00 00 2B
25 BF 07 E3 34 A1 79 FC D4 BD 42 16 D0 F3 79 8D 6A 4C DD 64 F1 50 04 03 A6 8F 57 40 D1 8A 97 BF CB 29 DF 9F DB 6C 39 A1 95 58 CF
00 00 34
FE 27 D5 E1 D6 9E A5 8E C4 D4 69 0C FD 5F 2E 6D 1B 23 28 08 F2 74 13 8C 72 FA B2 9E 2D 9F D2 9B 7E 39 5D 0D 3F 42 2E 9D 91 E9 FD E1 5A 4A 32 6F 68 FC E7 D6

After my analysis, the first thing passed is Edge Routing Info, but I can't analyze more because I don't know how it is encrypted, if you have a way, I look forward to discussing with you

Chat-API issue

Hi @ben221199,

Saw your msg in Chat-API repo.

We can work on it together if you'd like. I personally prefer python to code in.

question

How to use it?
How can I contact you?

qrcode

hi, I would like to know if it is possible to recognize and scan a QR code without using a phone? is it even possible to implement this through code?

about dat file

Could you please let me know how to obtain the files like "wa4.proto.dat",and how to convert to proto files?
Thanks a lot !!!

Need new parameter 'backup_token'

I got bad_param of 'backup_token' error when use registeration api!
I have generate this parameter use the same way with Android app, but not work...
can you please give some help...

How to construct these parameters

byte[] edge_routing_info = null; KeyPair client_static_keypair = null; PublicKey server_static_key = null; WA4Protos.ClientPayload payload = null;

Cannot add dependency on WAPI

Am trying to add dependency on this pkg. My pom.xml looks like following. But artifact wapi cannot be resolved. Tried with other versions too.

Anything am doing wrong?


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.example</groupId>
  <artifactId>mywhatsappbot</artifactId>
  <version>1.0-SNAPSHOT</version>

  <repositories>
    <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>com.github.ben221199</groupId>
      <artifactId>libsignal-protocol-java</artifactId>
      <version>a58f85e3dd</version>
    </dependency>
    <dependency>
      <groupId>com.github.ben221199</groupId>
      <artifactId>wapi</artifactId>
      <version>master-SNAPSHOT</version>
    </dependency>
  </dependencies>

</project>

use Connection API receive 401

hi,@ben221199 Thks for your nice work on WAPI,I use the api to connect wa server ,after the doHandshakeXX method,I received a 401 message from server ,I use funInput readNode method then to xml i got the result 'failure location="rva" reason=401 ',I tried change the payload data ,header prologue,EdgeRouting data ,but the problom persists,any suggust ? wait for your reply,thank you so much

solved,my mistake,I put the wrong keypair

Registration not working, bad_param token.

Hi,
I'm trying to use WAPI for registration but got this message when calling the "code" function.
"{"login":"201111111111","param":"token","reason":"bad_param","status":"fail"}".
Any solutions?

hi,sir! how to decrpt this kind of keystore.xml item from andorid device?

hi,sir! Thanks for your greate job!
but i encounter this problem:
in the keystore.xml form andrid, I found this keypair value, but i can't find any method to decrpt it:

[0,"7gSHycMPx28u1rgRr+/YpSgWxHaOg+2Ckog9OJQ+9n9JAPXb/go0FoBvYvp57NagOg31Dq3a1PejtmSXEtZ5dM/MW7V9WZYecLrfe86wjgc","+vMax4iwA+csF/k5"]

any one has some tips will be greate apreciated!

thanks a lot!

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.