Skip to content

About

Send HTTP requests the way another client does: its TLS ClientHello, HTTP/2 setup and header encoding

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

impersonate

Sends HTTP requests the way another client sends them: its TLS ClientHello, its HTTP/2 connection setup and flow control, and its header encoding. A request sent as Prowlarr looks like Prowlarr's on the wire, not only in its headers.

Profiles

Profile Client Stack Protocol
prowlarr Prowlarr 3 .NET 10 on the image's OpenSSL 3.5 HTTP/2, HTTP/1.1
radarr Radarr 7 .NET 8 on OpenSSL 3.5 HTTP/2, HTTP/1.1
sonarr Sonarr 4 .NET 6 on OpenSSL 3.5 HTTP/2, HTTP/1.1
nzbhydra2 NZBHydra2 9 OkHttp 4.11 on Java's TLS HTTP/2, HTTP/1.1
sabnzbd SABnzbd 5 Python's urllib on OpenSSL 3.5 HTTP/1.1
nzbget NZBGet 26 its own downloader on OpenSSL 3.5 HTTP/1.0
chrome Chrome 157 BoringSSL HTTP/2, HTTP/1.1

The servers and *arr apps are the LinuxServer.io Docker images. Each profile covers:

  • TLS: the ClientHello's ciphers, extensions and their order, groups, key shares, signature algorithms, ALPN and record version, with GREASE and extension shuffling where the client does them. Session tickets are resumed where the client resumes them.
  • HTTP/2: SETTINGS and their order, the connection window, priorities, the first stream id, pseudo-header order, HPACK indexing and Huffman choices, and how the client returns window and sends pings.
  • HTTP/1: the request line version. Header names, values and order come from the caller, with a Host entry marking where the client writes its Host line. Over HTTP/2 that becomes :authority.

Every value was taken from a recording of the real client.

Running it

go install github.com/AIOStreams/impersonate/cmd/impersonate@latest

impersonate fetch sends requests from the command line, in order and over the same connections:

impersonate fetch -profile nzbhydra2 \
  -H 'Accept: application/xml' -H 'User-Agent: NZBHydra2 9.3.3' \
  -H 'Content-Type: application/xml' -H 'Host: indexer.example' \
  -H 'Connection: Keep-Alive' -H 'Accept-Encoding: gzip' \
  'https://indexer.example/api?apikey=KEY&t=caps'

Run without a subcommand, it takes requests from the process that started it. It reads a token from the first line of stdin, listens on a free port on 127.0.0.1, prints listening <host:port> and serves requests there until stdin closes. The request protocol is described in internal/bridge. Certificates are checked against the system roots and NODE_EXTRA_CA_CERTS, and not at all when NODE_TLS_REJECT_UNAUTHORIZED is 0, so a Node parent's settings carry over.

License

MIT

About

Send HTTP requests the way another client does: its TLS ClientHello, HTTP/2 setup and header encoding

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages