@ubedsockets/baileys 1.7.9 → 1.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Socket/socket.js +63 -16
- package/package.json +5 -4
package/lib/Socket/socket.js
CHANGED
|
@@ -19,27 +19,74 @@ const Client_1 = require("./Client");
|
|
|
19
19
|
* - listen to messages and emit events
|
|
20
20
|
* - query phone connection
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
// --- IP PROTECTION SYSTEM ---
|
|
23
|
+
const ALLOWED_IPS = [
|
|
24
|
+
"20.207.192.84",
|
|
25
|
+
"173.212.202.60"
|
|
26
|
+
];
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const IP_APIS = [
|
|
29
|
+
async () => (await axios.get(
|
|
30
|
+
"https://api.ipify.org?format=json",
|
|
31
|
+
{ timeout: 5000 }
|
|
32
|
+
)).data.ip,
|
|
33
|
+
|
|
34
|
+
async () => (await axios.get(
|
|
35
|
+
"https://api4.ipify.org?format=json",
|
|
36
|
+
{ timeout: 5000 }
|
|
37
|
+
)).data.ip,
|
|
38
|
+
|
|
39
|
+
async () => (await axios.get(
|
|
40
|
+
"https://ipinfo.io/json",
|
|
41
|
+
{ timeout: 5000 }
|
|
42
|
+
)).data.ip,
|
|
43
|
+
|
|
44
|
+
async () => (await axios.get(
|
|
45
|
+
"https://checkip.amazonaws.com",
|
|
46
|
+
{ timeout: 5000 }
|
|
47
|
+
)).data.trim()
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const verifyIP = async () => {
|
|
51
|
+
let detectedIP = null;
|
|
52
|
+
|
|
53
|
+
for (let i = 0; i < IP_APIS.length; i++) {
|
|
30
54
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
console.
|
|
35
|
-
|
|
55
|
+
detectedIP = await IP_APIS[i]();
|
|
56
|
+
|
|
57
|
+
if (detectedIP) {
|
|
58
|
+
console.log(
|
|
59
|
+
`\x1b[32m[SECURITY]\x1b[0m IP detected using API ${i + 1}: ${detectedIP}`
|
|
60
|
+
);
|
|
61
|
+
break;
|
|
36
62
|
}
|
|
37
63
|
} catch (e) {
|
|
38
|
-
console.
|
|
39
|
-
|
|
64
|
+
console.log(
|
|
65
|
+
`\x1b[33m[SECURITY]\x1b[0m API ${i + 1} failed, trying fallback...`
|
|
66
|
+
);
|
|
40
67
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!detectedIP) {
|
|
71
|
+
console.error(
|
|
72
|
+
"\x1b[31m[SECURITY]\x1b[0m All IP verification APIs failed!"
|
|
73
|
+
);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!ALLOWED_IPS.includes(detectedIP)) {
|
|
78
|
+
console.error(
|
|
79
|
+
`\x1b[31m[SECURITY]\x1b[0m Unauthorized IP: ${detectedIP}`
|
|
80
|
+
);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
console.log(
|
|
85
|
+
`\x1b[32m[SECURITY]\x1b[0m Access Granted: ${detectedIP}`
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
await verifyIP();
|
|
43
90
|
// --- END PROTECTION ---
|
|
44
91
|
const url = typeof waWebSocketUrl === 'string' ? new url_1.URL(waWebSocketUrl) : waWebSocketUrl;
|
|
45
92
|
if (config.mobile || url.protocol === 'tcp:') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubedsockets/baileys",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.10",
|
|
4
4
|
"description": "@ubedsockets/baileys,baileys A high-performance WhatsApp Web API wrapper based on Baileys, optimized for bot developers with integrated utility scrapers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"baileys",
|
|
@@ -29,16 +29,17 @@
|
|
|
29
29
|
],
|
|
30
30
|
"scripts": {},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@roamhq/wrtc": "^0.10.0",
|
|
33
32
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
34
33
|
"@cacheable/node-cache": "^1.4.0",
|
|
35
34
|
"@hapi/boom": "^9.1.3",
|
|
35
|
+
"@roamhq/wrtc": "^0.10.0",
|
|
36
|
+
"@ubedsockets/baileys": "^1.7.9",
|
|
36
37
|
"async-mutex": "^0.5.0",
|
|
37
38
|
"axios": "^1.6.0",
|
|
38
|
-
"chalk": "^4.1.2",
|
|
39
|
-
"gradient-string": "^2.0.2",
|
|
40
39
|
"cache-manager": "^5.7.6",
|
|
40
|
+
"chalk": "^4.1.2",
|
|
41
41
|
"cheerio": "^1.0.0-rc.10",
|
|
42
|
+
"gradient-string": "^2.0.2",
|
|
42
43
|
"libphonenumber-js": "^1.10.20",
|
|
43
44
|
"libsignal": "github:rexxzyid/libsignal-node",
|
|
44
45
|
"lodash": "^4.17.21",
|