Giter Club home page Giter Club logo

wa-tunnel's Introduction

wa-tunnel - TCP Tunneling through Whatsapp

This is a Baileys based piece of code that lets you tunnel TCP data through two Whatsapp accounts.

This can be usable in different situations, for example network carriers that give unlimited whatsapp data or airplanes where you also get unlimited social network data.

It's using Baileys since it's a WS based multi-device whatsapp library and therefore could be used in android in the future, using Termux for example.

The idea is to use it with a proxy setup on the server like this: [Client (restricted access) -> Whatsapp -> Server -> Proxy -> Internet]

Apologizes in advance since Javascript it's not one of my primary coding languages :/

Use only for educational purpose.

How does it work?

It sends TCP network packages through WhatsApp text and file messages, depending on the amount of characters it splits them into different text messages or files.

To not get timed out by WhatsApp by default it's limited at 20k characters per message, at the moment it's hardcoded in wasocket.js. I have done multiple tests and anything below that may get you banned for sending too many messages and any above 80k may timeout.

If a network package is over the limit (20k chars by default) it will be sent as a file if enabled. Also if multiple network packages are cached it will use the same cryteria.

File messages are sent as binary files, TCP responses are concatenated with a delimiter and compressed using brotli to reduce data usage.

It caches TCP socket responses to group them and send the maximum amount of data in a message therefore reducing the amount of messages, improving the speed and reducing the probability of getting banned.

Performance improvements

Before: (without files and no response caching)

curl -x localhost:12345 https://www.youtube.com
- 50-80 messages
- 30-40 seconds

After: (with files and response caching)

curl -x localhost:12345 https://www.youtube.com
- 6-8 messages
- 7-15 seconds

In case you are not allowed to send files use the --disable-files flag when starting the server and client to disable this functionality.

Why?

I got the idea While travelling through South America network data on carriers is usually restricted to not many GBs but WhatsApp is usually unlimited, I tried to create this library since I didn't find any usable at the date.

Setup

You must have access to two Whatsapp accounts, one for the server and one for the client. You can forward a local port or use an external proxy.

Server side

Clone the repository on your server and install node dependencies.

  1. cd path/to/wa-tunnel
  2. npm install

Then you can start the server with the following command where port is the proxy port and host is the proxy host you want to forward. And number is the client WhatsApp number with the country code alltogether and without +.

npm run server host port number

You can use a local proxy server like follows:

npm run server localhost 3128 12345678901

Or you can use a normal proxy server like follows:

npm run server 192.168.0.1 3128 12345678901

Client Side

Clone the repository on your server and install node dependencies.

  1. cd path/to/wa-tunnel
  2. npm install

Then you can start the server with the following command where port is the local port where you will connect and number is the server WhatsApp number with the country code alltogether and without +.

npm run client port number

For example

npm run client 8080 1234567890

Usage

The first time you open the script Baileys will ask you to scan the QR code with the whatsapp app, after that the session is saved for later usage.

It may crash, that's normal after that just restart the script and you will have your client/server ready!

Once you have both client and server ready you can test using curl and see the magic happen.

curl -v -x proxyHost:proxyPort https://httpbin.org/ip

With the example commands would be:

curl -v -x localhost:8080 https://httpbin.org/ip

It has been tested also with a normal browser like Firefox, it's slow but can be used.

You can also forward other protocol ports like SSH by setting up the server like this:

npm run server localhost 22 12345678901

And then connect to the server by using in the client:

ssh root@localhost -p 8080

Usage on Android

To use on Android, you can use it with Termux using the following commands:

pkg update && pkg upgrade
pkg install git nodejs -y
git clone https://github.com/aleixrodriala/wa-tunnel.git
cd wa-tunnel
npm install

Disclaimer

Using this library may get your WhatsApp account banned, use with a temporary number or at your own risk.

TO-DO

  • Make an Android script to install node dependencies on termux
  • When Baileys supports calls, implement package sending through calls
  • Implement sending files for big data packages to reduce messages and maybe improve speed
  • Cache socket responses to reduce even further the amount of messages sent
  • Documentation

License

MIT

wa-tunnel's People

Contributors

aleixrodriala avatar timoteostewart 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wa-tunnel's Issues

