CLI commands and flags¶
Generated from the current CLI executable: what tls-forge --help and each command's --help say.
tls-forge — an HTTP client that sends a real browser's TLS fingerprint.
Commands
make requests with a browser fingerprint: one URL, or a list
measure the browser installed on this machine
diff this library's handshake against the browser's
list the profiles that can be impersonated
run a proxy that re-sends every request with the fingerprint
run the local fingerprint echo server
speak JSON lines on stdin/stdout
print the version
Run tls-forge <command> --help for a command's flags.
Start with tls-forge compare: it opens your browser, measures it, measures this library, and prints the differences. There should not be any.
fetch¶
What to fetch
--inputstringfile of URLs to fetch; a list piped to standard input is read when no URL is named
--urls-ustringURLs as a comma-separated list, instead of a file
--format-Fstringdefault "auto"how to read the list: auto, lines, json or csv
The request
--method-Xstringdefault "GET"HTTP method
--header-Hname: valueextra header, repeatable: -H "Authorization: Bearer …"
--data-dstringrequest body
--request-kindstringsend each request as Chrome sends this kind: navigation, form, fetch or xhr, from the page --initiator-url names; without it, a GET as a navigation typed into the address bar, with what -H gives, and another method or -d as an XHR of the root of the URL's own origin
--initiator-urlstringthe page a --request-kind request is sent from: a form, fetch and xhr need one, and a navigation without one is typed into the address bar
--clickeda person's click on the --initiator-url page sends the request, a link or a form's button, as Sec-Fetch-User says; without it the page's script navigates or submits the form
--formsend the request as the form a person's click submits, on the page --initiator-url names or on the root of the URL's own origin: a POST of urlencoded, multipart or text/plain fields, or a GET with them in the URL
Fingerprint and transport
--profile-pstringprofile to impersonate; without one, chrome: the newest Chrome, shipped or kept on this machine
--random-profilewear, for each request, a profile drawn at random from every browser measured, shipped or kept on this machine, that this tls-forge can wear; a request keeps its profile for all of its tries
--timeout-tdurationdefault 30srequest timeout
--insecure-kskip certificate verification
--dns-serverstringlook names up with the DNS server at this IP address (and port, else 53), addresses and HTTPS records alike, instead of the machine's; for direct connections, as a proxy looks up its own
Proxy
--proxy-xstringproxy URL, e.g. http://user:pass@host:port
--proxy-envTLSFORGE_PROXYname of an environment variable holding the proxy URL, such as TLSFORGE_PROXY, which keeps its password off the command line; no variable is read unless named
--exit-headersstringa JSON file laid over the exit header fields built in: one of the same key replaces ours, "off" takes ours out, the rest are added
--exit-lookupask address services where the run comes out; with reports/output also enable site probes and proxy-name resolution; services verify TLS even with --insecure
--no-exit-lookupexplicitly keep the default: no address service, site probe or proxy-name resolution; passive proxy fields are still read
Session
--cookie-bname=valuecookie as name=value, repeatable
--cookiesstringfile of warmed cookies to start from
--cookie-setstringwhich set in that file to use; one at random when not named
--save-cookiesstringwrite the session this run ends with here; .txt writes a cookies.txt
Running
--concurrency-cintdefault 4requests to run at once; one URL is asked for one at a time unless this is given
--retryinttimes to ask again when the answer is not a 2xx, or does not come
--retry-as-browserask again as Chrome does when the page is reloaded (Ctrl+R): to the URL the answer is at, on the connection it came on, asking for it afresh, with the cookies and client hints it set; fetch and xhr are sent again as their page's script sends them; needs --retry and a client-scope profile
--repeatintdefault 1times to make each request
--reuse-connectionkeep a private client per input row across repeats and tries; requires a client-scope profile
--fresh-connectionclose each worker's idle connections after every try in client scope; redundant with request isolation
--wait-forstringcount an answer as the page when its body has this text in it, whatever its status, or, written as /regexp/ with any of the flags i, m, s and U, text this regular expression matches
--wait-for-elementstringcount an answer as the page when its HTML has an element matching this CSS selector, whatever its status; the HTML as it came: no script runs
--html-decodingstringdefault "legacy"how --wait-for and --wait-for-element read a body as text: legacy, by its byte order mark or Content-Type, else as UTF-8 when it is UTF-8 throughout, whatever a <meta> says; or browser, as Chrome 155 decodes the document, by those, then what a document of its type names in itself
Output
--output-ostringkeep every request in this directory: its page, a log of it and a trace of it, and a log of the run
--clear-output-dirempty the --output directory before the run writes into it: every file and directory in it
--pcapwith --output, keep beside each request's files the connections it went out on, as NAME.pcapng: every byte each way and the TLS secrets that open them, so that Wireshark reads it as it was sent, and so does anybody else who has it
--include-iprint the status and response headers; with JSON lines, add the headers to each
--jsonwrite a line of JSON for each request rather than the page, as for a list
--print-bodyprint the output on stdout even when that is a terminal, or when --output has the page
--verbose-vprint a line for every request as it finishes
--progressstringdefault "auto"live status on stderr: auto, always or never
--colorstringdefault "auto"colour the status by outcome: auto, always or never
Report, trace and log
--report-Rstring[="auto"]write a report of the run into --output, or here, as report-<date-time>; --report=PATH says where
--report-formatstringwhat to write the report as: html, json, or html,json for both; by default json for a --report=PATH ending in .json, and html otherwise
--tracestringwrite every step of the run here as Trace Event JSON, for ui.perfetto.dev
--logstringwrite every step of the run here as it happens: each request, the connections it went out on and what came back; - is standard error, and a name ending in .json, .jsonl or .ndjson gets JSON lines. With --output, a run-<time>.log in it unless this names another
--log-levelstringdefault "trace"how much the log says: error, warn, info, debug, or trace, which adds every TLS handshake, certificate and HTTP/2 frame
--keylogstringadd the TLS secrets of every connection the run makes, to its sites and its proxy, to this file, as browsers do to the one SSLKEYLOGFILE names: Wireshark given it reads a capture of the run as plainly as it was sent, and so does anybody else who has it
| Example | |
|---|---|
capture¶
Flags
--browser-bstringbrowser to measure: chrome, chromium, edge, brave, or a path
--headlessrun the browser without a window
--save-sstringwrite a reusable profile here; a directory gets <name>/<platform>.json
--installkeep the profile in this machine's own directory, where --profile finds it by name
--name-nstringprofile name (default: browser version; manual_ prefix with --manual)
--json-jprint the raw capture instead of a summary
--timeout-tdurationdefault 2m0show long to wait for the browser; with --manual, ten minutes unless given
--browser-argstringArrayextra flag for the browser, repeatable; for the machine, not the measurement
--manualmeasure a browser you open the page in yourself, which nothing here can launch: Firefox, Safari, a phone's
--addrstringdefault "127.0.0.1:0"with --manual, where to listen; 0.0.0.0:8443 lets in a phone on this network
--hoststringdefault "localhost"with --manual, the name or address the page is opened at, which its certificate is made for
--policy-fromstringfull profile or file whose unmeasured policies the capture inherits (default: newest shipped same family/platform)
--provenance-dirstringdirectory for separate provenance JSON (default: provenance subtree, never a profile file)
--setstringArraywith --save or --install, a value the profile keeps of this machine, NAME=VALUE as its header carries it; again for more
| Example | |
|---|---|
Response
────────────────────────────────────────────────────────────────────────
user-agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) … HeadlessChrome/157.0.0.0 Safari/537.36
JA4 t13d1517h2_8daaf6152771_cb7bf5808d99
JA3 hash 27da79ce232c1b9b70150145293bcdd7
ALPN h2, http/1.1
HTTP/2 1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p
…
client hints 21 of the 21 a server asks for, sent when asked
────────────────────────────────────────────────────────────────────────
Re-run with --install to keep this profile, or --save <path> to write it out.
compare¶
Flags
--profile-pstringdefault "chrome"profile to check
--browser-bstringbrowser to compare against
--headlessrun the browser without a window
--json-jprint both captures and the diff as JSON
--color-cstringdefault "auto"colourise the diff: auto, always or never
--full-fprint matching values in full; differing ones always are
--timeout-tdurationdefault 2m0show long to wait for the browser; with --manual, ten minutes unless given
--browser-argstringArrayextra flag for the browser, repeatable; for the machine, not the measurement
--manualmeasure a browser you open the page in yourself, which nothing here can launch: Firefox, Safari, a phone's
--addrstringdefault "127.0.0.1:0"with --manual, where to listen; 0.0.0.0:8443 lets in a phone on this network
--hoststringdefault "localhost"with --manual, the name or address the page is opened at, which its certificate is made for
| Example | |
|---|---|
Response
--- browser Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) … HeadlessChrome/157.0.0.0 Safari/537.36
Google Chrome 157.0.8103.39, macOS 27.0.1, arm 64, headless
+++ client profile chrome_157_macos
…
TLS
ja4 t13d1517h2_8daaf6152771_cb7bf5808d99
…
HTTP/2
http2_akamai 1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p
…
- header_values …, user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) … HeadlessChrome/157.0.0.0 Safari/537.36, …
+ header_values …, user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) … Chrome/157.0.0.0 Safari/537.36, …
…
2 field(s) differ. Fix by measuring this browser and using the profile
it produces:
tls-forge capture --save my-browser.json
profiles¶
This command takes no flags.
| Example | |
|---|---|
Response
Measured from a real browser.
* kept on this machine, and used ahead of anything shipped
< what you get when no profile is named
chrome_151
…
chrome_157
chrome_157_linux
chrome_157_macos <
chrome_157_windows
From the tls-client catalogue, a handshake but no headers of its own:
…
Measure your own with: tls-forge capture --install
Kept on this machine in: …/Library/Application Support/tls-forge/profiles
proxy¶
Flags
--profile-pstringprofile to impersonate; without one, chrome: the newest Chrome, shipped or kept on this machine
--proxy-xstringproxy URL, e.g. http://user:pass@host:port
--proxy-envTLSFORGE_PROXYname of an environment variable holding the proxy URL, such as TLSFORGE_PROXY, which keeps its password off the command line; no variable is read unless named
--timeout-tdurationdefault 30srequest timeout
--insecure-kskip certificate verification
--dns-serverstringlook names up with the DNS server at this IP address (and port, else 53), addresses and HTTPS records alike, instead of the machine's; for direct connections, as a proxy looks up its own
--addr-astringdefault "127.0.0.1:8080"listen address
--ca-certstringcertificate authority to sign with (default: alongside the config)
--ca-keystringthe authority's key
--quiet-qdo not report per-connection failures
--max-request-bodyintdefault 16777216largest request body to buffer, in bytes
| Example | |
|---|---|
serve¶
Flags
--addr-astringdefault "127.0.0.1:0"listen address
--hoststringdefault "localhost"hostname used in the URL and certificate
--session-ticketsallow TLS session resumption
| Example | |
|---|---|
daemon¶
Flags
--cookie-bname=valuecookie as name=value, repeatable
--cookiesstringfile of warmed cookies to start from
--cookie-setstringwhich set in that file to use; one at random when not named
--profile-pstringprofile to impersonate; without one, chrome: the newest Chrome, shipped or kept on this machine
--proxy-xstringproxy URL, e.g. http://user:pass@host:port
--proxy-envTLSFORGE_PROXYname of an environment variable holding the proxy URL, such as TLSFORGE_PROXY, which keeps its password off the command line; no variable is read unless named
--timeout-tdurationdefault 30srequest timeout
--insecure-kskip certificate verification
--dns-serverstringlook names up with the DNS server at this IP address (and port, else 53), addresses and HTTPS records alike, instead of the machine's; for direct connections, as a proxy looks up its own
--proxy-stdintake the proxy URL from the first line of standard input, an init line, which keeps it off the command line and out of the environment
| Example | |
|---|---|