public static void Startup(int iListenPort, bool bRegisterAsSystemProxy, bool bDecryptSSL, bool bAllowRemote) { SDVPStartupFlags oFlags = SDVPStartupFlags.Default; if (bRegisterAsSystemProxy) { oFlags |= SDVPStartupFlags.RegisterAsSystemProxy; } else { oFlags &= ~SDVPStartupFlags.RegisterAsSystemProxy; } if (bDecryptSSL) { oFlags |= SDVPStartupFlags.DecryptSSL; } else { oFlags &= ~SDVPStartupFlags.DecryptSSL; } if (bAllowRemote) { oFlags |= SDVPStartupFlags.AllowRemoteClients; } else { oFlags &= ~SDVPStartupFlags.AllowRemoteClients; } Startup(iListenPort, oFlags); }
public static void Startup(int iListenPort, SDVPStartupFlags oFlags) { if (oProxy != null) { throw new InvalidOperationException("Calling startup twice without calling shutdown is not permitted."); } if ((iListenPort < 0) || (iListenPort > 0xffff)) { throw new ArgumentOutOfRangeException("bListenPort", "Port must be between 0 and 65535."); } Browser.ListenPort = iListenPort; Browser.bAllowRemoteConnections = SDVPStartupFlags.None < (oFlags & SDVPStartupFlags.AllowRemoteClients); Browser.bMITM_HTTPS = SDVPStartupFlags.None < (oFlags & SDVPStartupFlags.DecryptSSL); Browser.bCaptureCONNECT = true; Browser.bForwardToGateway = SDVPStartupFlags.None < (oFlags & SDVPStartupFlags.ChainToUpstreamGateway); Browser.bHookAllConnections = SDVPStartupFlags.None < (oFlags & SDVPStartupFlags.MonitorAllConnections); if (SDVPStartupFlags.None < (oFlags & SDVPStartupFlags.CaptureLocalhostTraffic)) { Browser.sHostsThatBypassSDVP = Browser.sHostsThatBypassSDVP; } oProxy = new Proxy(true); if (oProxy.Start(Browser.ListenPort, Browser.bAllowRemoteConnections)) { if (iListenPort == 0) { Browser.ListenPort = oProxy.ListenPort; } if (SDVPStartupFlags.None < (oFlags & SDVPStartupFlags.RegisterAsSystemProxy)) { oProxy.Attach(true); } else if (SDVPStartupFlags.None < (oFlags & SDVPStartupFlags.ChainToUpstreamGateway)) { oProxy.CollectConnectoidAndGatewayInfo(); } } }