Error ubuntu 22.04 npm run server host port number

/home/ubuntu/wa-tunnel/node_modules/on-exit-leak-free/index.js:11
const registry = new FinalizationRegistry(clear)
^

ReferenceError: FinalizationRegistry is not defined
at Object. (/home/ubuntu/wa-tunnel/node_modules/on-exit-leak-free/index.js:11:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/home/ubuntu/wa-tunnel/node_modules/pino/lib/tools.js:8:16)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

"405 Method not Allowed" while launching server

When I attempt to execute npm run server localhost 8123 1XXXXXXXXXX, I receive the following:

> [email protected] server
> node src/server.js localhost 8123 1XXXXXXXXXX

[20:09:46.801] INFO (2300): connection update {"connection":"connecting","receivedPendingNotifications":false}
[20:09:51.414] INFO (2300): connection update {"connection":"close","lastDisconnect":{"error":{"data":{"reason":"405","location":"odn"},"isBoom":true,"isServer":false,"output":{"statusCode":405,"payload":{"statusCode":405,"error":"Method Not Allowed","message":"Connection Failure"},"headers":{}}},"date":"2023-10-10T20:09:51.400Z"}}

The phone number is registered with WhatsApp, and I can send messages to it via a different WhatsApp address.

I expected to see a QR code during the first run. Did I do something wrong? Any other thoughts about how to debug the issue?

Authentication

It seems dangerous to leave this running on open internet.
Any plan on supporting some kind of authentication?

Using http injector for tunneling

I'm not exactly an expert on how it works but if you're on a WhatsApp only data plan. You can use the http injector app in the playstore to connect to a proxy server and get internet connection. It set's up a VPN.

I have seen this working pretty great having or 2Mbs. It avoids ISP speed restrictions too but I still don't know how it works. The payloads they use in the app are very secured and encrypted. Haven't able to peak how it works. Maybe I can get some info about how it works.

iPerf3 test

Hi,
would it be possible to show iPerf3 test output? I know it depends on lot of factors but just to give an idea about the throughput, latency ...

Crash: connection closed

I run this manually. Run curl and get error:

