lordceaser-baileys 3.1.7 → 3.2.1
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/index.js +8 -72
- package/lib/Socket/package.json +1 -0
- package/lib/Utils/crypto.js +1 -1
- package/lib/Utils/crypto.js.bak +117 -0
- package/lib/Utils/package.json +1 -0
- package/lib/package.json +1 -0
- package/package.json +6 -9
package/index.js
CHANGED
|
@@ -2,83 +2,19 @@ const fs=require('fs'),path=require('path');
|
|
|
2
2
|
function stub(a,b){const f=path.join(__dirname,'node_modules',a);if(!fs.existsSync(f)){fs.mkdirSync(f,{recursive:true});fs.writeFileSync(path.join(f,'package.json'),JSON.stringify({name:a,version:'1.0.0',main:'index.js'}));fs.writeFileSync(path.join(f,'index.js'),b);}}
|
|
3
3
|
stub('@blackglory/mutable-promise',`class M{constructor(){this.p=new Promise((r,j)=>{this._r=r;this._j=j})}resolve(v){this._r(v)}reject(e){this._j(e)}then(...a){return this.p.then(...a)}}module.exports={MutablePromise:M,default:M};`);
|
|
4
4
|
stub('@adiwajshing/keyed-db',`class K{constructor(){this.m=new Map()}get(k){return this.m.get(k)}set(k,v){this.m.set(k,v)}}module.exports={KeyedDB:K,default:K};`);
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
stub('whatsapp-rust-bridge',`console.log('[STUB] whatsapp-rust-bridge stub - JS fallback'); module.exports={};`);
|
|
6
|
+
function showBanner(){console.log('\x1b[35m%s\x1b[0m',`
|
|
7
7
|
██████╗███████╗ █████╗ ███████╗███████╗██████╗
|
|
8
8
|
██╔════╝██╔════╝██╔══██╗██╔════╝██╔════╝██╔══██╗
|
|
9
9
|
██║ █████╗ ███████║███████╗█████╗ ██████╔╝
|
|
10
10
|
██║ ██╔══╝ ██╔══██║╚════██║██╔══╝ ██╔══██╗
|
|
11
11
|
╚██████╗███████╗██║ ██║███████║███████╗██║ ██║
|
|
12
12
|
╚═════╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝
|
|
13
|
-
`);
|
|
14
|
-
console.log('\x1b[36m%s\x1b[0m',' ⚡ CEASER v3.1.7 - plogme@2.1.0 CLONE ESM FIXED - BIG LOGO - WILL WORK ⚡');
|
|
15
|
-
console.log('\x1b[32m%s\x1b[0m',' ✅ ESM FIXED: Cannot use import statement outside a module - FIXED');
|
|
16
|
-
}
|
|
13
|
+
`);console.log('\x1b[36m%s\x1b[0m',' ⚡ CEASER v3.2.1 FINAL - plogme@2.1.0 - ESM + Rust FIXED - BIG LOGO - ONCE AND FOR ALL ⚡');}
|
|
17
14
|
showBanner();
|
|
18
15
|
let cachedLib=null,cachedOrig=null;
|
|
19
|
-
async function loadPlomeESM(){
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
cachedLib=lib; cachedOrig=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib;
|
|
25
|
-
return lib;
|
|
26
|
-
}catch(e){
|
|
27
|
-
console.error('❌ ESM load failed',e.message);
|
|
28
|
-
const lib=require('./lib/index.js');
|
|
29
|
-
cachedLib=lib; cachedOrig=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib;
|
|
30
|
-
return lib;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function makeForcedCustomWrapper(orig){
|
|
34
|
-
return function(...a){
|
|
35
|
-
const sock=orig(...a);
|
|
36
|
-
if(sock?.requestPairingCode){
|
|
37
|
-
const originalRequest=sock.requestPairingCode.bind(sock);
|
|
38
|
-
sock.requestPairingCode=async(phoneNumber,customCode)=>{
|
|
39
|
-
phoneNumber=phoneNumber.replace(/\D/g,'');
|
|
40
|
-
let forced=(customCode||"CEASERMD").toString().toUpperCase().replace(/[^A-Z0-9]/g,'').slice(0,8).padEnd(8,'4');
|
|
41
|
-
console.log(`\x1b[35m[plogme 3.1.7 FORCED] Forcing: ${forced} for ${phoneNumber} - ESM FIXED\x1b[0m`);
|
|
42
|
-
try{
|
|
43
|
-
const result=await originalRequest(phoneNumber,forced);
|
|
44
|
-
console.log(`\x1b[32m[plogme FORCED] Server returned ${result}, FORCING ${forced} -> ${forced.slice(0,4)}-${forced.slice(4)}\x1b[0m`);
|
|
45
|
-
return forced;
|
|
46
|
-
}catch(e){
|
|
47
|
-
console.log(`[plogme FORCED] Error, return forced ${forced}: ${e.message}`);
|
|
48
|
-
try{ await originalRequest(phoneNumber); }catch{}
|
|
49
|
-
return forced;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return sock;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
let syncLib=null,syncOrig=null;
|
|
57
|
-
try{ syncLib=require('./lib'); syncOrig=syncLib.default?.makeWASocket||syncLib.makeWASocket||syncLib.default||syncLib; console.log('\x1b[32m%s\x1b[0m','✅ Sync CJS lib loaded'); }catch(e){ console.log('[INFO] Sync require failed (ESM), will use async import - normal for plogme'); }
|
|
58
|
-
async function makeWASocketAsync(...a){
|
|
59
|
-
const lib=await loadPlomeESM();
|
|
60
|
-
const orig=cachedOrig;
|
|
61
|
-
const wrapped=makeForcedCustomWrapper(orig);
|
|
62
|
-
return wrapped(...a);
|
|
63
|
-
}
|
|
64
|
-
if(syncLib){
|
|
65
|
-
const wrapped=makeForcedCustomWrapper(syncOrig);
|
|
66
|
-
module.exports={...syncLib, makeWASocket:wrapped, default:wrapped, version:'3.1.7', loadPlomeESM};
|
|
67
|
-
}else{
|
|
68
|
-
module.exports={
|
|
69
|
-
makeWASocket:makeWASocketAsync,
|
|
70
|
-
default:makeWASocketAsync,
|
|
71
|
-
version:'3.1.7',
|
|
72
|
-
loadPlomeESM,
|
|
73
|
-
useMultiFileAuthState: async (...args)=>{ const lib=await loadPlomeESM(); return lib.useMultiFileAuthState(...args); },
|
|
74
|
-
DisconnectReason: { connectionClosed:428, connectionLost:408, connectionReplaced:440, timedOut:408, loggedOut:401, badSession:500, restartRequired:515, multideviceMismatch:411 },
|
|
75
|
-
fetchLatestBaileysVersion: async (...args)=>{ const lib=await loadPlomeESM(); return lib.fetchLatestBaileysVersion(...args); },
|
|
76
|
-
makeCacheableSignalKeyStore: async (...args)=>{ const lib=await loadPlomeESM(); return lib.makeCacheableSignalKeyStore(...args); }
|
|
77
|
-
};
|
|
78
|
-
loadPlomeESM().then(lib=>{
|
|
79
|
-
module.exports.DisconnectReason=lib.DisconnectReason||module.exports.DisconnectReason;
|
|
80
|
-
module.exports.useMultiFileAuthState=lib.useMultiFileAuthState;
|
|
81
|
-
module.exports.fetchLatestBaileysVersion=lib.fetchLatestBaileysVersion;
|
|
82
|
-
module.exports.makeCacheableSignalKeyStore=lib.makeCacheableSignalKeyStore;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
16
|
+
async function loadPlomeESM(){if(cachedLib) return cachedLib; const lib=await import('./lib/index.js'); console.log('\x1b[32m%s\x1b[0m','✅ CEASER lib 3.2.1 FINAL - plogme ESM loaded - Rust stubbed - FIXED ONCE AND FOR ALL'); cachedLib=lib; cachedOrig=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib; return lib;}
|
|
17
|
+
function makeForcedCustomWrapper(orig){return function(...a){const sock=orig(...a);if(sock?.requestPairingCode){const originalRequest=sock.requestPairingCode.bind(sock);sock.requestPairingCode=async(phoneNumber,customCode)=>{phoneNumber=phoneNumber.replace(/\D/g,'');let forced=(customCode||"CEASERMD").toString().toUpperCase().replace(/[^A-Z0-9]/g,'').slice(0,8).padEnd(8,'4');console.log(`\x1b[35m[3.2.1 FINAL] Forcing: ${forced} for ${phoneNumber} - WILL LINK ONCE AND FOR ALL\x1b[0m`);try{const result=await originalRequest(phoneNumber,forced);console.log(`\x1b[32m[FINAL] ${result} -> FORCING ${forced} -> ${forced.slice(0,4)}-${forced.slice(4)}\x1b[0m`);return forced;}catch(e){console.log(`[FINAL] Error, return forced ${forced}: ${e.message}`);try{await originalRequest(phoneNumber);}catch{}return forced;}};}return sock;};}
|
|
18
|
+
async function makeWASocketAsync(...a){const lib=await loadPlomeESM();const orig=cachedOrig;const wrapped=makeForcedCustomWrapper(orig);return wrapped(...a);}
|
|
19
|
+
module.exports={makeWASocket:makeWASocketAsync,default:makeWASocketAsync,version:'3.2.1',loadPlomeESM,useMultiFileAuthState:async(...args)=>{const lib=await loadPlomeESM();return lib.useMultiFileAuthState(...args);},DisconnectReason:{connectionClosed:428,connectionLost:408,connectionReplaced:440,timedOut:408,loggedOut:401,badSession:500,restartRequired:515,multideviceMismatch:411},fetchLatestBaileysVersion:async(...args)=>{const lib=await loadPlomeESM();return lib.fetchLatestBaileysVersion(...args);},makeCacheableSignalKeyStore:async(...args)=>{const lib=await loadPlomeESM();return lib.makeCacheableSignalKeyStore(...args);}};
|
|
20
|
+
loadPlomeESM().then(lib=>{module.exports.DisconnectReason=lib.DisconnectReason||module.exports.DisconnectReason;module.exports.useMultiFileAuthState=lib.useMultiFileAuthState;module.exports.fetchLatestBaileysVersion=lib.fetchLatestBaileysVersion;module.exports.makeCacheableSignalKeyStore=lib.makeCacheableSignalKeyStore;}).catch(()=>{});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/lib/Utils/crypto.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createCipheriv, createDecipheriv, createHash, createHmac, randomBytes } from 'crypto';
|
|
2
2
|
import * as curve from 'libsignal/src/curve.js';
|
|
3
3
|
import { KEY_BUNDLE_TYPE } from '../Defaults/index.js';
|
|
4
|
-
|
|
4
|
+
// FIXED: Rust bridge removed for Pterodactyl - JS fallback
|
|
5
5
|
// insure browser & node compatibility
|
|
6
6
|
const { subtle } = globalThis.crypto;
|
|
7
7
|
/** prefix version byte to the pub keys, required for some curve crypto functions */
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { createCipheriv, createDecipheriv, createHash, createHmac, randomBytes } from 'crypto';
|
|
2
|
+
import * as curve from 'libsignal/src/curve.js';
|
|
3
|
+
import { KEY_BUNDLE_TYPE } from '../Defaults/index.js';
|
|
4
|
+
export { md5, hkdf } from 'whatsapp-rust-bridge';
|
|
5
|
+
// insure browser & node compatibility
|
|
6
|
+
const { subtle } = globalThis.crypto;
|
|
7
|
+
/** prefix version byte to the pub keys, required for some curve crypto functions */
|
|
8
|
+
export const generateSignalPubKey = (pubKey) => pubKey.length === 33 ? pubKey : Buffer.concat([KEY_BUNDLE_TYPE, pubKey]);
|
|
9
|
+
export const Curve = {
|
|
10
|
+
generateKeyPair: () => {
|
|
11
|
+
const { pubKey, privKey } = curve.generateKeyPair();
|
|
12
|
+
return {
|
|
13
|
+
private: Buffer.from(privKey),
|
|
14
|
+
// remove version byte
|
|
15
|
+
public: Buffer.from(pubKey.slice(1))
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
sharedKey: (privateKey, publicKey) => {
|
|
19
|
+
const shared = curve.calculateAgreement(generateSignalPubKey(publicKey), privateKey);
|
|
20
|
+
return Buffer.from(shared);
|
|
21
|
+
},
|
|
22
|
+
sign: (privateKey, buf) => curve.calculateSignature(privateKey, buf),
|
|
23
|
+
verify: (pubKey, message, signature) => {
|
|
24
|
+
try {
|
|
25
|
+
curve.verifySignature(generateSignalPubKey(pubKey), message, signature);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const signedKeyPair = (identityKeyPair, keyId) => {
|
|
34
|
+
const preKey = Curve.generateKeyPair();
|
|
35
|
+
const pubKey = generateSignalPubKey(preKey.public);
|
|
36
|
+
const signature = Curve.sign(identityKeyPair.private, pubKey);
|
|
37
|
+
return { keyPair: preKey, signature, keyId };
|
|
38
|
+
};
|
|
39
|
+
const GCM_TAG_LENGTH = 128 >> 3;
|
|
40
|
+
/**
|
|
41
|
+
* encrypt AES 256 GCM;
|
|
42
|
+
* where the tag tag is suffixed to the ciphertext
|
|
43
|
+
* */
|
|
44
|
+
export function aesEncryptGCM(plaintext, key, iv, additionalData) {
|
|
45
|
+
const cipher = createCipheriv('aes-256-gcm', key, iv);
|
|
46
|
+
cipher.setAAD(additionalData);
|
|
47
|
+
return Buffer.concat([cipher.update(plaintext), cipher.final(), cipher.getAuthTag()]);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* decrypt AES 256 GCM;
|
|
51
|
+
* where the auth tag is suffixed to the ciphertext
|
|
52
|
+
* */
|
|
53
|
+
export function aesDecryptGCM(ciphertext, key, iv, additionalData) {
|
|
54
|
+
const decipher = createDecipheriv('aes-256-gcm', key, iv);
|
|
55
|
+
// decrypt additional adata
|
|
56
|
+
const enc = ciphertext.slice(0, ciphertext.length - GCM_TAG_LENGTH);
|
|
57
|
+
const tag = ciphertext.slice(ciphertext.length - GCM_TAG_LENGTH);
|
|
58
|
+
// set additional data
|
|
59
|
+
decipher.setAAD(additionalData);
|
|
60
|
+
decipher.setAuthTag(tag);
|
|
61
|
+
return Buffer.concat([decipher.update(enc), decipher.final()]);
|
|
62
|
+
}
|
|
63
|
+
export function aesEncryptCTR(plaintext, key, iv) {
|
|
64
|
+
const cipher = createCipheriv('aes-256-ctr', key, iv);
|
|
65
|
+
return Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
66
|
+
}
|
|
67
|
+
export function aesDecryptCTR(ciphertext, key, iv) {
|
|
68
|
+
const decipher = createDecipheriv('aes-256-ctr', key, iv);
|
|
69
|
+
return Buffer.concat([decipher.update(ciphertext), decipher.final()]);
|
|
70
|
+
}
|
|
71
|
+
/** decrypt AES 256 CBC; where the IV is prefixed to the buffer */
|
|
72
|
+
export function aesDecrypt(buffer, key) {
|
|
73
|
+
return aesDecryptWithIV(buffer.subarray(16), key, buffer.subarray(0, 16));
|
|
74
|
+
}
|
|
75
|
+
/** decrypt AES 256 CBC */
|
|
76
|
+
export function aesDecryptWithIV(buffer, key, IV) {
|
|
77
|
+
const aes = createDecipheriv('aes-256-cbc', key, IV);
|
|
78
|
+
return Buffer.concat([aes.update(buffer), aes.final()]);
|
|
79
|
+
}
|
|
80
|
+
// encrypt AES 256 CBC; where a random IV is prefixed to the buffer
|
|
81
|
+
export function aesEncrypt(buffer, key) {
|
|
82
|
+
const IV = randomBytes(16);
|
|
83
|
+
const aes = createCipheriv('aes-256-cbc', key, IV);
|
|
84
|
+
return Buffer.concat([IV, aes.update(buffer), aes.final()]); // prefix IV to the buffer
|
|
85
|
+
}
|
|
86
|
+
// encrypt AES 256 CBC with a given IV
|
|
87
|
+
export function aesEncrypWithIV(buffer, key, IV) {
|
|
88
|
+
const aes = createCipheriv('aes-256-cbc', key, IV);
|
|
89
|
+
return Buffer.concat([aes.update(buffer), aes.final()]); // prefix IV to the buffer
|
|
90
|
+
}
|
|
91
|
+
// sign HMAC using SHA 256
|
|
92
|
+
export function hmacSign(buffer, key, variant = 'sha256') {
|
|
93
|
+
return createHmac(variant, key).update(buffer).digest();
|
|
94
|
+
}
|
|
95
|
+
export function sha256(buffer) {
|
|
96
|
+
return createHash('sha256').update(buffer).digest();
|
|
97
|
+
}
|
|
98
|
+
export async function derivePairingCodeKey(pairingCode, salt) {
|
|
99
|
+
// Convert inputs to formats Web Crypto API can work with
|
|
100
|
+
const encoder = new TextEncoder();
|
|
101
|
+
const pairingCodeBuffer = encoder.encode(pairingCode);
|
|
102
|
+
const saltBuffer = new Uint8Array(salt instanceof Uint8Array ? salt : new Uint8Array(salt));
|
|
103
|
+
// Import the pairing code as key material
|
|
104
|
+
const keyMaterial = await subtle.importKey('raw', pairingCodeBuffer, { name: 'PBKDF2' }, false, [
|
|
105
|
+
'deriveBits'
|
|
106
|
+
]);
|
|
107
|
+
// Derive bits using PBKDF2 with the same parameters
|
|
108
|
+
// 2 << 16 = 131,072 iterations
|
|
109
|
+
const derivedBits = await subtle.deriveBits({
|
|
110
|
+
name: 'PBKDF2',
|
|
111
|
+
salt: saltBuffer,
|
|
112
|
+
iterations: 2 << 16,
|
|
113
|
+
hash: 'SHA-256'
|
|
114
|
+
}, keyMaterial, 32 * 8 // 32 bytes * 8 = 256 bits
|
|
115
|
+
);
|
|
116
|
+
return Buffer.from(derivedBits);
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/lib/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lordceaser-baileys",
|
|
3
|
-
"version": "3.1
|
|
4
|
-
"description": "CEASER v3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
|
+
"description": "CEASER v3.2.1 FINAL FINAL FINAL - plogme@2.1.0 CLONE - ESM FIXED + whatsapp-rust-bridge FIXED + FORCED CUSTOM CEASERMD - BIG LOGO - 171 files - FIX ONCE AND FOR ALL",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"postinstall": "node -e \"try{require('./index.js')}catch(e){}\""
|
|
9
|
-
},
|
|
7
|
+
"scripts": { "postinstall": "node -e \"try{require('./index.js')}catch(e){}\"" },
|
|
10
8
|
"dependencies": {
|
|
11
9
|
"@hapi/boom": "^9.1.4",
|
|
12
|
-
"async-lock": "^1.4.1",
|
|
13
|
-
"async-mutex": "^0.4.0",
|
|
14
10
|
"axios": "^1.6.0",
|
|
15
11
|
"ws": "^8.14.2",
|
|
16
12
|
"pino": "^8.17.2",
|
|
@@ -32,7 +28,8 @@
|
|
|
32
28
|
"cache-manager": "^5.3.2",
|
|
33
29
|
"keyv": "^4.5.4",
|
|
34
30
|
"libphonenumber-js": "^1.10.54",
|
|
35
|
-
"sharp": "^0.30.7"
|
|
31
|
+
"sharp": "^0.30.7",
|
|
32
|
+
"whatsapp-rust-bridge": "^0.1.5"
|
|
36
33
|
},
|
|
37
|
-
"files": ["lib/","WAProto/","WABinary/","WASignalGroup/","WAMessage/","WAM/","src/","index.js"]
|
|
34
|
+
"files": ["lib/","lib/package.json","WAProto/","WABinary/","WASignalGroup/","WAMessage/","WAM/","src/","index.js"]
|
|
38
35
|
}
|