Beispiel #1
0
        public void SetTargetPort(PortModel port)
        {
            if (TargetPort == port)
            {
                return;
            }

            TargetPort?.RemoveLink(this);
            TargetPort = port;
            TargetPort.AddLink(this);
            TargetPortChanged?.Invoke();
        }
Beispiel #2
0
        public void SetTargetPort(PortModel?port)
        {
            if (TargetPort == port)
            {
                return;
            }

            var old = TargetPort;

            TargetPort?.RemoveLink(this);
            TargetPort = port;
            TargetPort?.AddLink(this);
            TargetPortChanged?.Invoke(this, old, TargetPort);
        }
Beispiel #3
0
        public void WriteText(IGraphvizBuilder gb)
        {
            gb.Append(FromNode.Id);
            if (FromPort != null)
            {
                FromPort.WriteText(gb);
            }

            if (_Graph is DiGraph)
            {
                gb.Append("->");
            }
            else
            {
                gb.Append("--");
            }
            gb.Append(TargetNode.Id);
            if (TargetPort != null)
            {
                TargetPort.WriteText(gb);
            }

            gb.Append('[');

            if (Attributes != null)
            {
                var isFirstAttribute = true;
                foreach (var attribute in Attributes)
                {
                    if (!isFirstAttribute)
                    {
                        gb.Append(';');
                    }
                    else
                    {
                        isFirstAttribute = false;
                    }
                    attribute.WriteText(gb);
                }
            }
            else
            {
            }
            gb.Append(']');
            gb.AppendLine();
        }
Beispiel #4
0
        public override int GetHashCode()
        {
            var hashCode = 1818777531;

            hashCode = hashCode * -1521134295 + Timestamp.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FlowId);

            hashCode = hashCode * -1521134295 + PcapCnt.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(EventType);

            hashCode = hashCode * -1521134295 + EqualityComparer <IPAddress> .Default.GetHashCode(SourceIp);

            hashCode = hashCode * -1521134295 + SourcePort.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <IPAddress> .Default.GetHashCode(TargetIp);

            hashCode = hashCode * -1521134295 + TargetPort.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Protocol);

            hashCode = hashCode * -1521134295 + EqualityComparer <DnsEve> .Default.GetHashCode(Dns);

            return(hashCode);
        }
Beispiel #5
0
        public override int GetHashCode()
        {
            var hashCode = -1042383050;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ThreatName);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ThreatType);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ThreatSubType);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Level);

            hashCode = hashCode * -1521134295 + EqualityComparer <IPAddress> .Default.GetHashCode(SourceIp);

            hashCode = hashCode * -1521134295 + SourcePort.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <IPAddress> .Default.GetHashCode(TargetIp);

            hashCode = hashCode * -1521134295 + TargetPort.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(SourceInterface);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(TargetInterface);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(AppProtocol);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Action);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(SecurityStrategy);

            hashCode = hashCode * -1521134295 + StartTime.GetHashCode();
            hashCode = hashCode * -1521134295 + EndTime.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(TestEngine);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Comment);

            return(hashCode);
        }
Beispiel #6
0
        public new void Load()
        {
            // Try to load, and save a new file if load failed
            if (!base.Load())
            {
                base.Save();
            }

            RMLog.Level = LogLevel;

            // Output the settings being used
            RMLog.Info("Using settings from " + base.FileName);
            RMLog.Info("-Listen port...." + ListenPort.ToString());
            if (TargetPort > 0)
            {
                RMLog.Info("-Telnet target.." + TargetHostname + ":" + TargetPort.ToString());
            }
            else
            {
                RMLog.Info("-Telnet target..DISABLED");
            }
            if (RLoginPort > 0)
            {
                RMLog.Info("-RLogin target.." + TargetHostname + ":" + RLoginPort.ToString());
            }
            else
            {
                RMLog.Info("-RLogin target..DISABLED");
            }
            RMLog.Info("-Log level......" + LogLevel.ToString());
            if (CertificateFilename != "")
            {
                // If file doesn't exist, and it's relative, convert to absolute
                if (!File.Exists(CertificateFilename) && !Path.IsPathRooted(CertificateFilename))
                {
                    CertificateFilename = StringUtils.PathCombine(ProcessUtils.StartupPath, CertificateFilename);
                }

                if (File.Exists(CertificateFilename))
                {
                    RMLog.Info("-Cert file......" + CertificateFilename);
                    if (CertificatePassword == "")
                    {
                        RMLog.Info("-Cert password..none");
                    }
                    else
                    {
                        RMLog.Info("-Cert password..yes (hidden)");
                    }
                }
                else
                {
                    RMLog.Error("-Cert file not found: '" + CertificateFilename + "'");
                    CertificateFilename = "";
                }
            }
            if (RelayFilename != "")
            {
                // If file doesn't exist, and it's relative, convert to absolute
                if (!File.Exists(RelayFilename) && !Path.IsPathRooted(RelayFilename))
                {
                    RelayFilename = StringUtils.PathCombine(ProcessUtils.StartupPath, RelayFilename);
                }

                if (File.Exists(RelayFilename))
                {
                    RMLog.Info("-Relay file....." + RelayFilename);
                }
                else
                {
                    RMLog.Error("-Relay file not found: '" + RelayFilename + "'");
                    RelayFilename = "";
                }
            }
        }