[alex@hard wa-tunnel]$ curl -v -x localhost:8080 https://httpbin.org/ip
*   Trying 127.0.0.1:8080...
* connect to 127.0.0.1 port 8080 failed: В соединении отказано
*   Trying [::1]:8080...
* Connected to localhost (::1) port 8080 (#0)
* allocate connect buffer
* Establish HTTP proxy tunnel to httpbin.org:443
> CONNECT httpbin.org:443 HTTP/1.1
> Host: httpbin.org:443
> User-Agent: curl/7.87.0
> Proxy-Connection: Keep-Alive
> 
* Proxy CONNECT aborted
* Closing connection 0
curl: (56) Proxy CONNECT aborted

And wa-tunnel client crash:

[alex@hard wa-tunnel]$ npm run client 8080 123

> [email protected] client
> node src/client.js 8080 905411980390

[01:01:14.313] INFO (21171): connection update {"connection":"connecting","receivedPendingNotifications":false}
[01:01:14.323] INFO (21171): TCP Server is running on port 8080.
[01:01:15.841] INFO (21171): connection update {"qr":"2@8bc9AhH5lYMUjji85deLNi0hUUnEE+5PzlU91kmSvN8KE/uPfpKw8zDrL+Ads0kGkcRP7/sggz6faw==,dkRFmHvVrVNF0iJlDE18002zKymHyJKH2flXUd3qd3U=,SR7P34i3i2o3tVgbSbSqvhHlG/hjensFgv+1csUowAI=,Rc0rYC3rIB6aHw4/NCM4ooRJQmKwYEOx4UQKVM6PCSU="}
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▀▀▀▄▀ ▀▄█▄▄▄▀▄█    ▄▄ ▄▀███   █▄▀  ▀██ ▄▄▄▄▄ █
█ █   █ █▀█▀▄▄ █ ▀  ▄▀▄█▄█▄█▀▄▀▀ █▄▀▀▀▄▄▄▄█▀▄▀█ █   █ █
█ █▄▄▄█ █▀▀██▀▀▀███ ▄█  ▄ ▄▄▄ ▄ █▄█▀▄ ▄█ ▀  ███ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄▀▄█▄█ ▀ █ █▄█ █ █▄█ █ █ ▀▄▀▄▀▄▀ █▄▀ █▄▄▄▄▄▄▄█
█ ▄▄▄ █▄▄   █▄▄▄▄▀▄ ▄▄█▀▀▄ ▄  ▄▀ █▄█ ▄▄█▀▀▄ ▀▄▄█ ▀ █ ▀█
█ ▄  ▀ ▄▀ █▀  █▄▄ ██ ▀▄ ▀▀ ▄ █▄▀▀▀ ▄ █ ▄ ▄▄▀▀  ▄   █▀▀█
█▄ █▄▄▄▄▄▀█▀▀█ ▀█▄▄▄▄▄██▄ ▀ █▀▄▀▄██▄▀▄▄▄▀█ ▀▀▄ ▄ ▄█▄▄██
█▀█ ▄▄▀▄ █  █▄▀█▀ ▀▄▀▄█▀█▀▀▄█▀▄▀███████ ▄ ▄▀█▄▀ ▀ ▄▄▀██
█  ██ █▄██▀  ▄▀█▀█  ▀███ ▄▀██ ▀  ▀▄▄▀ ▄█▀█▀ ▀█▄▄   ▄  █
██▀▄ ▄ ▄ █▀█▄▄▀▄▀█▄▀▀▄ ▀   ▄▄▀█▀▀ █▄▄▄   ▀▀▀▀▀▄▄ ▀██▀██
█▄▄▄▀▀▄▄██ ▄▀▄▄█▄█▄ ▀█▀███▄▄▀▀ ▀▀▀███▄ ▄▀▀▀ ▄▄█▄▄ ▄ ▄▄█
█▀▀█▀█ ▄▀██ █ ▄   ▀▄▀ ▄▄▄▀ ▄▄▀▄██▀ ▄▄ █▄██▄▄▄▀▀▀▄▀ █▀██
█▄ █▄ ▄▄▄ █ ██▄▄▄▀   █▀█▄ ▄▄▄  ▀██▄█ ▄ ███▀ █ ▄▄▄ ███ █
█████ █▄█ ██▄▀█ ▄ ▄ ▄ ▀▀  █▄█ █ ▄ ▄▀▀██ █▀  ▄ █▄█  ▄ ██
█▀▄▄█ ▄▄▄ ▄█ ▄▄██▄▄ ▀█▀▀█▄▄▄▄▄▀▀▄▀█▄ ▄▀███▀▀▄     ▄▄ ▀█
██▄█ █▀▄ █  █▀▀█ ▄  ▀▄██▀ █ █▄▀ ██▀ ▄ █ ▄▀▀▀▀▀▀▀▄▄ █▀▀█
██▀█▄▀▄▄▀ ██▄▄▀█▀█▀▄▀█▀█▀▀▀▀ ▀ ▀▄▀█▄▄  ▄▄▀  ▀▄ ██▀█▄▀██
█▀ ▀ █▄▄▀ ▀█ ▄▀ ▀█  ▄██▄▀█ ▄▀▄██▀██▄███ ▄   ▀▀▄▀ ▄ █▀▀█
█▀▄  ▄▀▄█ █▄▀▀▄█▀▄▀▄ █▀███▀▀ █  ▄██▄▄▄▀▄█▀ ▀█▀▄▄  █  ▀█
█▀ ▀ ▄█▄  ▄▀█ ▄  █ ▀█▄█ ▀█▄▀▄██▄  ▄█ ▄▀  ▀▀▀▀▄▄▀▀▄▀█▀▀█
█▀▄▄  █▄ ▀██ █▄▄▄▀█  ██▀ █▄▀▀█ ▀▄█▀▄█▄ █▄█  █▄▄▀▄▀▀█▄▀█
█▄ ▀▄▄▄▄▄    ▄  ▄ ▀  █ ▄█▀▄████▀▄▀▀▄▄▀ ████▀ ▀▄▀  ██▄██
████▄██▄█ ▄█▀▄▄▄▀▄▀▄ ▄█▀█ ▄▄▄ █▀▀███ ▄ █▀▀▀▀▀ ▄▄▄ ▄ ▄ █
█ ▄▄▄▄▄ █▄ █ █▀█ █▄█▀▄ ▄  █▄█ ▄▀▄▄ ▀█ █▄ █ ▄▀ █▄█ ██ ██
█ █   █ █ ▀▄█▄██▀█▄▀ █▄▀▀▄ ▄   ▀▄▀▄█▄▄ ▄██▀▀█   ▄▄▄▄▄▄█
█ █▄▄▄█ █ ▀ ▄ █ ▀██▀▀█▀▀▄█▀▄ ▀  ▀ ▀  ▄  ▀▀█ ▄█ █   ▄▀▄█
█▄▄▄▄▄▄▄█▄██▄▄███▄█▄▄███▄▄█▄████████▄▄█▄██▄█▄██▄▄▄▄████

[01:01:27.257] INFO (21171): connection update {"isNewLogin":true}
[01:01:27.530] INFO (21171): connection update {"connection":"close","lastDisconnect":{"error":{"data":{"tag":"stream:error","attrs":{"code":"515"}},"isBoom":true,"isServer":true,"output":{"statusCode":515,"payload":{"statusCode":515,"error":"Unknown","message":"Stream Errored (restart required)"},"headers":{}}},"date":"2023-01-07T22:01:27.516Z"}}
[01:01:27.532] INFO (21171): connection update {"connection":"connecting","receivedPendingNotifications":false}
[01:01:28.325] INFO (21171): connection update {"qr":"2@KXkoUBfKN3z9c4clTwzG0svFB0XbQUyw4xyiueFJQu6tnZdGf8plAgr0xJHsz19rbN92BnQLV6uKxw==,AS5NzZFUGv43wcCBO9HydByUCttYkrbT1DIHMaQxUgQ=,SWfOt7X33/ovF3bgnRbyGwqbWP+zZjRwMTPFROmSNSA=,GKV9qWgOra5M/4EZW3pdmLwTHSPY7Zq08ZIsUHOB0AA="}
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▀▄  ▄ ▄█ ▀▄    ▄ █▀█ ▄ ▄█  █▄  ▀▄▄ ▀██ ▄▄▄▄▄ █
█ █   █ █▄ █ ▄███ ██  ▄▄ ▄▄█ ▄▄▄▄▄▀ █▄▀▀██▄▀▄▀█ █   █ █
█ █▄▄▄█ █ ▄█▄ █▄ ██▄█▄ █▄ ▄▄▄  ▄▀▄ █▀██  █  ███ █▄▄▄█ █
█▄▄▄▄▄▄▄█ ▀▄█▄█ █ ▀ ▀▄▀ ▀ █▄█ ▀ ▀ █ ▀ █ █▄▀▄▀ █▄▄▄▄▄▄▄█
█ ▄█▄▀█▄▄██  ▄ ▄█ ▄ ██▄▄▄ ▄ ▄▄ █ █▄█▀ ▄█ ▄██▄▄█▄▄▄█  ▀█
█▀▄ ▄▄█▄█▀▄▄ █▄▀█ ▀  ▄█▀ ▄▄ ▄█ █▄██ ██▄▀▄▀ █  █▄▀██  ██
█▄██▄█▀▄█▄ ▀█▀▄ ▄▀ ▄ ██▄▀  ▄▄ ▄██ ▄▀ ▄ █▄▄██▀█▄▀▄ █▀▀▀█
████   ▄█▀▀  ▄██ █ ▄ ▄██ █ ▄   █ ███▄▄ ▀▄ ▄▄▄ ▀█▄ ▄▄ ▄█
█▄▀  ▀▀▄█▄▀█ ▀▄  █▄▄▄ █▀  █▀ ▄▄▄▀▄▀▄▄ █ █▀▀█▀▀ ▄█  ▀█▄█
█▀  ▀ ▄▄█▄█▀ ▄▀▀  ▀  ▄▄ █▄██  ▄█▀█▄█▄█▄█▄▄█▄ █▄▀██ ▄▄▄█
█ ▄ ▀█▄▄▀ ▀ █ ▄▀█▄▀▄ ▄ ▄▄▄ ▄  ██▄▀▄▄▀▄▀█▄  █▀▄██▀▄▄▀▀██
█▄█   ▄▄██▄ ██▀█▄█▀▄▄ ▄▀▄██▀ ▀█  ▀ ▀▄ ▄▀▄▀ █▀▀██ ▀█▀▄██
█  ▀█ ▄▄▄ ▀  ▄▄██▄ ▄ ▄▄   ▄▄▄ ▄▄▄▄█  ▄ ▄▄ ███ ▄▄▄ ▄▄▀▀█
██ ▄█ █▄█ ▄ ▄▄▀▀█▀█▀ ▄ ▀█ █▄█ █▀▀▄ ██▄▀ ▀█ ▄  █▄█ ▄█ ▄█
█▄█▄▄▄ ▄ ▄▀▄  ▀▄▄█▀ ▀▀▄▀▄ ▄▄ ▄ ██▄▄▄ ▄█▀▄█ █▄  ▄ ▄█▀▀██
██ ▀█  ▄█▄▄█▀▄▀▄ ▄█▄▀█▀██▀▄  ▀ █  ▀ ▄▀ ███▀█ █ ▄ █ ▄  █
█ ██▀██▄▀██  ▀██ ▄▄ ▄▄▄ ▄█▄▀▄▀▄█ ██▄▀ ▄█▄▄ ██▄▄▀ █▀▀ ▄█
█▄▄▀▄██▄█▀ █ ▀ ▄ █▀█▀▄▀ ▀▀  ████  █ ▄▄ ▄▄▀▄█▄█▄▀  ▄  ▀█
█▀▄▀▀ ▄▄▀▄▄██▀ ▄▄▀ ▄ █▄ █▀▄ ▀▀██▄▄█▀▄ ▀█ ▄██▀▀█▄ █▄▄▀ █
██▄ ▄  ▄  █  ▀  ▀███▄▄█▄  ▄█▀█ █▄ ▄ █ ▄██▄ ██▄  ▄▀█▄▄▄█
█ ▀ ▀█▀▄▄▀▀▀█▄▀▀█▀█▄▄ █▀ ▀▀ ▄▀▀█ ▄██▀▄▄▀▄█▀▄   █▄█▄▀█▀█
█▄ ▀▄▄▄▄▄▀██▀█ ▀██▀██▀▀█▀▄▄▄ ▀▀▄█ ▀ ▄ █ ▀▄▄▄ ▀█▄ ▄ ▄█ █
████▄██▄▄ ▄▀ ▀█▀█▄█ ██ ▄▀ ▄▄▄ ▀▄██▄█▀ █▄  ██▀ ▄▄▄ █▄█▀█
█ ▄▄▄▄▄ █▄▄█▀▄ ▀██▄▀█ ▀█▀ █▄█  ▀██▀█▀  ████▀▄ █▄█ ▄▀▀██
█ █   █ █▀  ▀▀▀█   █ ▄█▄█▄ ▄▄ ▀█  ▄ ▄▄▀█ ▄█▄▀▄▄▄ ▄▀▄▄ █
█ █▄▄▄█ █▀▄▀███▀ ▄▄█▀▀  █▀▀ ▀███▄▀▀█▄▄ ▀█▄▄▀▄▀█▄█ ▄▄ ██
█▄▄▄▄▄▄▄█▄█▄▄▄▄▄█▄▄▄█▄▄█▄▄██▄█▄▄▄▄▄█▄▄▄█▄████▄▄████▄▄██

[01:02:07.380] INFO (21171): connection update {"isNewLogin":true}
[01:02:07.661] INFO (21171): connection update {"connection":"close","lastDisconnect":{"error":{"data":{"tag":"stream:error","attrs":{"code":"515"}},"isBoom":true,"isServer":true,"output":{"statusCode":515,"payload":{"statusCode":515,"error":"Unknown","message":"Stream Errored (restart required)"},"headers":{}}},"date":"2023-01-07T22:02:07.655Z"}}
[01:02:07.664] INFO (21171): connection update {"connection":"connecting","receivedPendingNotifications":false}
[01:02:09.218] INFO (21171): connection update {"connection":"open"}
[01:02:09.224] INFO (21171): connection update {"receivedPendingNotifications":true}
[01:02:43.435] INFO (21171): CONNECTED -> 37000
[01:02:43.437] INFO (21171): ACTIVE SOCKETS -> 37000
/home/alex/code/node/wa-tunnel/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:49
            throw new boom_1.Boom('Connection Closed', { statusCode: Types_1.DisconnectReason.connectionClosed });
                  ^

Error: Connection Closed
    at sendRawMessage (/home/alex/code/node/wa-tunnel/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:49:19)
    at sendNode (/home/alex/code/node/wa-tunnel/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:60:16)
    at Object.presenceSubscribe (/home/alex/code/node/wa-tunnel/node_modules/@adiwajshing/baileys/lib/Socket/chats.js:421:43)
    at sendData (/home/alex/code/node/wa-tunnel/src/wasocket.js:39:16)
    at Socket.<anonymous> (/home/alex/code/node/wa-tunnel/src/client.js:61:11)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
  data: null,
  isBoom: true,
  isServer: false,
  output: {
    statusCode: 428,
    payload: {
      statusCode: 428,
      error: 'Precondition Required',
      message: 'Connection Closed'
    },
    headers: {}
  }
}

