private void button3_Click(object sender, EventArgs e) { if (directorio.Text == "" || !Directory.Exists(directorio.Text)) { MessageBox.Show(Traducir("No se encuentra el directorio.")); return; } if (ruta.Text == "") { MessageBox.Show(Traducir("Debe indicar una ruta virtual.")); return; } if (serverPaths.Where(sp => sp.Path == ruta.Text).Count() > 0) { MessageBox.Show(Traducir("Ya existe esa ruta.")); return; } GusScriptPath path = new GusScriptPath(ruta.Text, directorio.Text, "index.gsc", true); serverPaths.Add(path); server.AddPath(path); SalvarPaths(); RefrescarPaths(); }
void IniciarTor() { if (torController != null) { torController.Dispose(); } torController = new GusTorController(); if (torController.Start(8192, 8193)) { if (torController.Autheticate()) { direccionServicio = torController.RegisterHiddenService("servicio", 80, IPAddress.Parse("127.0.0.1"), 8190); if (direccionServicio == null) { MessageBox.Show(Traducir("No se pudo registrar el servicio de TOR, no se podrá acceder a tu servidor.")); } else { bridge = new GusMainServer(8191, false); if (!bridge.Start()) { MessageBox.Show(Traducir("Error creando puente HTTP")); torController.Dispose(); torController = null; bridge = null; return; } bridge.AddPath(bridgePath); servicioTor.Text = direccionServicio; } button1.Enabled = false; button2.Enabled = true; button6.Enabled = true; } else { MessageBox.Show(Traducir("Fallo de autenticación de TOR!")); torController.Dispose(); torController = null; } } else { MessageBox.Show(Traducir("No se pudo iniciar TOR, verifica tu conexión a Internet.")); torController.Dispose(); torController = null; } }
public MainForm() { InitializeComponent(); if (!Directory.Exists(Application.StartupPath + "\\servicio")) { Directory.CreateDirectory(Application.StartupPath + "\\servicio"); } var process = Process.GetProcessesByName("tor"); foreach (var v in process) { v.Kill(); } Thread.Sleep(1000); server = new GusMainServer(8190, false); if (!server.Start()) { MessageBox.Show(Traducir("No se pudo arrancar el servidor, verifique que no haya otra instancia ejecutandose.")); tmrDead = new System.Windows.Forms.Timer(); tmrDead.Interval = 2000; tmrDead.Tick += new EventHandler(tmrDead_Tick); tmrDead.Enabled = true; return; } bridgePath = new GusBridgePath(IPAddress.Parse("127.0.0.1"), 8192, "", ""); serverPaths = Deserializar <List <GusScriptPath> >("paths"); RefrescarPaths(); foreach (var path in serverPaths) { server.AddPath(path); } cfg = Deserializar <Config>("config"); if (cfg.AutoBoot) { arrancarAuto.Checked = true; RegistryKey rkApp = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); rkApp.SetValue("GusNet Bundle", Application.ExecutablePath.ToString()); rkApp.Dispose(); } else { RegistryKey rkApp = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); rkApp.DeleteValue("GusNet Bundle", false); rkApp.Dispose(); } if (cfg.AutoTor) { iniciarTor.Checked = true; IniciarTor(); } save = true; }