mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-26 05:01:53 +08:00
feat: tcp端口扫描支持socks5 (#527)
* feat: tcp端口扫描支持socks5 * feat: PG插件支持socks5 * feat: 完成大部分插件的socks5支持
This commit is contained in:
+24
-2
@@ -3,14 +3,29 @@ package Plugins
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gocql/gocql"
|
||||
"github.com/shadow1ng/fscan/Common"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gocql/gocql"
|
||||
"github.com/shadow1ng/fscan/Common"
|
||||
)
|
||||
|
||||
// CassandraProxyDialer 实现gocql.Dialer接口,支持代理连接
|
||||
type CassandraProxyDialer struct {
|
||||
timeout time.Duration
|
||||
}
|
||||
|
||||
func (d *CassandraProxyDialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
host, port, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return Common.WrapperTcpWithContext(ctx, network, fmt.Sprintf("%s:%s", host, port))
|
||||
}
|
||||
|
||||
// CassandraCredential 表示一个Cassandra凭据
|
||||
type CassandraCredential struct {
|
||||
Username string
|
||||
@@ -223,6 +238,13 @@ func CassandraConn(ctx context.Context, info *Common.HostInfo, user string, pass
|
||||
cluster.ProtoVersion = 4
|
||||
cluster.Consistency = gocql.One
|
||||
|
||||
// 如果配置了代理,设置自定义Dialer
|
||||
if Common.Socks5Proxy != "" {
|
||||
cluster.Dialer = &CassandraProxyDialer{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
if user != "" || pass != "" {
|
||||
cluster.Authenticator = gocql.PasswordAuthenticator{
|
||||
Username: user,
|
||||
|
||||
Reference in New Issue
Block a user