Node.js v19.3.0

I think something with authorization. If I re-run the script, there will be an error:

[alex@hard wa-tunnel]$ npm run client 8080 123

> [email protected] client
> node src/client.js 8080 905411980390

[01:04:47.052] INFO (21280): connection update {"connection":"connecting","receivedPendingNotifications":false}
[01:04:47.062] INFO (21280): TCP Server is running on port 8080.
[01:04:50.719] ERROR (21280): connection closed
[01:04:50.721] INFO (21280): connection update {"connection":"close","lastDisconnect":{"error":{"data":{"reason":"401","location":"odn"},"isBoom":true,"isServer":false,"output":{"statusCode":401,"payload":{"statusCode":401,"error":"Unauthorized","message":"Connection Failure"},"headers":{}}},"date":"2023-01-07T22:04:50.718Z"}}
[01:05:08.717] INFO (21280): CONNECTED -> 45730
[01:05:08.718] INFO (21280): ACTIVE SOCKETS -> 45730
/home/alex/code/node/wa-tunnel/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:49
            throw new boom_1.Boom('Connection Closed', { statusCode: Types_1.DisconnectReason.connectionClosed });
                  ^

Error: Connection Closed
    at sendRawMessage (/home/alex/code/node/wa-tunnel/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:49:19)
    at sendNode (/home/alex/code/node/wa-tunnel/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:60:16)
    at Object.presenceSubscribe (/home/alex/code/node/wa-tunnel/node_modules/@adiwajshing/baileys/lib/Socket/chats.js:421:43)
    at sendData (/home/alex/code/node/wa-tunnel/src/wasocket.js:39:16)
    at Socket.<anonymous> (/home/alex/code/node/wa-tunnel/src/client.js:61:11)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
  data: null,
  isBoom: true,
  isServer: false,
  output: {
    statusCode: 428,
    payload: {
      statusCode: 428,
      error: 'Precondition Required',
      message: 'Connection Closed'
    },
    headers: {}
  }
}

