public void SendInjectorSettings(Uri uri) { Program.Logger.WriteLine($"Sending information to injector ({uri})..."); var channel = IPCUtil.CreateChannel <IInjectorService>(Settings.IPCType, uri.ToString()); if (Program.OverridePublicKey) { channel.SetDonationKey(Program.GenerateDonationKey()); channel.SetPublicKey(Program.PublicKey); } if (Settings.TitleKeys.Count == 0) { channel.ForceKeySiteForm(); } channel.TrustCertificateAuthority(CertMaker.GetRootCertificate().GetRawCertData()); channel.SetProxy(Program.Proxy.GetWebProxy().Address.ToString()); channel.SetDownloaderMaxRetries(Settings.MaxRetries); channel.SetDownloaderRetryDelay(Settings.DelayBetweenRetries); channel.SetDisableOptionalPatches(Settings.DisableOptionalPatches); channel.SetDisableTabs(Settings.DisableTabs); channel.SetLocaleFile(Program.Locale.LocaleFile); channel.SetEshopRegion(Program.Locale.ChosenLocale.Split('-')[1]); channel.SetDefaultFont(Settings.DefaultFont); channel.SetHelperVersion(Program.HelperVersion); channel.SetPortable(Settings.Portable); channel.SetForceHttp(Settings.ForceHttp); channel.SetFunAllowed(!Settings.NoFunAllowed); channel.SetPlayMusic(Settings.BackgroundMusic); channel.SetSplitUnpackDirectories(Settings.SplitUnpackDirectories); channel.SetWineCompat(Program.WineCompat); }
private static void EnsureRootCertificate() { BCCertMaker.BCCertMaker certProvider = new BCCertMaker.BCCertMaker(); CertMaker.oCertProvider = certProvider; // On first run generate root certificate using the loaded provider, then re-use it for subsequent runs. string rootCertificatePath = Path.Combine(assemblyDirectory, "..", "..", "RootCertificate.p12"); string rootCertificatePassword = "******"; if (!File.Exists(rootCertificatePath)) { certProvider.CreateRootCertificate(); certProvider.WriteRootCertificateAndPrivateKeyToPkcs12File(rootCertificatePath, rootCertificatePassword); } else { certProvider.ReadRootCertificateAndPrivateKeyFromPkcs12File(rootCertificatePath, rootCertificatePassword); } // Once the root certificate is set up, ensure it's trusted. if (!CertMaker.rootCertIsTrusted()) { CertMaker.trustRootCert(); } }
public static bool ValidateCertificates() { if (!CertMaker.rootCertExists()) { Log(LogMessageType.Error, "Root certificate does not exist"); _certificatesValid = false; return(false); //Log(LogMessageType.Information, "Root certificate does not exist -> Creating"); //if (!CertMaker.createRootCert()) //{ // Log(LogMessageType.Error, "Creation of root certificate failed."); // _certificatesValid = false; // return false; //} } if (!CertMaker.rootCertIsTrusted() && !CertMaker.rootCertIsMachineTrusted()) { Log(LogMessageType.Error, "Root certificate is not trusted"); _certificatesValid = false; return(false); //Log(LogMessageType.Information, "Root certificate is not trusted -> Trusting"); //if (!CertMaker.trustRootCert()) //{ // Log(LogMessageType.Error, "Trusting root certificate failed."); // _certificatesValid = false; // return false; //} } _certificatesValid = true; return(true); }
public static bool InstallCertificate() { if (!CertMaker.rootCertExists()) { Console.WriteLine("** Rootcert does not exist"); if (!CertMaker.createRootCert()) { Console.WriteLine("** Creating root cert"); return(false); } if (!CertMaker.trustRootCert()) { Console.WriteLine("** Trusting root cert"); return(false); } Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings["FiddlerCert"].Value = FiddlerApplication.Prefs.GetStringPref("fiddler.certmaker.bc.cert", null); config.AppSettings.Settings["FiddlerKey"].Value = FiddlerApplication.Prefs.GetStringPref("fiddler.certmaker.bc.key", null); config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); } return(true); }
public void UpdateButtonStatus() { tbCapture.Enabled = !FiddlerApplication.IsStarted(); tbStop.Enabled = !tbCapture.Enabled; tbSave.Enabled = txtCapture.Text.Length > 0; tbClear.Enabled = tbSave.Enabled; if (CertMaker.rootCertExists()) { la_certState.Text = "Installed"; } else { la_certState.Text = "Don't Installed"; } if (!tbCapture.Enabled) { la_State.Text = "Started"; } else { la_State.Text = "Stopped"; } CaptureConfiguration.IgnoreResources = tbIgnoreResources.Checked; }
public static void Start(int port, string[] urlTexts, Action <string, string> action) { _port = port; _urlRegexText = string.Join("|", urlTexts); _action = action; //创建证书 CONFIG.bCaptureCONNECT = true; CONFIG.IgnoreServerCertErrors = false; if (!CertMaker.rootCertExists()) { if (!CertMaker.createRootCert()) { throw new Exception("Unable to create cert for FiddlerCore."); } X509Store certStore = new X509Store(StoreName.Root, StoreLocation.LocalMachine); certStore.Open(OpenFlags.ReadWrite); try { certStore.Add(CertMaker.GetRootCertificate()); } finally { certStore.Close(); } } FiddlerApplication.BeforeResponse += FiddlerApplication_BeforeResponse; FiddlerApplication.Startup(_port, true, true); Console.WriteLine("端口{0} 监听已启动...", _port); }
/// <summary> /// 安装、获取证书 /// </summary> private static void InstallCertificate0() { //生成证书 if (!CertMaker.rootCertExists()) { CertMaker.createRootCert(); CertMaker.trustRootCert(); } //获取证书 X509Certificate2 oRootcert = CertMaker.GetRootCertificate(); //把证书安装到受信任的根证书颁发机构 X509Store certStore = new X509Store(StoreName.Root, StoreLocation.LocalMachine); certStore.Open(OpenFlags.ReadWrite); try { certStore.Add(oRootcert); } finally { certStore.Close(); } //证书赋值 FiddlerApplication.oDefaultClientCertificate = oRootcert; //在解密HTTPS通信时,控制服务器证书错误是否被忽略。 CONFIG.IgnoreServerCertErrors = false; }
protected override void OnStartup(StartupEventArgs e) { DispatcherHelper.UIDispatcher = this.Dispatcher; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; // 証明書インストール if (!CertMaker.rootCertExists()) { CertMaker.createRootCert(); CertMaker.trustRootCert(); } // プロキシサーバー開始 FiddlerApplication.Startup(24791, true, true); this.MainWindow = new MainWindow() { DataContext = new MainWindowViewModel() }; this.MainWindow.ShowDialog(); // プロキシサーバー終了 URLMonInterop.ResetProxyInProcessToDefault(); FiddlerApplication.Shutdown(); }
public void Start() { // 証明書インストール if (!CertMaker.rootCertExists()) { CertMaker.createRootCert(); CertMaker.trustRootCert(); } // プロキシサーバー開始 FiddlerApplication.Startup(24791, true, true); FiddlerApplication.AfterSessionComplete += new SessionStateHandler((session) => { if (Regex.IsMatch(session.host, @".+\.omf-game\.jp")) { var contentType = session.ResponseHeaders.FirstOrDefault(x => x.Name == "Content-Type")?.Value; if (contentType == "application/json") { var fileName = Regex.Replace(session.url, @".*/(.+?)\?.+", "$1"); if (new[] { "battleresult", "battleraidbossresult" }.Contains(fileName)) { RegisterResult(session); } else if (fileName == "battlemain") { RegisterCharacterStatus(session); } } } }); }
public void SendInjectorSettings() { Program.Logger.WriteLine("Sending information to injector..."); var factory = new ChannelFactory <IInjectorService>(new NetNamedPipeBinding(), "net.pipe://localhost/InjectorService"); var channel = factory.CreateChannel(); if (Program.OverridePublicKey) { channel.SetDonationKey(Program.GenerateDonationKey()); channel.SetPublicKey(Program.PublicKey); } if (Settings.TitleKeys.Count == 0) { channel.ForceKeySiteForm(); } channel.TrustCertificateAuthority(CertMaker.GetRootCertificate().GetRawCertData()); channel.SetProxy(Program.Proxy.GetWebProxy().Address.ToString()); channel.SetDownloaderMaxRetries(Settings.MaxRetries); channel.SetDownloaderRetryDelay(Settings.DelayBetweenRetries); channel.SetDisableOptionalPatches(Settings.DisableOptionalPatches); channel.SetDisableWebSearchTab(Settings.DisableWebSearchTab); channel.SetLocaleFile(Program.Locale.LocaleFile); channel.SetHelperVersion(Program.HelperVersion); channel.SetPortable(Settings.Portable); }
private static void RemoveAllCertificates() { try { bool flag = false; if (CertMaker.rootCertIsMachineTrusted()) { var rootCertificate = CertMaker.GetRootCertificate(); if (rootCertificate != null) { var subject = rootCertificate.Subject; if (!String.IsNullOrEmpty(subject)) { flag = Utilities.RunExecutableAndWait(CONFIG.GetPath("App") + "TrustCert.exe", String.Format("-u \"{0}\"", subject)); } } } if (CertMaker.removeFiddlerGeneratedCerts() || flag) { //FiddlerApplication.DoNotifyUser(this, string.Format("Fiddler-generated certificates have been removed from {0}", flag ? "both User and Machine Root storage." : "the Current User storage."), "Success", MessageBoxIcon.Asterisk); } } catch (Exception exception) { FiddlerApplication.ReportException(exception, ""); } }
/// <summary> /// 设置证书 /// </summary> public static void SetRootCertificate() { if (Cert.Exists() == true) { var certString = File.ReadAllText(Cert.RootCert_Cer, Encoding.ASCII); var keyString = File.ReadAllText(Cert.RootCert_Key, Encoding.ASCII); FiddlerApplication.Prefs.SetStringPref("fiddler.certmaker.bc.cert", certString); FiddlerApplication.Prefs.SetStringPref("fiddler.certmaker.bc.key", keyString); } else { CertMaker.createRootCert(); var cert = CertMaker.GetRootCertificate(); var clientCer = cert.Export(X509ContentType.Cert); File.WriteAllBytes(Cert.Client_Cer, clientCer); var certString = FiddlerApplication.Prefs.GetStringPref("fiddler.certmaker.bc.cert", null); var keyString = FiddlerApplication.Prefs.GetStringPref("fiddler.certmaker.bc.key", null); File.WriteAllText(Cert.RootCert_Cer, certString, Encoding.ASCII); File.WriteAllText(Cert.RootCert_Key, keyString, Encoding.ASCII); } }
private void button2_Click(object sender, EventArgs e) { if (CertMaker.rootCertExists()) { try { CertMaker.removeFiddlerGeneratedCerts(true); } catch { MessageBox.Show("清理失败,请联系作者。"); } } }
private static void OnRemoveCertificate(object sender, EventArgs e) { DialogResult result = MessageBox.Show("The SSL certificate is required to intercept HTTPS requests from Wii U USB Helper. The launcher will not work without it.\nAre you sure you want to remove it?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes && CertMaker.removeFiddlerGeneratedCerts()) { Cleanup(); Application.Exit(); } }
protected byte[] GetCertificate() { X509Certificate2 cert = CertMaker.GetRootCertificate(); StringBuilder sb = new StringBuilder(); sb.AppendLine("-----BEGIN CERTIFICATE-----"); sb.AppendLine(Convert.ToBase64String(cert.Export(X509ContentType.Cert), Base64FormattingOptions.InsertLineBreaks)); sb.AppendLine("-----END CERTIFICATE-----"); return(System.Text.Encoding.ASCII.GetBytes(sb.ToString())); }
public static bool UninstallCertificate() { if (CertMaker.rootCertExists()) { if (!CertMaker.removeFiddlerGeneratedCerts(true)) { return(false); } } return(true); }
private void InstallFiddlerCertificate() { if (!CertMaker.rootCertExists()) { CertMaker.createRootCert(); } if (!CertMaker.rootCertIsTrusted()) { CertMaker.trustRootCert(); } }
public void UpdateButtonStatus() { tbCapture.Enabled = !FiddlerApplication.IsStarted(); tbStop.Enabled = !tbCapture.Enabled; tbSave.Enabled = txtCapture.Text.Length > 0; tbClear.Enabled = tbSave.Enabled; btnInstallSslCert.Enabled = !CertMaker.rootCertExists(); btnUninstallSslCert.Enabled = !btnInstallSslCert.Enabled; CaptureConfiguration.IgnoreResources = tbIgnoreResources.Checked; }
private void ButtonResetCert_Click(object sender, EventArgs e) { if (CertMaker.removeFiddlerGeneratedCerts(true)) { MessageBox.Show("All Certificates have been removed!\nPlease restart the Bot, for the changes to take affect!", "Unistalled Certificate.", MessageBoxButtons.OK, MessageBoxIcon.Information); Bot.Log("Uninstalled Fiddler certificates.", Color.Black); } else { Bot.Log("Couldn't remove certificates.", Color.Black); } }
public void Start() { // 加载证书,可以对HTTPS进行监控 if (!CertMaker.rootCertExists()) { bool k = CertMaker.createRootCert(); k = CertMaker.trustRootCert(); } FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest; //FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.CaptureLocalhostTraffic | FiddlerCoreStartupFlags.RegisterAsSystemProxy); FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.Default); }
public static bool UninstallCertificate() { if (CertMaker.rootCertExists()) { if (!CertMaker.removeFiddlerGeneratedCerts(true)) { return(false); } } App.Configuration.UrlCapture.Cert = null; App.Configuration.UrlCapture.Key = null; return(true); }
public static bool Uninstall() { // Determine if the self signed root certificate exists if (CertMaker.rootCertExists()) { // Removes Fiddler generated certificates. Parameter True for remove root if (!CertMaker.removeFiddlerGeneratedCerts(true)) { return(false); } } return(true); }
static void Main() { AppUpdater.RunUpdater(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); HelpTools.CoInternetSetFeatureEnabled(); HelpTools.UrlMkSetSessionOption("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"); CertMaker.createRootCert(); CertMaker.trustRootCert(); StartBrowserProxy(); Application.Run(new Form1()); }
public bool InstallCertificate() { if (!CertMaker.createRootCert()) { return(false); } if (!CertMaker.trustRootCert()) { return(false); } return(true); }
public static bool UninstallCertificate() { if (CertMaker.rootCertExists()) { if (!CertMaker.removeFiddlerGeneratedCerts(true)) { return(false); } } Properties.Settings.Default.Cert = ""; Properties.Settings.Default.Key = ""; Properties.Settings.Default.Save(); return(true); }
/// <summary> /// Starts the proxy /// </summary> public void Start() { //Stops everything before start Stop(); CONFIG.IgnoreServerCertErrors = false; CertMaker.trustRootCert(); foreach (var filter in ProxyFilters) { FiddlerApplication.BeforeRequest += filter.BeforeRequest; FiddlerApplication.BeforeResponse += filter.BeforeResponse; } FiddlerApplication.Startup(Port, true, DecryptSsl); }
public static void Setup(TestContext context) { // Check certificates if (!CertMaker.rootCertIsTrusted()) { CertMaker.trustRootCert(); } // Start proxy server (to simulate man in the middle attacks) FiddlerApplication.Startup( 8877, /* Port */ true, /* Register as System Proxy */ true, /* Decrypt SSL */ false /* Allow Remote */ ); }
private static void DecryptHttps() { CertMaker.EnsureReady(); if ((CertMaker.rootCertExists() || CertMaker.createRootCert()) && !CertMaker.rootCertIsTrusted()) { var flag = CertMaker.trustRootCert(); if (!flag) { //FiddlerApplication.DoNotifyUser(this, "Unable to configure Windows to Trust the Fiddler Root certificate.\n\nThe LOG tab may contain more information.", "Certificate Trust", MessageBoxIcon.Exclamation); } if (flag && FiddlerApplication.Prefs.GetBoolPref("fiddler.CertMaker.OfferMachineTrust", ((Environment.OSVersion.Version.Major > 6) || ((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor > 1))))) { var subject = CertMaker.GetRootCertificate().Subject; Utilities.RunExecutable(CONFIG.GetPath("App") + "TrustCert.exe", String.Format("\"{0}\"", subject)); } } }
private static void InstallCert() { try { if (!CertMaker.rootCertExists() && !CertMaker.createRootCert()) { throw new Exception("Could not create Root Certificate!"); } if (!CertMaker.rootCertIsTrusted() && !CertMaker.trustRootCert()) { throw new Exception("Could not find valid Root Certificate for Fiddler!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Certificate Installer Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private bool InstallCertificate() { if (!CertMaker.rootCertExists()) { CertMaker.removeFiddlerGeneratedCerts(true); if (!CertMaker.createRootCert()) { return(false); } if (!CertMaker.trustRootCert()) { return(false); } } return(true); }