-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfile.go
38 lines (30 loc) · 851 Bytes
/
file.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
/*
File reports based on
https://www.threatcrowd.org/searchApi/v2/file/report/?resource=ec8c89aa5e521572c74e2dd02a4daf78
*/
import (
"encoding/json"
)
type FileData struct {
ResponseCode string `json:"response_code"`
Md5 string `json:"md5"`
Sha1 string `json:"sha1"`
Scans []string `json:"scans"`
Ips []string `json:"ips"`
Domains []string `json:"domains"`
References []string `json:"references"`
Permalink string `json:"permalink"`
}
func FileReportRaw(file string) ([]byte, error) {
return process_report("file", "resource", file)
}
func FileReport(file string) (FileData, error) {
var fileData FileData
data, err := FileReportRaw(file)
if err != nil {
return fileData, err
}
json.Unmarshal(data, &fileData)
return fileData, nil
}