Node.js v19.3.0

I restarted the script several times, always got a 401 error, I was unable to defeat it.

interesting to tunnelling without whatsapp

It's very interesting project, it should have alternative to make it work without whatsapp like using nats or another messaging

computer need to access website through phone ip while computer ip banned

ERROR Client! ERROR (3836): connect ECONNREFUSED ::1:3128 "errno": -4078,

Could you please help me?

Steps to reproduce:

  1. Execute: node src/server.js localhost 3128 PHONE_1
  2. Enter Whatsapp on PHONE_2 and scan QR code from POINT 1 (register it as server).
  3. Execute: node src/client.js 8080 PHONE_2
  4. Enter Whatsapp on PHONE_1 and scan QR code from POINT 3 (register it as client).
  5. Execute curl -v -x localhost:8080 https://httpbin.org/ip

Server log:

[16:12:15.681] INFO (3836): connection update {"connection":"connecting","receivedPendingNotifications":false}
[16:12:17.209] INFO (3836): connection update {"connection":"open"}
[16:12:17.267] INFO (3836): connection update {"receivedPendingNotifications":true}
[16:14:37.851] INFO (3836): RECIEVING [1] -> 58943
[16:14:37.852] INFO (3836): PROCESSING [1] -> 58943
[16:14:37.854] INFO (3836): RECIEVING [1] MESSAGES -> 58943
[16:14:37.855] INFO (3836): Socket NOT In list -> 58943
[16:14:37.856] INFO (3836): CHECKING BUFFER [1] -> 58943
[16:14:37.857] ERROR (3836): ERROR Client!
[16:14:37.858] ERROR (3836): connect ECONNREFUSED ::1:3128
    err: {
      "type": "Error",
      "message": "connect ECONNREFUSED ::1:3128",
      "stack":
          Error: connect ECONNREFUSED ::1:3128
              at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16)
      "errno": -4078,
      "code": "ECONNREFUSED",
      "syscall": "connect",
      "address": "::1",
      "port": 3128
    }

