feat(ja3): Update JA3 fingerprinting source and parsing
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -132,11 +133,20 @@ func (f *Flaresolverr) ListSessionsV1(sessionID string) (*V1ResponseBase, error)
|
||||
}
|
||||
|
||||
func (f *Flaresolverr) GetJa3AndUserAgent() (ua string, ja3 string, err error) {
|
||||
resp, err := f.GetV1("https://tls.peet.ws/api/tls", nil)
|
||||
resp, err := f.GetV1("view-source:https://tools.scrapfly.io/api/tls", nil)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
return resp.Solution.UserAgent, resp.Solution.RawResponse.(map[string]any)["tls"].(map[string]any)["ja3"].(string), nil
|
||||
j := regexp.MustCompile(`{(.*)}`).FindStringSubmatch(resp.Solution.RawResponse.(string))
|
||||
if len(j) < 2 {
|
||||
return "", "", fmt.Errorf("failed to get ja3")
|
||||
}
|
||||
ja3Obj := Ja3{}
|
||||
err = json.Unmarshal([]byte(j[0]), &ja3Obj)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
return resp.Solution.UserAgent, ja3Obj.Ja3, nil
|
||||
}
|
||||
|
||||
func (f *Flaresolverr) preSimulateRequest(opts *SimulateOptions) error {
|
||||
|
||||
Reference in New Issue
Block a user