01.
public
class
ProxyConfig
02.
{
03.
private
const
string
SecureEndpointHostname =
"localhost"
;
04.
private
readonly
int
_secureEndpointPort = 18888;
05.
06.
private
static
readonly
ICollection<Session> AllSessions =
new
List<Session>();
07.
08.
private
static
Fiddler.Proxy _secureEndpoint;
09.
10.
private
static
readonly
LoggerCnx Logger =
new
LoggerCnx();
11.
12.
public
void
SetupProxyListener()
13.
{
14.
// This is a workaround for known issue in .NET Core - https://github.com/dotnet/coreclr/issues/12668
15.
CultureInfo.DefaultThreadCurrentUICulture =
new
CultureInfo(
"en-US"
);
16.
17.
FiddlerApplication.BeforeRequest += session =>
18.
{
19.
// In order to enable response tampering, buffering mode MUST
20.
// be enabled; this allows FiddlerCore to permit modification of
21.
// the response in the BeforeResponse handler rather than streaming
22.
// the response to the client as the response comes in.
23.
session.bBufferResponse =
false
;
24.
lock
(AllSessions)
25.
{
26.
AllSessions.Add(session);
27.
}
28.
};
29.
30.
Logger.Info($
"Starting {FiddlerApplication.GetVersionString()}..."
);
31.
CONFIG.IgnoreServerCertErrors =
true
;
32.
CONFIG.bCaptureCONNECT =
true
;
33.
34.
FiddlerApplication.Prefs.SetBoolPref(
"fiddler.network.streaming.abortifclientaborts"
,
true
);
35.
36.
FiddlerCoreStartupFlags startupFlags = FiddlerCoreStartupFlags.Default;
37.
startupFlags = (startupFlags | FiddlerCoreStartupFlags.DecryptSSL);
38.
39.
FiddlerApplication.Startup(BaseConfiguration.ProxyPort, startupFlags);
40.
41.
Logger.Info(
"Created endpoint listening on port {0}"
, BaseConfiguration.ProxyPort);
42.
43.
Logger.Info(
"Starting with settings: [{0}]"
, startupFlags);
44.
Logger.Info(
"Gateway: {0}"
, CONFIG.UpstreamGateway.ToString());
45.
46.
// Create a HTTPS listener, useful for when FiddlerCore is masquerading as a HTTPS server
47.
// instead of acting as a normal CERN-style proxy server.
48.
_secureEndpoint = FiddlerApplication.CreateProxyEndpoint(_secureEndpointPort,
true
, SecureEndpointHostname);
49.
if
(
null
!= _secureEndpoint)
50.
{
51.
Logger.Info(
"Created secure endpoint listening on port {0}, using a HTTPS certificate for '{1}'"
, _secureEndpointPort, SecureEndpointHostname);
52.
}
53.
}
54.
}
Trying to capture all traffic from browser using FiddlerCore using the .NetStandard libraries. Above is what I have.
Everything seems to work fine on Windows, all traffic is captured, HTTP and HTTPS.
The problem arises when I'm trying to do the same when running the code on Linux (tried it on both VM and Linux conainer, Ubuntu 16.04).
Any idea what I'm I'm missing?