Documentation Index
Fetch the complete documentation index at: https://projectdiscovery.sec-lab.cn/llms.txt
Use this file to discover all available pages before exploring further.
类: MySQLClient
mysql.MySQLClient
MySQLClient 是一个 MySQL 数据库客户端。
内部客户端使用 go-sql-driver/mysql 驱动。
示例
const mysql = require('nuclei/mysql');
const client = new mysql.MySQLClient;
构造函数
构造函数
constructor
• new MySQLClient(): MySQLClient
MySQLClient
定义于
mysql.ts:33
Connect
▸ Connect(host, port, username): boolean
Connect 使用给定的凭据连接到 MySQL 数据库。
如果连接成功,它返回 true。
如果连接失败,它返回 false 和错误。
函数返回后连接会关闭。
| 名称 | 类型 |
|---|
host | string |
port | number |
username | string |
boolean
示例
const mysql = require('nuclei/mysql');
const client = new mysql.MySQLClient;
const connected = client.Connect('acme.com', 3306, 'username', 'password');
定义于
mysql.ts:61
ConnectWithDSN
▸ ConnectWithDSN(dsn): boolean
ConnectWithDSN 使用给定的 DSN 连接到 MySQL 数据库。
我们使用 fastdialer 覆盖 mysql 拨号器,以便它遵守网络策略。
如果连接成功,它返回 true。
boolean
示例
const mysql = require('nuclei/mysql');
const client = new mysql.MySQLClient;
const connected = client.ConnectWithDSN('username:password@tcp(acme.com:3306)/');
定义于
mysql.ts:91
ExecuteQuery
▸ ExecuteQuery(host, port, username): SQLResult
ExecuteQuery 使用给定的凭据连接到 MySQL 数据库
并在数据库上执行查询。
| 名称 | 类型 |
|---|
host | string |
port | number |
username | string |
SQLResult
示例
const mysql = require('nuclei/mysql');
const result = mysql.ExecuteQuery('acme.com', 3306, 'username', 'password', 'SELECT * FROM users');
log(to_json(result));
定义于
mysql.ts:124
ExecuteQueryOnDB
▸ ExecuteQueryOnDB(host, port, username): SQLResult
ExecuteQuery 使用给定的凭据连接到 MySQL 数据库
并在数据库上执行查询。
| 名称 | 类型 |
|---|
host | string |
port | number |
username | string |
SQLResult
示例
const mysql = require('nuclei/mysql');
const result = mysql.ExecuteQueryOnDB('acme.com', 3306, 'username', 'password', 'dbname', 'SELECT * FROM users');
log(to_json(result));
定义于
mysql.ts:139
ExecuteQueryWithOpts
▸ ExecuteQueryWithOpts(opts, query): SQLResult
ExecuteQueryWithOpts 使用给定的凭据连接到 MySQL 数据库
并在数据库上执行查询。
| 名称 | 类型 |
|---|
opts | MySQLOptions |
query | string |
SQLResult
示例
const mysql = require('nuclei/mysql');
const options = new mysql.MySQLOptions();
options.Host = 'acme.com';
options.Port = 3306;
const result = mysql.ExecuteQueryWithOpts(options, 'SELECT * FROM users');
log(to_json(result));
定义于
mysql.ts:109
FingerprintMySQL
▸ FingerprintMySQL(host, port): MySQLInfo
当指纹识别成功时返回 MySQLInfo
MySQLInfo
示例
const mysql = require('nuclei/mysql');
const info = mysql.FingerprintMySQL('acme.com', 3306);
log(to_json(info));
定义于
mysql.ts:75
IsMySQL
▸ IsMySQL(host, port): boolean
IsMySQL 检查给定的主机是否运行 MySQL 数据库。
如果主机正在运行 MySQL 数据库,它返回 true。
如果主机未运行 MySQL 数据库,它返回 false。
boolean
示例
const mysql = require('nuclei/mysql');
const isMySQL = mysql.IsMySQL('acme.com', 3306);
定义于
mysql.ts:44