Beispiel #7
0
        public new void Load()
        {
            // Try to load, and save a new file if load failed
            if (!base.Load())
            {
                base.Save();
            }

            RMLog.Level = LogLevel;

            // Output the settings being used
            RMLog.Info("Using settings from " + base.FileName);
            RMLog.Info("-Listen port: " + ListenPort.ToString());
            if (TargetPort > 0)
            {
                RMLog.Info("-Telnet target: " + TargetHostname + ":" + TargetPort.ToString());
            }
            else
            {
                RMLog.Info("-Telnet target: DISABLED");
            }
            if (RLoginPort > 0)
            {
                RMLog.Info("-RLogin target: " + TargetHostname + ":" + RLoginPort.ToString());
            }
            else
            {
                RMLog.Info("-RLogin target: DISABLED");
            }
            RMLog.Info("-Log level: " + LogLevel.ToString());
            if (!string.IsNullOrWhiteSpace(CertificateFilename))
            {
                // If file doesn't exist, and it's relative, convert to absolute
                if (!File.Exists(CertificateFilename) && !Path.IsPathRooted(CertificateFilename))
                {
                    CertificateFilename = StringUtils.PathCombine(ProcessUtils.StartupPath, CertificateFilename);
                }

                if (File.Exists(CertificateFilename))
                {
                    RMLog.Info("-Cert file: " + CertificateFilename);
                    if (string.IsNullOrWhiteSpace(CertificatePassword))
                    {
                        RMLog.Info("-Cert password: none");
                    }
                    else
                    {
                        RMLog.Info("-Cert password: yes (hidden)");
                    }
                }
                else
                {
                    RMLog.Error("-Cert file not found: '" + CertificateFilename + "'");
                    CertificateFilename = "";
                }
            }
            if (!string.IsNullOrWhiteSpace(User) && OSUtils.IsUnix)
            {
                RMLog.Info($"-Run as user: '******'");
            }
            if (!string.IsNullOrWhiteSpace(RelayFilename))
            {
                // If file doesn't exist, and it's relative, convert to absolute
                if (!File.Exists(RelayFilename) && !Path.IsPathRooted(RelayFilename))
                {
                    RelayFilename = StringUtils.PathCombine(ProcessUtils.StartupPath, RelayFilename);
                }

                if (File.Exists(RelayFilename))
                {
                    RMLog.Info("-Relay file: " + RelayFilename);
                }
                else
                {
                    RMLog.Error("-Relay file not found: '" + RelayFilename + "'");
                    RelayFilename = "";
                }
            }
            if (!string.IsNullOrWhiteSpace(RelayDeniedFilename))
            {
                // If file doesn't exist, and it's relative, convert to absolute
                if (!File.Exists(RelayDeniedFilename) && !Path.IsPathRooted(RelayDeniedFilename))
                {
                    RelayDeniedFilename = StringUtils.PathCombine(ProcessUtils.StartupPath, RelayDeniedFilename);
                }

                if (File.Exists(RelayDeniedFilename))
                {
                    RMLog.Info("-Relay denied file: " + RelayDeniedFilename);
                }
                else
                {
                    RMLog.Error("-Relay denied file not found: '" + RelayDeniedFilename + "'");
                    RelayDeniedFilename = "";
                }
            }
            if (MaxIdleTimeInMinutes > 0)
            {
                RMLog.Info($"-Max idle time before disconnecting: {MaxIdleTimeInMinutes} minutes");
            }
            else
            {
                RMLog.Info("-Max idle time before disconnecting: DISABLED");
            }
            if (MaxSessionLengthInHours > 0)
            {
                RMLog.Info($"-Max session length before disconnecting: {MaxSessionLengthInHours} hours");
            }
            else
            {
                RMLog.Info("-Max session length before disconnecting: DISABLED");
            }
        }