aleixrodriala / wa-tunnel

Tunneling Internet traffic over Whatsapp
MIT License
2.08k stars 96 forks source link

Crash: connection closed #18

Closed InterVi closed 1 year ago

InterVi commented 1 year ago

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

> wa-tunnel@1.0.0 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

> wa-tunnel@1.0.0 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.

ZhymabekRoman commented 1 year ago

Same error. How did you fixed it?