//public IEnumerable<FirewallHelper.Rule> FirewallRule { get { return FirewallHelper.GetMatchingRules(Path, Protocol, RemoteAddress, RemotePort, LocalPort, (Owner != ProcName ? new[] { Owner } : null), false).ToList(); } } internal void UpdateValues(IPHelper.I_OWNER_MODULE b) { //lvi.LocalAddress = b.LocalAddress; //lvi.Protocol = b.Protocol; if (this.RemoteAddress != b.RemoteAddress) { this.RemoteAddress = b.RemoteAddress; } var newPort = (b.RemotePort == -1 ? String.Empty : b.RemotePort.ToString()); if (this.RemotePort != newPort) { this.RemotePort = newPort; } var newState = Enum.GetName(typeof(IPHelper.MIB_TCP_STATE), b.State); if (this.State != newState) { this.State = newState; } this.LastSeen = DateTime.Now; }
public Connection(IPHelper.I_OWNER_MODULE ownerMod) { PID = ownerMod.OwningPid; IsNew = true; this._localPort = ownerMod.LocalPort.ToString(); this.CreationTime = ownerMod.CreationTime; this._localAddress = ownerMod.LocalAddress; this._protocol = ownerMod.Protocol; this._remoteAddress = ownerMod.RemoteAddress; this._remotePort = (ownerMod.RemotePort == -1 ? String.Empty : ownerMod.RemotePort.ToString()); this.LastSeen = DateTime.Now; this._state = Enum.GetName(typeof(IPHelper.MIB_TCP_STATE), ownerMod.State); try { // Mainly for non-admin users, could use Process.GetProcessById for admins... var r = ProcessHelper.GetProcessOwnerWMI((int)ownerMod.OwningPid, ref LocalOwnerWMICache); Path = r[1] ?? "Unknown"; //FIXME: Move to resources! ProcName = r[0] ?? "Unknown"; //FIXME: Use something else? } catch { ProcName = "[Unknown or closed process]"; //FIXME: Move to resources! Path = "Unresolved"; //FIXME: Use something else? } if (ownerMod.OwnerModule == null) { if (PID == 0) { ProcName = "System"; Owner = "System"; Path = "System"; Icon = IconHelper.GetIcon("System", true); } else { Owner = "Unknown"; Icon = IconHelper.GetIcon("?error", true); } } else { Icon = ownerMod.OwnerModule.Icon; Owner = ownerMod.OwnerModule.ModuleName; } GroupKey = String.Format("{0} ({1}) - [{2}]", ProcName, Path, PID); }
private void AddOrUpdateConnection(IPHelper.I_OWNER_MODULE b) { var ic = _connectionsRoutes.Count % LineChart.ColorsDic.Count; var br = new SolidColorBrush(LineChart.ColorsDic[ic]); GeoConnection2 existingRoute = _connectionsRoutes.SingleOrDefault(l => l.RemoteAddress.Equals(b.RemoteAddress)); if (existingRoute == null) { _connectionsRoutes.Add(new GeoConnection2(b) { Brush = br }); } }
private void AddOrUpdateConnection(IPHelper.I_OWNER_MODULE b) { Connection lvi = lstConnections.SingleOrDefault(l => l.PID == b.OwningPid && l.Protocol == b.Protocol && l.LocalPort == b.LocalPort.ToString()); if (lvi != null) { if (DateTime.Now.Subtract(lvi.LastSeen).TotalMilliseconds > ConnectionTimeoutNew) { lvi.IsNew = false; } lvi.UpdateValues(b); } else { lstConnections.Add(new Connection(b)); } }
public GeoConnection2(IPHelper.I_OWNER_MODULE ownerMod) : base(ownerMod) { }
public MonitoredConnection(IPHelper.I_OWNER_MODULE row) : base(row) { this.rawConnection = row; EnableStats(); }