-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreset_network.go
More file actions
47 lines (39 loc) · 1.27 KB
/
preset_network.go
File metadata and controls
47 lines (39 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package nucleisdk
import "context"
// NetworkScanner is a pre-configured scanner for network/infrastructure security testing.
// It focuses on DNS, SSL/TLS, and TCP-based vulnerability detection.
type NetworkScanner struct {
*presetScanner
}
// NewNetworkScanner creates a new network/infra scanner with sensible defaults.
func NewNetworkScanner(opts ...Option) (*NetworkScanner, error) {
defaults := []Option{
WithProtocolTypes("network,dns,ssl"),
WithTags(
"network", "dns", "ssl", "tls", "cve",
"default-login", "exposure", "misconfig",
),
WithThreads(25),
WithHostConcurrency(50),
WithTimeout(5),
WithRetries(2),
WithRateLimit(100),
}
ps, err := newPresetScanner(defaults, opts)
if err != nil {
return nil, err
}
return &NetworkScanner{presetScanner: ps}, nil
}
// Run executes the network scan and returns results via a channel.
func (n *NetworkScanner) Run(ctx context.Context) (<-chan *ScanResult, error) {
return n.presetScanner.Run(ctx)
}
// RunWithCallback executes the network scan with a callback.
func (n *NetworkScanner) RunWithCallback(ctx context.Context, cb func(*ScanResult)) error {
return n.presetScanner.RunWithCallback(ctx, cb)
}
// Close releases resources.
func (n *NetworkScanner) Close() error {
return n.presetScanner.Close()
}