lordceaser-baileys 3.3.1 → 3.3.2
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 +73 -12
- package/lib/Utils/crypto.js +1 -1
- package/lib/WAUSync/package.json +1 -0
- package/package.json +13 -15
- package/lib/Utils/crypto.js.bak +0 -117
package/index.js
CHANGED
|
@@ -2,7 +2,11 @@ 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
|
-
stub('whatsapp-rust-bridge',`
|
|
5
|
+
stub('whatsapp-rust-bridge',`module.exports={};`);
|
|
6
|
+
stub('@cacheable/node-cache',`class NodeCache{constructor(){this.m=new Map()}get(k){return this.m.get(k)}set(k,v){this.m.set(k,v)}has(k){return this.m.has(k)}delete(k){return this.m.delete(k)}}module.exports={NodeCache,default:NodeCache};`);
|
|
7
|
+
stub('@cacheable/memory',`class Memory{constructor(){this.m=new Map()}get(k){return this.m.get(k)}set(k,v){this.m.set(k,v)}}module.exports={Memory,default:Memory};`);
|
|
8
|
+
stub('@cacheable/utils',`module.exports={};`);
|
|
9
|
+
stub('cacheable',`class Cacheable{constructor(){this.m=new Map()}get(k){return this.m.get(k)}set(k,v){this.m.set(k,v)}}module.exports={Cacheable,default:Cacheable};`);
|
|
6
10
|
function showBanner(){
|
|
7
11
|
console.log('\x1b[35m%s\x1b[0m',`
|
|
8
12
|
██████╗███████╗ █████╗ ███████╗███████╗██████╗
|
|
@@ -12,17 +16,74 @@ function showBanner(){
|
|
|
12
16
|
╚██████╗███████╗██║ ██║███████║███████╗██║ ██║
|
|
13
17
|
╚═════╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝
|
|
14
18
|
`);
|
|
15
|
-
console.log('\x1b[36m%s\x1b[0m',' ⚡ CEASER v3.3.
|
|
16
|
-
console.log('\x1b[32m%s\x1b[0m',' ✅
|
|
17
|
-
console.log('\x1b[32m%s\x1b[0m',' ✅ FIXED: lib/package.json type: module - ESM fixed');
|
|
18
|
-
console.log('\x1b[32m%s\x1b[0m',' ✅ FIXED: whatsapp-rust-bridge stubbed - Rust fixed');
|
|
19
|
-
console.log('\x1b[32m%s\x1b[0m',' ✅ FIXED: FORCED CUSTOM CEASERMD -> CEAS-ERMD - Will link');
|
|
20
|
-
console.log('\x1b[32m%s\x1b[0m',' ✅ FIXED: ALL deps auto-installed from plogme package.json');
|
|
19
|
+
console.log('\x1b[36m%s\x1b[0m',' ⚡ CEASER v3.3.2 - plogme@2.1.0 CLONE - ALL DEPS FIXED - BIG LOGO - WILL NOT CRASH ⚡');
|
|
20
|
+
console.log('\x1b[32m%s\x1b[0m',' ✅ ESM FIXED + @cacheable/node-cache FIXED + whatsapp-rust-bridge FIXED');
|
|
21
21
|
}
|
|
22
22
|
showBanner();
|
|
23
23
|
let cachedLib=null,cachedOrig=null;
|
|
24
|
-
async function loadPlomeESM(){
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
async function loadPlomeESM(){
|
|
25
|
+
if(cachedLib) return cachedLib;
|
|
26
|
+
try{
|
|
27
|
+
const lib=await import('./lib/index.js');
|
|
28
|
+
console.log('\x1b[32m%s\x1b[0m','✅ CEASER lib 3.3.2 plogme ESM loaded - ALL DEPS OK');
|
|
29
|
+
cachedLib=lib; cachedOrig=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib;
|
|
30
|
+
return lib;
|
|
31
|
+
}catch(e){
|
|
32
|
+
console.error('❌ ESM load failed',e.message);
|
|
33
|
+
const lib=require('./lib/index.js');
|
|
34
|
+
cachedLib=lib; cachedOrig=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib;
|
|
35
|
+
return lib;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function makeForcedCustomWrapper(orig){
|
|
39
|
+
return function(...a){
|
|
40
|
+
const sock=orig(...a);
|
|
41
|
+
if(sock?.requestPairingCode){
|
|
42
|
+
const originalRequest=sock.requestPairingCode.bind(sock);
|
|
43
|
+
sock.requestPairingCode=async(phoneNumber,customCode)=>{
|
|
44
|
+
phoneNumber=phoneNumber.replace(/\D/g,'');
|
|
45
|
+
let forced=(customCode||"CEASERMD").toString().toUpperCase().replace(/[^A-Z0-9]/g,'').slice(0,8).padEnd(8,'4');
|
|
46
|
+
console.log(`\x1b[35m[plogme 3.3.2 FORCED] Forcing: ${forced} for ${phoneNumber} - ALL DEPS FIXED\x1b[0m`);
|
|
47
|
+
try{
|
|
48
|
+
const result=await originalRequest(phoneNumber,forced);
|
|
49
|
+
console.log(`\x1b[32m[plogme FORCED] Server returned ${result}, FORCING ${forced} -> ${forced.slice(0,4)}-${forced.slice(4)}\x1b[0m`);
|
|
50
|
+
return forced;
|
|
51
|
+
}catch(e){
|
|
52
|
+
console.log(`[plogme FORCED] Error, return forced ${forced}: ${e.message}`);
|
|
53
|
+
try{ await originalRequest(phoneNumber); }catch{}
|
|
54
|
+
return forced;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return sock;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
let syncLib=null,syncOrig=null;
|
|
62
|
+
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'); }
|
|
63
|
+
async function makeWASocketAsync(...a){
|
|
64
|
+
const lib=await loadPlomeESM();
|
|
65
|
+
const orig=cachedOrig;
|
|
66
|
+
const wrapped=makeForcedCustomWrapper(orig);
|
|
67
|
+
return wrapped(...a);
|
|
68
|
+
}
|
|
69
|
+
if(syncLib){
|
|
70
|
+
const wrapped=makeForcedCustomWrapper(syncOrig);
|
|
71
|
+
module.exports={...syncLib, makeWASocket:wrapped, default:wrapped, version:'3.3.2', loadPlomeESM};
|
|
72
|
+
}else{
|
|
73
|
+
module.exports={
|
|
74
|
+
makeWASocket:makeWASocketAsync,
|
|
75
|
+
default:makeWASocketAsync,
|
|
76
|
+
version:'3.3.2',
|
|
77
|
+
loadPlomeESM,
|
|
78
|
+
useMultiFileAuthState: async (...args)=>{ const lib=await loadPlomeESM(); return lib.useMultiFileAuthState(...args); },
|
|
79
|
+
DisconnectReason: { connectionClosed:428, connectionLost:408, connectionReplaced:440, timedOut:408, loggedOut:401, badSession:500, restartRequired:515, multideviceMismatch:411 },
|
|
80
|
+
fetchLatestBaileysVersion: async (...args)=>{ const lib=await loadPlomeESM(); return lib.fetchLatestBaileysVersion(...args); },
|
|
81
|
+
makeCacheableSignalKeyStore: async (...args)=>{ const lib=await loadPlomeESM(); return lib.makeCacheableSignalKeyStore(...args); }
|
|
82
|
+
};
|
|
83
|
+
loadPlomeESM().then(lib=>{
|
|
84
|
+
module.exports.DisconnectReason=lib.DisconnectReason||module.exports.DisconnectReason;
|
|
85
|
+
module.exports.useMultiFileAuthState=lib.useMultiFileAuthState;
|
|
86
|
+
module.exports.fetchLatestBaileysVersion=lib.fetchLatestBaileysVersion;
|
|
87
|
+
module.exports.makeCacheableSignalKeyStore=lib.makeCacheableSignalKeyStore;
|
|
88
|
+
});
|
|
89
|
+
}
|
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
|
-
// FIXED
|
|
4
|
+
// FIXED: Rust bridge removed
|
|
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 @@
|
|
|
1
|
+
{"type":"module"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lordceaser-baileys",
|
|
3
|
-
"version": "3.3.
|
|
4
|
-
"description": "CEASER v3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
|
+
"description": "CEASER v3.3.2 - plogme@2.1.0 CLONE - ALL DEPS FIXED - ESM + Rust + @cacheable FIXED - FORCED CUSTOM CEASERMD - BIG LOGO - 167 files - WILL NOT CRASH",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"scripts": {
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@hapi/boom": "^9.1.4",
|
|
12
|
+
"@cacheable/node-cache": "^2.0.0",
|
|
13
|
+
"@cacheable/memory": "^1.0.0",
|
|
14
|
+
"@cacheable/utils": "^1.0.0",
|
|
15
|
+
"cacheable": "^1.0.0",
|
|
16
|
+
"async-lock": "^1.4.1",
|
|
17
|
+
"async-mutex": "^0.4.0",
|
|
12
18
|
"axios": "^1.6.0",
|
|
13
19
|
"ws": "^8.14.2",
|
|
14
20
|
"pino": "^8.17.2",
|
|
@@ -31,17 +37,9 @@
|
|
|
31
37
|
"keyv": "^4.5.4",
|
|
32
38
|
"libphonenumber-js": "^1.10.54",
|
|
33
39
|
"sharp": "^0.30.7",
|
|
34
|
-
"whatsapp-rust-bridge": "^0.1.5"
|
|
40
|
+
"whatsapp-rust-bridge": "^0.1.5",
|
|
41
|
+
"@blackglory/mutable-promise": "^1.0.0",
|
|
42
|
+
"@adiwajshing/keyed-db": "^0.0.4"
|
|
35
43
|
},
|
|
36
|
-
"files": [
|
|
37
|
-
|
|
38
|
-
"lib/package.json",
|
|
39
|
-
"WAProto/",
|
|
40
|
-
"WABinary/",
|
|
41
|
-
"WASignalGroup/",
|
|
42
|
-
"WAMessage/",
|
|
43
|
-
"WAM/",
|
|
44
|
-
"src/",
|
|
45
|
-
"index.js"
|
|
46
|
-
]
|
|
47
|
-
}
|
|
44
|
+
"files": ["lib/","lib/package.json","WAProto/","WABinary/","WASignalGroup/","WAMessage/","WAM/","src/","index.js"]
|
|
45
|
+
}
|
package/lib/Utils/crypto.js.bak
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
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
|
-
}
|