Fix network hangs in recon unit tests and update README setup documentation
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
This commit is contained in:
@@ -29,6 +29,13 @@ func TestScanStreamEmitsPortsFirst(t *testing.T) {
|
||||
return 200, `<html><title>Home</title></html>`, nil
|
||||
})
|
||||
t.Cleanup(func() { SetFetchPageHook(nil) })
|
||||
SetBannerHooks(
|
||||
func(_ string, p int) string { if p == 22 { return "SSH" }; return "" },
|
||||
func(_ string, p int) (string, string) { if p == 80 { return "t", "s" }; return "", "" },
|
||||
func(_ string, p int) string { if p == 5985 { return "w" }; return "" },
|
||||
nil,
|
||||
)
|
||||
t.Cleanup(func() { SetBannerHooks(nil, nil, nil, nil) })
|
||||
|
||||
var events []string
|
||||
report, err := ScanStream(ScanRequest{Host: "stream.lab", Profile: ProfileQuick, Port: 80, Scheme: "http"}, "scan-1", func(eventType string, _ map[string]interface{}) {
|
||||
|
||||
@@ -143,6 +143,13 @@ func TestScanOwnedTarget(t *testing.T) {
|
||||
return 200, `<html><form enctype="multipart/form-data"><input type="file" name="f"></form></html>`, nil
|
||||
})
|
||||
t.Cleanup(func() { SetFetchPageHook(nil) })
|
||||
SetBannerHooks(
|
||||
func(_ string, p int) string { if p == 22 { return "SSH" }; return "" },
|
||||
func(_ string, p int) (string, string) { if p == 80 { return "t", "s" }; return "", "" },
|
||||
func(_ string, p int) string { if p == 5985 { return "w" }; return "" },
|
||||
nil,
|
||||
)
|
||||
t.Cleanup(func() { SetBannerHooks(nil, nil, nil, nil) })
|
||||
report, err := Scan(ScanRequest{Host: "owned.lab", Port: 80, Scheme: "http"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -261,6 +268,13 @@ func TestScanReportIncludesAdminSurfaceJSON(t *testing.T) {
|
||||
return resp.StatusCode, body, nil
|
||||
})
|
||||
t.Cleanup(func() { SetFetchPageHook(nil) })
|
||||
SetBannerHooks(
|
||||
func(_ string, p int) string { if p == 22 { return "SSH" }; return "" },
|
||||
func(_ string, p int) (string, string) { if p == 80 { return "t", "s" }; return "", "" },
|
||||
func(_ string, p int) string { if p == 5985 { return "w" }; return "" },
|
||||
nil,
|
||||
)
|
||||
t.Cleanup(func() { SetBannerHooks(nil, nil, nil, nil) })
|
||||
report, err := Scan(ScanRequest{Host: u.Hostname(), Port: port, Scheme: u.Scheme})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user