forked from owasp-amass/amass
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzone_test.go
More file actions
61 lines (52 loc) · 1.39 KB
/
Copy pathzone_test.go
File metadata and controls
61 lines (52 loc) · 1.39 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2017-2021 Jeff Foley. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package enum
import (
"flag"
"os"
"testing"
)
const TestDomain string = "owasp-amass.com"
var (
networkTest = flag.Bool("network", false, "Run tests that require connectivity (take more time)")
)
// TestMain will parse the test flags and setup for integration tests.
func TestMain(m *testing.M) {
flag.Parse()
result := m.Run()
os.Exit(result)
}
func TestZoneTransfer(t *testing.T) {
if *networkTest == false {
return
}
tests := []struct {
expected string
}{
{"amass-transfer-test.axfr.owasp-amass.com"},
{"exchange2003.axfr.owasp-amass.com"},
{"i-should-get-some-sleep.axfr.owasp-amass.com"},
{"its-almost-2am-here.axfr.owasp-amass.com"},
{"stormstroopers.axfr.owasp-amass.com"},
{"top-secret-sub-domain.axfr.owasp-amass.com"},
{"vpn.axfr.owasp-amass.com"},
{"youll-never-find-this.axfr.owasp-amass.com"},
}
a, err := ZoneTransfer(TestDomain, TestDomain, "ns1.owasp-amass.com")
if err != nil {
t.Errorf("Error in creating ZoneTransfer: %v", err)
}
var s []string
var check int
for _, out := range a {
for _, test := range tests {
if test.expected == out.Name {
s = append(s, out.Name)
check++
}
}
if check < len(tests) {
t.Errorf("Did not find all expected sub domains. \n Found %v", s)
}
}
}