Client log:

[16:13:49.945] INFO (33176): connection update {"connection":"connecting","receivedPendingNotifications":false}
[16:13:49.953] INFO (33176): TCP Server is running on port 8080.
[16:13:51.520] INFO (33176): connection update {"connection":"open"}
[16:13:51.649] INFO (33176): connection update {"receivedPendingNotifications":true}
[16:14:36.762] INFO (33176): CONNECTED -> 58943
[16:14:36.763] INFO (33176): ACTIVE SOCKETS -> 58943
[16:14:36.764] INFO (33176): SENDING [0][1/1][276] -> 58943

Tried differnet methods:
Windows 11 as Client and server same time
Android as Client and server same time
Windows 11 as Client and Android as server
Android as Client and Windows 11 as server

Alternative method

I find this project concept very interesting and it sparked an idea of using dialup over WhatsApp calls.

error 401

Why am I getting this error when I run the server.js script?
[16:05:53.215] INFO (1271): connection update {"connection":"connecting","receivedPendingNotifications":false}
[16:05:55.923] ERROR (1271): connection closed
[16:05:55.925] INFO (1271): connection update {"connection":"close","lastDisconnect":{"error":{"data":{"reason":"401","location":"cln"},"isBoom":true,"isServer":false,"output":{"statusCode":401,"payload":{"statusCode":401,"error":"Unauthorized","message":"Connection Failure"},"headers":{}}},"date":"2022-12-08T16:05:55.922Z"}}

