mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-25 20:51:52 +08:00
Harden scan robustness and tests
This commit is contained in:
@@ -5,6 +5,7 @@ package services
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
func TestTFTPReadRequestAndResponse(t *testing.T) {
|
||||
@@ -18,4 +19,9 @@ func TestTFTPReadRequestAndResponse(t *testing.T) {
|
||||
if !ok || !strings.Contains(banner, "not found") {
|
||||
t.Fatalf("unexpected tftp banner: %q ok=%v", banner, ok)
|
||||
}
|
||||
|
||||
banner, ok = parseTFTPResponse(append([]byte{0x00, 0x05, 0x00, 0x01}, []byte(strings.Repeat("界", 165))...))
|
||||
if !ok || !utf8.ValidString(banner) || !strings.HasSuffix(banner, "...") {
|
||||
t.Fatalf("unexpected tftp utf8 banner: %q ok=%v", banner, ok)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user