Package org.microproxy.extras
package org.microproxy.extras
-
ClassDescriptionDecides which finished exchanges and flows an access log writes, with the semantics of Envoy's access-log filters:
AccessLogFilter.statusCode(org.microproxy.extras.AccessLogFilter.Comparison, int),AccessLogFilter.duration(org.microproxy.extras.AccessLogFilter.Comparison, long),AccessLogFilter.notHealthCheck(),AccessLogFilter.responseFlag(org.microproxy.ResponseFlag...),AccessLogFilter.header(java.lang.String),AccessLogFilter.runtime(double)sampling, and theAccessLogFilter.allOf(org.microproxy.extras.AccessLogFilter...)andAccessLogFilter.anyOf(org.microproxy.extras.AccessLogFilter...)combinators.An access-log line format, compatible with Envoy's access-log command operators: a format string such as[%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS%, or a JSON dictionary whose values are format strings.Where anActivityLoggerwrites its lines: a file it appends to, or standard output.AnActivityTrackerthat writes one access-log line per finished exchange or flow (ActivityTracker.flowEnded(org.microproxy.FlowRecord)), in anAccessLogFormat: one of theLogFormatpresets, or an Envoy-compatible format string or JSON dictionary.Builds anActivityLogger.Removes the request headers that let a server answer304 Not Modified(If-None-MatchandIf-Modified-Since), as mitmproxy'santicache, so that clients get whole responses, which other addons and recorders can then see.Blocks requests, as mitmproxy'sblock_list: the first rule whose filter matches answers the request with an empty response of its status, without contacting the server.BuildsBlockList.One rule: requests the filter matches get an empty response withstatus, or none.Sends recorded requests again, as mitmproxy'sclient_replay: each goes to the proxy's own listener as an ordinary client request, so every filter, addon, script, cache and recorder of the proxy applies to it, and the proxy reaches the server (over TLS forhttps://URLs).Configures aClientReplay.What a replay did.Limits how many exchanges run at once per key: per client address by default, or per user, per target host, or anything else a key function derives from the request and its client connection.Configures aConcurrencyLimiter.One key's state.Called for every request over the limit, refused or (in shadow mode) let through.Makes the answer to a refused request;nullsends the default429.The limiter's state at one moment.A flow filter expression, in the syntax of mitmproxy's filters, which the addons (MapLocal,MapRemote,ModifyBody,ModifyHeaders,BlockList,AntiCache,StickyCookie,HarRecorder) take to choose the exchanges they act on.An exchange as filters see it: the request, the response once there is one, and the bodies when they have been buffered.Records exchanges as an HTTP Archive (HAR 1.2), as mitmproxy'shardump/save.hardo, for browsers' developer tools, HAR viewers andServerReplay.Configures aHarRecorder.Logs whole requests and responses for debugging and audits, like OkHttp'sHttpLoggingInterceptoror a mitmproxy flow dump.Configures anHttpLogger.How messages are written.How much of each message to log.Named access-log formats forActivityLogger, each a preset ofAccessLogFormat: an Envoy-compatible format string (or JSON dictionary) shown on each constant.Answers requests from local files, as mitmproxy'smap_local.BuildsMapLocal.One rule: requests the filter selects whose URL contains a match ofpatternare answered frompath.Sends requests to another URL, as mitmproxy'smap_remote: each rule replaces every match of a regular expression in the request's absolute URL, and the request goes to the result.BuildsMapRemote.One rule: requests the filter matches have every match ofpatternin their URL replaced.Replaces text in request and response bodies, as mitmproxy'smodify_body: every match of a regular expression in the decoded body becomes the replacement, in the messages a rule's filter selects.BuildsModifyBody.One rule: a regular expression to replace in the bodies a filter selects.Sets and removes headers, as mitmproxy'smodify_headers.One rule: a header to replace on the messages a filter matches.A recorded exchange, read from a HAR file (asHarRecorder, browsers and mitmproxy write them) or a WARC file (asWarcRecorderwrites them), forServerReplayandClientReplay.Declarative request/response rewriting: an ordered list ofRewriteRules.Rules, each matching URLs by regular expression and editing headers and textual response bodies.BuildsRewriteRules.One rewrite rule: a URL pattern plus edits.Answers requests from recorded responses instead of contacting servers, as mitmproxy'sserver_replay.Configures aServerReplay.What happens to requests without a recording, as mitmproxy'sserver_replay_extra.A response answered from a recording, which the proxy reports asResponseSource.REPLAY.Remembers the cookies servers set and sends them with later requests, as mitmproxy'sstickycookie, so that a session started in one client carries over to others (a browser and a command-line tool, or replayed requests).TLS client fingerprints of aClientHello, as access logs show them (%TLS_JA3_FINGERPRINT%,%TLS_JA4_FINGERPRINT%): JA3, the MD5 of the hello's version, cipher suites, extensions, groups and point formats, and JA4, a readable prefix and two truncated SHA-256 hashes of the sorted cipher suites and extensions.