forked from praetorian-inc/fingerprintx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scan.go
41 lines (35 loc) · 911 Bytes
/
scan.go
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
package main
import (
"fmt"
"log"
"net/netip"
"time"
"github.com/omarbdrn/fingerprintx/pkg/plugins"
"github.com/omarbdrn/fingerprintx/pkg/scan"
)
func main() {
// setup the scan config (mirrors command line options)
fxConfig := scan.Config{
DefaultTimeout: time.Duration(2) * time.Second,
FastMode: false,
Verbose: false,
UDP: false,
}
// create a target list to scan
ip, _ := netip.ParseAddr("146.148.61.165")
target := plugins.Target{
Address: netip.AddrPortFrom(ip, 443),
Host: "praetorian.com",
}
targets := make([]plugins.Target, 1)
targets = append(targets, target)
// run the scan
results, err := scan.ScanTargets(targets, fxConfig)
if err != nil {
log.Fatalf("error: %s\n", err)
}
// process the results
for _, result := range results {
fmt.Printf("%s:%d (%s/%s)\n", result.Host, result.Port, result.Transport, result.Protocol)
}
}