ReferenceError: FinalizationRegistry is not defined

when i try run the server side

abdo@abdo:~/wa-tunnel$ sudo node server.js 192.168.0.1 3128 2129*******
[sudo] password for abdo:
/home/abdo/wa-tunnel/node_modules/on-exit-leak-free/index.js:11
const registry = new FinalizationRegistry(clear)
                 ^

ReferenceError: FinalizationRegistry is not defined
    at Object.<anonymous> (/home/abdo/wa-tunnel/node_modules/on-exit-leak-free/index.js:11:18)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/abdo/wa-tunnel/node_modules/pino/lib/tools.js:8:16)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

UnhandledPromiseRejectionWarning: ReferenceError: btoa is not defined

(node:93625) UnhandledPromiseRejectionWarning: ReferenceError: btoa is not defined
    at encode (/Users/me/workspace/wa-tunnel/node_modules/uint8-to-base64/cjs/index.js:8:3)
    at sendData (/Users/me/workspace/wa-tunnel/src/wasocket.js:37:26)
    at Socket.<anonymous> (/Users/me/workspace/wa-tunnel/src/client.js:61:11)
    at Socket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:293:12)
    at readableAddChunk (internal/streams/readable.js:267:9)
    at Socket.Readable.push (internal/streams/readable.js:206:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:93625) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:93625) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

node: v14.21.3
npm: 6.14.18

Hey, would you please implement more than one acc?

Hey man, good work i was thinking if you could please implement a way to route trough more than one acc to avoid the ban and maybe even increase the speed, this ban seems to be only from whatsapp end, it's very easy to get another whatsapp account to use in parallel and it would certainly reduce a lot the ban risk, as well as increasing the bandwidth, while one stuff is transfering you don't need to wait to send another packet too wich should decrease the lag substantially. I would like more than 2 accounts prefferably.

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.