I'm trying to intercept HTTP/HTTPS traffic from a Windows application using Titanium Web Proxy in my C# app.
My C# app sets up an explicit proxy on port 8888 and captures most HTTPS requests just fine (e.g., from login.live.com, events.data.microsoft.com, etc.). However, traffic to what i need is never seen in my proxy.
What's confusing is: If I use Fiddler Classic, I can see the traffic to the api. So I know the traffic exists and isn't encrypted in a way that makes interception impossible.
proxyServer = new ProxyServer();
proxyServer.CertificateManager.CreateRootCertificate();
proxyServer.CertificateManager.TrustRootCertificateAsAdmin();
proxyServer.CertificateManager.EnsureRootCertificate();
proxyServer.EnableConnectionPool = true;
var explicitEndPoint = new ExplicitProxyEndPoint(System.Net.IPAddress.Any, 8888, true);
proxyServer.AddEndPoint(explicitEndPoint);
proxyServer.Start();
proxyServer.SetAsSystemHttpProxy(explicitEndPoint);
proxyServer.SetAsSystemHttpsProxy(explicitEndPoint);
proxyServer.BeforeRequest += OnRequest;
proxyServer.BeforeResponse += OnResponse;
```
private static async Task OnRequest(object sender, SessionEventArgs e)
{
Console.WriteLine($"[Request] {e.HttpClient.Request.Url}");
await Task.CompletedTask;
}
private static async Task OnResponse(object sender, SessionEventArgs e)
{
Console.WriteLine($"[Response] {e.HttpClient.Request.Url}");
await Task.CompletedTask;
}