Skip to content

Commit

Permalink
updated readme;
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanfinn committed Mar 20, 2023
1 parent 84081f4 commit 6b4ed5f
Showing 1 changed file with 1 addition and 105 deletions.
106 changes: 1 addition & 105 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,108 +46,4 @@ https://bogdanfinn.gitbook.io/open-source-oasis/
### Questions?

Join my discord support server for free: https://discord.gg/7Ej9eJvHqk
No Support in DMs!


### Compile this client as a shared library for use in other languages like Python or NodeJS
Please take a look at the cross compile build script in `cffi_dist/build.sh` to build this tls-client as a shared library for other programming languages (.dll, .so, .dylib).

The build script is written to cross compile from OSX to all other platforms (osx, linux, windows). If your build os is not OSX you might need to adjust the build script.

You can also use the prebuilt packages in `cffi_dist/dist`

A python example on how to load and call the functionality can be found in `cffi_dist/example_python`. Please be aware that i'm not a python expert.
I highly recommend to take a look at this repository, when you want to use this tls-client in python: https://github.com/FlorianREGAZ/Python-Tls-Client

A NodeJS example on how to load and call the functionality can be found in `cffi_dist/example_node`. Please be aware that you need to run `npm install` to install the node dependencies.

The basic logic behind the shared library is, that you pass all required information in a JSON string to the shared lib function which then creates the client, the request and the request data out of it and forwards the request.
For more documentation on this JSON string please take a look at: https://github.com/bogdanfinn/tls-client-api

Every Response from the shared library will contain an id field like that: `"id":"some-uuid-v4-value"`. You can use the id to free the memory. Otherwise you will end up with growing allocated memory.
Basic Nodejs example:
```js
const response = tlsClientLibrary.request(JSON.stringify(requestPayload));
const responseObject = JSON.parse(response)
tlsClientLibrary.freeMemory(responseObject.Id)
```

### Frequently Asked Questions / Errors
* **How can I add `GREASE` to Custom Client Profiles when using the shared library?**

Please refer to `index_custom_client.js` or `example_custom_client.py` in either NodeJS examples or Python Examples. You can use the Magic Number `2570`. You can add it in a ja3 string for example to turn that into a `GREASE` cipher or tls extension.

* **I receive PROTOCOL_ERROR on POST Request**

This is a very generic error and can have many root causes. Most likely users of this client are setting the `content-length` header manually with a (wrong) fixed value.

* **This client fails when I test on www.google.com**

Please check this issue for explanation: https://github.com/bogdanfinn/tls-client/issues/6. Should be fixed since 0.8.3

* **I'm receiving `tls: error decoding message` when using this TLS Client.**

This issue should be fixed since `v0.3.0`. There was an issue with the CompressCertExtension in the utls package dependency.

* **The TLS-Client does not set the user-agent header correctly**

Do not mix up TLS-Fingerprints with HTTP Request Headers. They have more or less nothing in common. AntiBots using for example header order in addition to TLS-Fingerprinting. This library does only handle the TLS- and Akamai Fingerprint. You are still responsible to define the to be used headers and the header order.
If you do not provide any headers the http client will use by default these two headers (nothing more):
```
accept-encoding: gzip, deflate, br
user-agent: Go-http-client/2.0
```

* **If I use the shared library in electron my application freezes?**
Please only load the dll once in your application and call every function `async` to not block the main thread. An example is added in the nodejs examples.

* **My Post Request is not working correctly?**
Please make sure that you set the correct `Content-Type` Header for your Post Body Payload.

* **About `accept-encoding` and automatic decompression**
If you are specifying `accept-encoding` header yourself and you are on `http1` connection than you have to take care of the **decompression yourself**.
It is not done automatically. Only if you are not adding `accept-encoding` header then the library adds it for you if not explicit disabled and also handles the decompression automatically.

On `http2` the automatic decompression should always be in place according to the `Content-Type` Header on the Response.

So if you are trying to use "only" `accept-encoding: gzip` you have to take care of the decompression.
`DecompressBody` is exported. You can just reuse it like that:

```go
req, err := http.NewRequest(http.MethodGet, "https://tls.browserleaks.com/json", nil)
if err != nil {
log.Println(err)
return
}

req.Header = http.Header{
"accept": {"*/*"},
"accept-encoding": {"gzip"},
"accept-language": {"de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7"},
"user-agent": {"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"},
http.HeaderOrderKey: {
"accept",
"accept-encoding",
"accept-language",
"user-agent",
},
}

resp, err := client.Do(req)

if err != nil {
log.Println(err)
return
}

defer resp.Body.Close()

decomBody := http.DecompressBody(resp)

all, err := io.ReadAll(decomBody)
if err != nil {
log.Println(err)
return
}
log.Println(string(all))
```
No Support in DMs!

0 comments on commit 6b4ed5f

Please sign in to comment.