Skip to content

Commit 6aa7d48

Browse files
committed
missed an error to deal with
1 parent 7d7ad01 commit 6aa7d48

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

scanme/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
// Scanme is a Go package for network scanning using the GoPacket library.
1+
// Scanme is a Go package for network scanning using the GoPacket library.
22
//It allows scanning a single IP address for open ports using SYN scans.
33
package scanme

scanme/scanner.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,11 @@ func (s *Scanner) ConnScan() (map[layers.TCPPort]string, error) {
339339
conn, err := net.DialTimeout("tcp", addr, 3*time.Second)
340340
if err == nil {
341341
conn.Close()
342-
serviceName, _ := utils.GetServiceName(strconv.Itoa(p), "tcp")
342+
serviceName, err := utils.GetServiceName(strconv.Itoa(p), "tcp")
343+
if err != nil {
344+
// Log or handle the error, and continue the loop
345+
log.Printf("Error getting service name for port %d: %v", p, err)
346+
}
343347

344348
// Use mutex to safely update the map
345349
mutex.Lock()

utils/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// Package utils offer a set of helpers for the scanner
2-
package utils
2+
package utils

version/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ package version
33
const (
44
// Version is the version of the library.
55
Version = "1..0.0"
6-
)
6+
)

0 commit comments

Comments
 (0)