-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathip.go
38 lines (30 loc) · 766 Bytes
/
ip.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
package gothreat
/*
ThreatCrowd ip report, based on
https://www.threatcrowd.org/searchApi/v2/ip/report/?ip=188.40.75.132
*/
import (
"encoding/json"
)
type IPData struct {
ResponseCode string `json:"response_code"`
Resolutions []struct {
LastResolved string `json:"last_resolved"`
Domain string `json:"domain"`
} `json:"resolutions"`
Hashes []string `json:"hashes"`
References []string `json:"references"`
Permalink string `json:"permalink"`
}
func IPReportRaw(ipaddr string) ([]byte, error) {
return process_report("ip", "ip", ipaddr)
}
func IPReport(ipaddr string) (IPData, error) {
var ipData IPData
data, err := IPReportRaw(ipaddr)
if err != nil {
return ipData, err
}
json.Unmarshal(data, &ipData)
return ipData, nil
}