
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
mysql-baileys
Advanced tools
If you want with your specifications, if you don't create it, the code will automatically create
CREATE TABLE `auth` (
`session` varchar(50) NOT NULL,
`id` varchar(100) NOT NULL,
`value` json DEFAULT NULL,
UNIQUE KEY `idxunique` (`session`,`id`),
KEY `idxsession` (`session`),
KEY `idxid` (`id`)
) ENGINE=MyISAM
Edge Version:
npm i github:bobslavtriev/mysql-baileys
Stable Version:
npm i bobslavtriev/mysql-baileys
const { useMySQLAuthState } = require('mysql-baileys')
const { state, saveCreds, removeCreds } = await useMySQLAuthState({
session: sessionName, // required
password: 'Password123#', // required
database: 'baileys', // required
})
type MySQLConfig = {
/* The hostname of the database you are connecting to. (Default: localhost) */
host?: string,
/* The port number to connect to. (Default: 3306) */
port?: number,
/* The MySQL user to authenticate as. (Default: root) */
user?: string,
/* The password of that MySQL user */
password: string,
/* Alias for the MySQL user password. Makes a bit more sense in a multifactor authentication setup (see "password2" and "password3") */
password1?: string,
/* 2nd factor authentication password. Mandatory when the authentication policy for the MySQL user account requires an additional authentication method that needs a password. */
password2?: string,
/* 3rd factor authentication password. Mandatory when the authentication policy for the MySQL user account requires two additional authentication methods and the last one needs a password. */
password3?: string,
/* Name of the database to use for this connection. (Default: base) */
database: string,
/* MySql table name. (Default: auth) */
tableName?: string,
/* Retry the query at each interval if it fails. (Default: 200ms) */
retryRequestDelayMs: number,
/* Maximum attempts if the query fails. (Default: 10) */
maxtRetries?: number,
/* Session name to identify the connection, allowing multisessions with mysql. */
session: string,
/* The source IP address to use for TCP connection. */
localAddress?: string,
/* The path to a unix domain socket to connect to. When used host and port are ignored. */
socketPath?: string,
/* Allow connecting to MySQL instances that ask for the old (insecure) authentication method. (Default: false) */
insecureAuth?: boolean,
/* If your connection is a server. (Default: false) */
isServer?: boolean,
/* Use the config SSL. (Default: disabled) */
ssl?: string | SslOptions
}
const { makeWASocket, makeCacheableSignalKeyStore, fetchLatestBaileysVersion } = require('@whiskeysockets/Baileys')
const { useMySQLAuthState } = require('mysql-baileys')
async function startSock(sessionName){
const { error, version } = await fetchLatestBaileysVersion()
if (error){
console.log(`Session: ${sessionName} | No connection, check your internet.`)
return startSock(sessionName)
}
const { state, saveCreds, removeCreds } = await useMySQLAuthState({
session: sessionName,
host: 'localhost',
port: 3306,
user: 'bob',
password: 'Password123#',
database: 'baileys',
tableName: 'auth'
})
const sock = makeWASocket({
auth: {
creds: state.creds,
keys: makeCacheableSignalKeyStore(state.keys, logger),
},
version: version,
defaultQueryTimeoutMs: undefined
})
sock.ev.on('creds.update', saveCreds)
sock.ev.on('connection.update', async({ connection, lastDisconnect }) => {
// your code here
})
sock.ev.on('messages.upsert', async({ messages, type }) => {
// your code here
})
}
startSock('session1')
startSock('session1')
startSock('session2')
startSock('session3')
startSock('session4')
FAQs
Implementation of MySQL in Baileys.
The npm package mysql-baileys receives a total of 102 weekly downloads. As such, mysql-baileys popularity was classified as not popular.
We found that mysql-baileys demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.