Exemplo n.º 1
0
        public override void Define()
        {
            DnsPacket query = null;

            When()
            .Match(() => query, x => x.DnsFlagsResponse == false);
            Then()
            .Do(ctx => ctx.TryInsert(new DnsServer {
                IpAddress = query.IpDst
            }));
        }
Exemplo n.º 2
0
        public static DnsPacket Create(System.Func <string, string, string> mapper, string[] values)
        {
            DnsPacket newObj = new DnsPacket();

            newObj._FrameNumber      = mapper.Invoke("frame.number", values[0]).ToInt32();
            newObj._IpSrc            = mapper.Invoke("ip.src", values[1]).ToString();
            newObj._IpDst            = mapper.Invoke("ip.dst", values[2]).ToString();
            newObj._DnsId            = mapper.Invoke("dns.id", values[3]).ToString();
            newObj._DnsFlagsResponse = mapper.Invoke("dns.flags.response", values[4]).ToBoolean();
            newObj._DnsFlagsRcode    = mapper.Invoke("dns.flags.rcode", values[5]).ToInt32();
            newObj._DnsTime          = mapper.Invoke("dns.time", values[6]).ToDouble();
            newObj._DnsQryName       = mapper.Invoke("dns.qry.name", values[7]).ToString();
            return(newObj);
        }
Exemplo n.º 3
0
        public override bool Equals(object obj)
        {
            DnsPacket that = obj as DnsPacket;

            return(((((((((that != null) &&
                          object.Equals(this.FrameNumber, that.FrameNumber)) &&
                         object.Equals(this.IpSrc, that.IpSrc)) &&
                        object.Equals(this.IpDst, that.IpDst)) &&
                       object.Equals(this.DnsId, that.DnsId)) &&
                      object.Equals(this.DnsFlagsResponse, that.DnsFlagsResponse)) &&
                     object.Equals(this.DnsFlagsRcode, that.DnsFlagsRcode)) &&
                    object.Equals(this.DnsTime, that.DnsTime)) &&
                   object.Equals(this.DnsQryName, that.DnsQryName));
        }
Exemplo n.º 4
0
        public static DnsPacket Create(string[] values)
        {
            DnsPacket newObj = new DnsPacket();

            newObj._FrameNumber      = values[0].ToInt32();
            newObj._IpSrc            = values[1].ToString();
            newObj._IpDst            = values[2].ToString();
            newObj._DnsId            = values[3].ToString();
            newObj._DnsFlagsResponse = values[4].ToBoolean();
            newObj._DnsFlagsRcode    = values[5].ToInt32();
            newObj._DnsTime          = values[6].ToDouble();
            newObj._DnsQryName       = values[7].ToString();
            return(newObj);
        }
Exemplo n.º 5
0
        public override void Define()
        {
            DnsPacket query = null;

            When()
            .Match <DnsPacket>(() => query, x => x.DnsFlagsResponse == false)
            .Not <DnsPacket>(x => x.DnsFlagsResponse == true, x => x.DnsId == query.DnsId);

            Then()
            .Do(ctx => ctx.Error($"No Response for DNS query {query} found."))
            .Yield(_ => new NoResponse {
                Query = query
            });
        }
Exemplo n.º 6
0
        public override void Define()
        {
            DnsPacket query    = null;
            DnsPacket response = null;

            When()
            .Match <DnsPacket>(() => query, x => x.DnsFlagsResponse == false)
            .Match <DnsPacket>(() => response, x => x.DnsFlagsResponse == true, x => x.DnsId == query.DnsId);

            Then()
            .Do(ctx => ctx.TryInsert(new QueryResponse {
                Query = query, Response = response
            }));
        }