Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit c56ab0c

Browse files
authored
Merge pull request #33 from vulncheck-oss/pdns-support
Add Support for PDNS endpoint
2 parents bde190b + c76027d commit c56ab0c

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

pdns.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package sdk
2+
3+
import (
4+
"io"
5+
"net/http"
6+
)
7+
8+
// https://docs.vulncheck.com/api/pdns
9+
func (c *Client) GetPdns() (string, error) {
10+
client := &http.Client{}
11+
req, err := http.NewRequest("GET", c.GetUrl()+"/v3/pdns/vulncheck-c2", nil)
12+
if err != nil {
13+
panic(err)
14+
}
15+
16+
c.SetAuthHeader(req)
17+
18+
res, err := client.Do(req)
19+
if err != nil {
20+
panic(err)
21+
}
22+
23+
defer res.Body.Close()
24+
body, _ := io.ReadAll(res.Body)
25+
26+
return string(body), nil
27+
}

pdns_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package sdk
2+
3+
// LIVE TESTS - these tests require a valid token to run
4+
// func TestGetPdns(t *testing.T) {
5+
// t.Run("pdns is retrieved", func(t *testing.T) {
6+
// client := Connect("URL", "")
7+
// data, err := client.GetPdns()
8+
// if err != nil {
9+
// t.Errorf("Error: %v", err)
10+
// }
11+
12+
// if data == "" {
13+
// t.Errorf("Expected a string, got %v", data)
14+
// }
15+
// })
16+
// }

tags_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package sdk
33
// LIVE TESTS - these tests require a valid token to run
44
// func TestGetTag(t *testing.T) {
55
// t.Run("tag is retrieved", func(t *testing.T) {
6-
// ray.Ray("Running test")
76
// client := Connect("URL", "")
87
// data, err := client.GetTag("vulncheck-c2")
98
// if err != nil {

0 commit comments

Comments
 (0)