示例#1
0
        public String GetRuleString()
        {
            String ret = "--alg ";

            if (Algorithm == Strategy.BoyerMoore)
            {
                ret += "bm";
            }
            else
            {
                ret += "kmp";
            }

            if (From != 0)
            {
                ret += " --from " + From;
            }

            if (To != 0)
            {
                ret += " --to " + To;
            }

            if (Notation == NotationTypes.Hex)
            {
                ret += " " + Pattern.ToOption(OptionHexStringLong);
            }
            else
            {
                ret += " " + Pattern.ToOption(OptionStringLong);
            }

            return(ret);
        }
示例#2
0
        public String GetRuleString()
        {
            String ret = "";

            if (!SrcGroup.Null)
            {
                ret = SrcGroup.ToOption(OptionSrcGroup);
            }
            if (!DstGroup.Null)
            {
                if (ret != "")
                {
                    ret += " ";
                }
                ret += DstGroup.ToOption(OptionDstGroup);
            }
            return(ret);
        }
示例#3
0
        public String GetRuleString()
        {
            var sb = new StringBuilder();

            if (!SourcePort.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(SourcePort.ToOption(OptionSourcePortShort));
            }

            if (!DestinationPort.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(DestinationPort.ToOption(OptionDestinationPortShort));
            }

            if (TcpFlags != null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(OptionDestinationTcpFlags);
                sb.Append(" ");
                sb.Append(TcpFlags);
            }

            if (!TcpOption.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(TcpOption.ToOption(OptionTcpOption));
            }

            return(sb.ToString());
        }
示例#4
0
        public String GetRuleString()
        {
            var sb = new StringBuilder();

            sb.Append(OptionModeLong + " " + OutputMode(Mode) + " ");

            switch (Mode)
            {
            case Modes.Nth:
                sb.Append(Every.ToOption(OptionEveryLong) + " " + OptionPacketLong + " " + Packet);
                break;

            case Modes.Random:
                sb.Append(Probability.ToOption(OptionProbabilityLong));
                break;
            }

            return(sb.ToString());
        }
示例#5
0
        public String GetRuleString()
        {
            var sb = new StringBuilder();

            if (!Mark.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(Mark.ToOption(OptionMarkLong));
                if (Mask != unchecked ((int)0xFFFFFFFF))
                {
                    sb.Append("/0x");
                    sb.Append(Mask.ToString("X"));
                }
            }

            return(sb.ToString());
        }
示例#6
0
 public String GetRuleString()
 {
     return(Helper.ToOption(OptionHelperLong));
 }
示例#7
0
 public String GetRuleString()
 {
     return(MssRange.ToOption(OptionMss));
 }
示例#8
0
        public String GetRuleString()
        {
            var sb = new StringBuilder();

            if (!Protocol.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(Protocol.ToOption(OptionProtocolShort));
            }
            if (!Source.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(Source.ToOption(OptionSourceShort));
            }
            if (!Destination.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(Destination.ToOption(OptionDestinationShort));
            }
            if (!InInterface.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(InInterface.ToOption(OptionInInterfaceShort));
            }
            if (!OutInterface.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(OutInterface.ToOption(OptionOutInterfaceShort));
            }

            if (!Fragmented.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                if (Fragmented.Not)
                {
                    sb.Append("! ");
                }
                sb.Append("-f");
            }
            sb.Append(SetCounters.ToOption(OptionFragmentShort));

            if (Target != null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                if (TargetMode == TargetMode.Jump)
                {
                    sb.Append("-j ");
                    sb.Append(Target);
                }
                else if (TargetMode == TargetMode.Goto)
                {
                    sb.Append("-g ");
                    sb.Append(Target);
                }
            }
            return(sb.ToString());
        }
示例#9
0
        public String GetRuleString()
        {
            var sb = new StringBuilder();

            if (!Mode.Null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }

                switch (Mode.Value)
                {
                case RecentMode.Set:
                    sb.Append(Mode.ToOption(OptionSetLong, ""));
                    break;

                case RecentMode.Rcheck:
                    sb.Append(Mode.ToOption(OptionRcheckLong, ""));
                    break;

                case RecentMode.Update:
                    sb.Append(Mode.ToOption(OptionUpdateLong, ""));
                    break;

                case RecentMode.Remove:
                    sb.Append(Mode.ToOption(OptionRemoveLong, ""));
                    break;
                }
            }

            if (!String.IsNullOrEmpty(Name) && Name != "DEFAULT")
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(OptionNameLong);
                sb.Append(" ");
                sb.Append(Name);
            }

            if (!(Equals(Mask, IPAddress.Any)))
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(OptionMaskLong);
                sb.Append(" ");
                sb.Append(Mask);
            }

            if (Rdest)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(OptionRdestLong);
            }

            if (Seconds != null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(OptionSecondsLong);
                sb.Append(" ");
                sb.Append(Seconds);
            }

            if (HitCount != null)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(OptionHitcountLong);
                sb.Append(" ");
                sb.Append(HitCount);
            }

            if (Reap)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(OptionReapLong);
            }

            if (Rttl)
            {
                if (sb.Length != 0)
                {
                    sb.Append(" ");
                }
                sb.Append(OptionRttlLong);
            }

            return(sb.ToString());
        }
示例#10
0
 public String GetRuleString()
 {
     return(Length.ToOption(OptionLengthLong));
 }