mirror of
https://github.com/sairson/Yasso.git
synced 2026-02-13 23:35:17 +08:00
Yasso更新大改动,更新扫描方式,去除不常用功能,增加指纹和协议识别,修补bug等
This commit is contained in:
9
pkg/exploit/config/config.go
Normal file
9
pkg/exploit/config/config.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
// Exploits exp结构体
|
||||
type Exploits struct {
|
||||
Hostname string // 地址
|
||||
Port int // 端口
|
||||
User string // 连接用的用户名
|
||||
Pass string // 连接用的密码
|
||||
}
|
||||
56
pkg/exploit/config/tools.go
Normal file
56
pkg/exploit/config/tools.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
type Results struct {
|
||||
Columns []string
|
||||
Rows [][]string
|
||||
}
|
||||
|
||||
func SQLExecute(db *sql.DB, q string) (*Results, error) {
|
||||
if q == "" {
|
||||
return nil, nil
|
||||
}
|
||||
rows, err := db.Query(q)
|
||||
//rows, err := db.Query(q)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
columns, err := rows.Columns()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var results [][]string
|
||||
for rows.Next() {
|
||||
rs := make([]sql.NullString, len(columns))
|
||||
rsp := make([]interface{}, len(columns))
|
||||
for i := range rs {
|
||||
rsp[i] = &rs[i]
|
||||
}
|
||||
if err = rows.Scan(rsp...); err != nil {
|
||||
break
|
||||
}
|
||||
|
||||
_rs := make([]string, len(columns))
|
||||
for i := range rs {
|
||||
_rs[i] = rs[i].String
|
||||
}
|
||||
results = append(results, _rs)
|
||||
}
|
||||
if closeErr := rows.Close(); closeErr != nil {
|
||||
return nil, closeErr
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Results{
|
||||
Columns: columns,
|
||||
Rows: results,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user