-
Notifications
You must be signed in to change notification settings - Fork 3
/
NativeHttpClient.go
65 lines (56 loc) · 1.13 KB
/
NativeHttpClient.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
60
61
62
63
64
65
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"path"
)
// JA3Response is the struct
type JA3Response struct {
JA3Hash string `json:"ja3_hash"`
JA3 string `json:"ja3"`
UserAgent string `json:"User-Agent"`
}
func main() {
/* First fetch the JA3 Fingerprint */
resp, err := http.Get("https://ja3er.com/json")
if err != nil {
fmt.Println(err)
panic(err)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
panic(err)
}
// unmarshal the response
var ja3Response JA3Response
err = json.Unmarshal(body, &ja3Response)
if err != nil {
fmt.Println(err)
panic(err)
}
/* Fetch information about the ja3hash*/
searchURL, _ := url.Parse("https://ja3er.com/search/")
searchURL.Path = path.Join(searchURL.Path, ja3Response.JA3Hash)
resp, err = http.Get(searchURL.String())
if err != nil {
fmt.Println(err)
panic(err)
}
body, err = ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
panic(err)
}
var out bytes.Buffer
err = json.Indent(&out, body, "", "\t")
if err != nil {
fmt.Println(err)
panic(err)
}
fmt.Println(out.String())
}