forked from owasp-amass/amass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
censys_test.go
50 lines (40 loc) · 1.04 KB
/
censys_test.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
42
43
44
45
46
47
48
49
50
// Copyright 2017 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 datasrcs
import (
"testing"
)
func TestCensysAPIRequest(t *testing.T) {
if *networkTest == false || *configPath == "" {
return
}
api := testConfig.GetAPIKey("Censys")
if api == nil || api.Key == "" || api.Secret == "" {
return
}
result := testDNSRequest("Censys")
if result < expectedTest {
t.Errorf("Found %d names, expected at least %d instead", result, expectedTest)
}
}
func TestCensysWebRequest(t *testing.T) {
if *networkTest == false {
return
}
if api := testConfig.GetAPIKey("Censys"); api != nil {
key := api.Key
secret := api.Secret
defer func() {
api.Key = key
api.Secret = secret
testConfig.AddAPIKey("Censys", api)
}()
api.Key = ""
api.Secret = ""
testConfig.AddAPIKey("Censys", api)
}
result := testDNSRequest("Censys")
if result < expectedTest {
t.Errorf("Found %d names, expected at least %d instead", result, expectedTest)
}
}