Skip to content

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.

tls-forge <command> [flags]

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

--inputstring
file of URLs to fetch; a list piped to standard input is read when no URL is named
--urls-ustring
URLs 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: value
extra header, repeatable: -H "Authorization: Bearer …"
--data-dstring
request body
--request-kindstring
send 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-urlstring
the 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
--clicked
a 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
--form
send 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-pstring
profile to impersonate; without one, chrome: the newest Chrome, shipped or kept on this machine
--random-profile
wear, 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 30s
request timeout
--insecure-k
skip certificate verification
--dns-serverstring
look 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-xstring
proxy URL, e.g. http://user:pass@host:port
--proxy-envTLSFORGE_PROXY
name 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-headersstring
a 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-lookup
ask 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-lookup
explicitly keep the default: no address service, site probe or proxy-name resolution; passive proxy fields are still read

Session

--cookiesstring
file of warmed cookies to start from
--save-cookiesstring
write the session this run ends with here; .txt writes a cookies.txt

Running

--concurrency-cintdefault 4
requests to run at once; one URL is asked for one at a time unless this is given
--retryint
times to ask again when the answer is not a 2xx, or does not come
--retry-as-browser
ask 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 1
times to make each request
--reuse-connection
keep a private client per input row across repeats and tries; requires a client-scope profile
--fresh-connection
close each worker's idle connections after every try in client scope; redundant with request isolation
--wait-forstring
count 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-elementstring
count 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-ostring
keep every request in this directory: its page, a log of it and a trace of it, and a log of the run
--clear-output-dir
empty the --output directory before the run writes into it: every file and directory in it
--pcap
with --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-i
print the status and response headers; with JSON lines, add the headers to each
--json
write a line of JSON for each request rather than the page, as for a list
--print-body
print the output on stdout even when that is a terminal, or when --output has the page
--verbose-v
print 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-formatstring
what 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
--tracestring
write every step of the run here as Trace Event JSON, for ui.perfetto.dev
--logstring
write 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
--keylogstring
add 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
tls-forge fetch [flags] [url...]
Example
tls-forge fetch -i https://example.com/
Response
200 https://example.com/
…
content-type: text/html; charset=utf-8
…

<!doctype html><html lang=en><head><meta charset=utf-8>…

capture

Flags

--browser-bstring
browser to measure: chrome, chromium, edge, brave, or a path
--headless
run the browser without a window
--save-sstring
write a reusable profile here; a directory gets <name>/<platform>.json
--install
keep the profile in this machine's own directory, where --profile finds it by name
--name-nstring
profile name (default: browser version; manual_ prefix with --manual)
--json-j
print the raw capture instead of a summary
--timeout-tdurationdefault 2m0s
how long to wait for the browser; with --manual, ten minutes unless given
--browser-argstringArray
extra flag for the browser, repeatable; for the machine, not the measurement
--manual
measure 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-fromstring
full profile or file whose unmeasured policies the capture inherits (default: newest shipped same family/platform)
--provenance-dirstring
directory for separate provenance JSON (default: provenance subtree, never a profile file)
--setstringArray
with --save or --install, a value the profile keeps of this machine, NAME=VALUE as its header carries it; again for more
tls-forge capture [flags]
Example
tls-forge capture --headless
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-bstring
browser to compare against
--headless
run the browser without a window
--json-j
print both captures and the diff as JSON
--color-cstringdefault "auto"
colourise the diff: auto, always or never
--full-f
print matching values in full; differing ones always are
--timeout-tdurationdefault 2m0s
how long to wait for the browser; with --manual, ten minutes unless given
--browser-argstringArray
extra flag for the browser, repeatable; for the machine, not the measurement
--manual
measure 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
tls-forge compare [flags]
Example
tls-forge compare --headless
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.

tls-forge profiles [flags]
Example
tls-forge profiles
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-pstring
profile to impersonate; without one, chrome: the newest Chrome, shipped or kept on this machine
--proxy-xstring
proxy URL, e.g. http://user:pass@host:port
--proxy-envTLSFORGE_PROXY
name 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 30s
request timeout
--insecure-k
skip certificate verification
--dns-serverstring
look 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-certstring
certificate authority to sign with (default: alongside the config)
--ca-keystring
the authority's key
--quiet-q
do not report per-connection failures
--max-request-bodyintdefault 16777216
largest request body to buffer, in bytes
tls-forge proxy [flags]
Example
tls-forge proxy --addr 127.0.0.1:8080
Response
proxy listening on 127.0.0.1:8080

  export HTTPS_PROXY=http://127.0.0.1:8080
  curl --proxy http://127.0.0.1:8080 --cacert '…/Library/Application Support/tls-forge/ca.pem' https://tls.browserleaks.com/json

…

Ctrl-C to stop.

serve

Flags

--addr-astringdefault "127.0.0.1:0"
listen address
--hoststringdefault "localhost"
hostname used in the URL and certificate
--session-tickets
allow TLS session resumption
tls-forge serve [flags]
Example
tls-forge serve
Response
https://localhost:58155
  /          a page that measures the browser that opens it
  /api/all   this connection's fingerprint, as JSON

The certificate is self-signed and generated for this run, so clients
must be told to accept it (curl -k, tlsforge --insecure).
Ctrl-C to stop.

daemon

Flags

--cookiesstring
file of warmed cookies to start from
--profile-pstring
profile to impersonate; without one, chrome: the newest Chrome, shipped or kept on this machine
--proxy-xstring
proxy URL, e.g. http://user:pass@host:port
--proxy-envTLSFORGE_PROXY
name 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 30s
request timeout
--insecure-k
skip certificate verification
--dns-serverstring
look 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-stdin
take 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
tls-forge daemon [flags]
Example
echo '{"id":1,"engine_major":1,"url":"https://example.com/"}' | tls-forge daemon
Response
{"id":1,"status":200,"url":"https://example.com/","body":"\u003c!doctype html\u003e…","headers":{…,"content-type":["text/html; charset=utf-8"],…},"cookies":[]}

version

This command takes no flags.

tls-forge version [flags]
Example
tls-forge version
Response
tls-forge v1.0.1