-
Notifications
You must be signed in to change notification settings - Fork 2
/
sc-risk-acceptance.go
59 lines (54 loc) · 1.88 KB
/
sc-risk-acceptance.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
51
52
53
54
55
56
57
58
59
package go_tenable
import (
"encoding/json"
"fmt"
"io/ioutil"
)
func (sc *TenableSC) ListRiskAcceptanceRules() AcceptRiskRuleResponse {
var params = "fields=id,repository,organization,user,plugin,hostType,hostValue,port,protocol,expires,status," +
"comments,createdTime,modifiedTime"
resp, err := sc.Get("acceptRiskRule", params)
tmp, _ := ioutil.ReadAll(resp.Body)
var Rules = AcceptRiskRuleResponse{}
err = json.Unmarshal(tmp, &Rules)
if err != nil {
fmt.Printf("Unable to unmarshal Risk Acceptance Rules: %v\n", err)
}
return Rules
}
type AcceptRiskRuleResponse struct {
Type string `json:"type"`
AcceptRiskRules []AcceptRiskRule `json:"response"`
ErrorCode int `json:"error_code"`
ErrorMsg string `json:"error_msg"`
Warnings []interface{} `json:"warnings"`
Timestamp int `json:"timestamp"`
}
type AcceptRiskRule struct {
HostValue interface{} `json:"hostValue,omitempty"`
HostType string `json:"hostType"`
Port string `json:"Port,omitempty"`
Protocol string `json:"protocol,omitempty"`
Expires string `json:"expires"`
CreatedTime string `json:"createdTime"`
ModifiedTime string `json:"modifiedTime"`
Status string `json:"status"`
ID string `json:"id"`
Comments string `json:"comments"`
Plugin struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
} `json:"plugin"`
Repository struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
} `json:"repository"`
User struct {
ID string `json:"id"`
Username string `json:"username"`
Firstname string `json:"firstname,omitempty"`
Lastname string `json:"lastname,omitempty"`
} `json:"User"`
}