public override void Execute(CommandEventArgs e, object obj) { Mobile from = e.Mobile; Mobile targ = (Mobile)obj; NetState state = targ.NetState; if (state != null) { CommandLogging.WriteLine(from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ)); try { Firewall.Add(state.Address); AddResponse("They have been firewalled."); } catch (Exception ex) { LogFailure(ex.Message); } } else { LogFailure("They are not online."); } }
private void addbtn_Click(object sender, EventArgs e) { try{ if (switchButton1.Value) { Firewall.Add("AllowAll", filetxt.Text); LabelItem lb = new LabelItem(); lb.Text = filetxt.Text + "|AllowAll"; lb.Name = "lb" + itemPanel1.Items.Count.ToString(); itemPanel1.Items.Add(lb); } else { Firewall.Add("DenyAll", filetxt.Text); LabelItem lb = new LabelItem(); lb.Text = filetxt.Text + "|DenyAll"; lb.Name = "lb" + itemPanel1.Items.Count.ToString(); itemPanel1.Items.Add(lb); } } catch (Exception ex) { AntiCrash.LogException(ex); } finally { } }
static void Firewall_AccessDenied(string username, string app, string protocol, string source, string destination, string direction) { try { if (!Firewall.Apps.Contains(app)) { if (!SettingsManager.Silence) { Firewall.Apps.Add(app); KavprotVoice.SpeakAsync("Would you like to allow this network access"); DevComponents.DotNetBar.TaskDialogInfo inf = new DevComponents.DotNetBar.TaskDialogInfo(); inf.DialogButtons = DevComponents.DotNetBar.eTaskDialogButton.Yes | DevComponents.DotNetBar.eTaskDialogButton.No; inf.Title = "Firewall Rule"; inf.Text = "An application is trying to connect to a remote host (" + destination + ") via " + protocol + " protocol. \n " + Path.GetFileName(app) + "\n do you want to authorize this connection?"; inf.TaskDialogIcon = DevComponents.DotNetBar.eTaskDialogIcon.Exclamation; inf.Header = "Application Connection"; inf.FooterText = "Kavprot smart security"; inf.DialogColor = DevComponents.DotNetBar.eTaskDialogBackgroundColor.Silver; DevComponents.DotNetBar.eTaskDialogResult dl = DevComponents.DotNetBar.TaskDialog.Show(inf); if (dl == DevComponents.DotNetBar.eTaskDialogResult.Yes) { Firewall.Add("AllowAll", app); } else { Firewall.Add("DenyAll", app); } } else { Firewall.Apps.Add(app); if (!Scanner.CheckReputation(app)) { Firewall.Add("AllowAll", app); } else { Firewall.Add("DenyAll", app); } } } } catch (Exception ex) { AntiCrash.LogException(ex); } finally { } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile) { Mobile targ = (Mobile)targeted; GameClient state = targ.Client; if (state != null) { CommandLogging.WriteLine(from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted)); Firewall.Add(state.Address); } } }
public override void Execute(CommandEventArgs e, object obj) { Mobile from = e.Mobile; Mobile targ = (Mobile)obj; GameClient state = targ.Client; if (state != null) { CommandLogging.WriteLine(from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ)); Firewall.Add(state.Address); AddResponse("They have been firewalled."); } else { LogFailure("They are not online."); } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile) { Mobile targ = (Mobile)targeted; NetState state = targ.NetState; if (state != null) { CommandLogging.WriteLine(from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted)); try { Firewall.Add(((IPEndPoint)state.Socket.RemoteEndPoint).Address); } catch { } } } }