public ApplicationRecognizerRTP(NBARProtocolPortDatabase NBARProtocolPortDatabase, IL7ConversationFactory l7ConversationFactory) : base(NBARProtocolPortDatabase)
 {
     this.L7ConversationFactory = l7ConversationFactory;
     this.NbarRtpTaxonomy       = new List <NBAR2TaxonomyProtocol>
     {
         NBARProtocolPortDatabase.GetNbar2TaxonomyProtocol(NBARrtpAppTag)
     };
     this.NbarRtcpTaxonomy = new List <NBAR2TaxonomyProtocol>
     {
         NBARProtocolPortDatabase.GetNbar2TaxonomyProtocol(NBARrtcpAppTag)
     };
 }
        public L3L4ConversationTrackerBlock(IL3ConversationFactory l3ConversationFactory, IL4ConversationFactory l4ConversationFactory, NBARProtocolPortDatabase nbarProtocolPortDatabase)
        {
            this.L3ConversationFactory    = l3ConversationFactory;
            this.L4ConversationFactory    = l4ConversationFactory;
            this.NBARProtocolPortDatabase = nbarProtocolPortDatabase;

            this.NullL3Conversation       = this.L3ConversationFactory.Create(new IPAddress(0), new IPAddress(0));
            this.ProcessPacketActionBlock = new ActionBlock <PmFrameBase>(async parsedFrame =>
            {
                await this.ProcessPacket(parsedFrame);
                await this.ProcessedFrames.SendAsync(parsedFrame);
            });

            this.ProcessPacketActionBlock.Completion.ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    ((IDataflowBlock)this.L3Conversations).Fault(t.Exception);
                    ((IDataflowBlock)this.L4Conversations).Fault(t.Exception);
                    ((IDataflowBlock)this.ProcessedFrames).Fault(t.Exception);
                }
                else
                {
                    if (this.NullL3Conversation.Frames.Any())
                    {
                        this.L3Conversations.SendAsync(this.NullL3Conversation).Wait();
                        this.L3ConversationStatistics.SendAsync(this.NullL3Conversation.UpConversationStatistic).Wait();
                        this.L3ConversationStatistics.SendAsync(this.NullL3Conversation.DownConversationStatistic).Wait();
                    }
                    this.L3Conversations.Complete();
                    this.PmCaptureL3Conversations.Complete();
                    this.L3ConversationStatistics.Complete();
                    this.L4Conversations.Complete();
                    this.PmCaptureL4Conversations.Complete();
                    this.L4ConversationStatistics.Complete();
                    this.ProcessedFrames.Complete();
                }
            });

            this.Completion = Task.Run(async() =>
            {
                await this.L3Conversations.Completion;
                await this.PmCaptureL3Conversations.Completion;
                await this.L3ConversationStatistics.Completion;
                await this.L4Conversations.Completion;
                await this.PmCaptureL4Conversations.Completion;
                await this.L4ConversationStatistics.Completion;
                await this.ProcessedFrames.Completion;
            });
        }
        /// <summary> Default constructor.</summary>
        public ApplicationRecognizerSpid(NBARProtocolPortDatabase nbarProtocolPortDatabase, String configFilePath = null, String protocolDatabaseFilePath = null, Boolean prototype = false) : base(nbarProtocolPortDatabase)
        {
            if (prototype)
            {
                return;
            }
            if (configFilePath == null)
            {
                if (File.Exists(NBARprotocols.Default.SPID_config))
                {
                    configFilePath = NBARprotocols.Default.SPID_config;
                }
                else
                {
                    throw new ArgumentException(@"Invalid argument and default configs do not exists.", "configFilePath");
                }
            }
            if (protocolDatabaseFilePath == null)
            {
                if (File.Exists(NBARprotocols.Default.DefaultProtocolModelDatabase))
                {
                    protocolDatabaseFilePath = NBARprotocols.Default.DefaultProtocolModelDatabase;
                }
                else
                {
                    throw new ArgumentException(@"Invalid argument and default configs do not exists.", "protocolDatabaseFilePath");
                }
            }

            var configs = Configuration.GetInstances(configFilePath);

            this._config = configs.First();

            this._protocolModels = new SortedList <string, ProtocolModel>();
            //10 000 sessions á 30kB => 300 MB
            //this.sessionHandler = new SessionHandler(10000);
            //this._protocolModels = new SortedList<String, ProtocolModel>();
            //try
            //{
            //    this.openProtocolModelDatabaseFile(protocolDatabaseFilePath, false);
            //}
            //catch (Exception e)
            //{
            //    Debug.WriteLine("Unable to load protocol database " + protocolDatabaseFilePath + ".\n" + e.Message, "Database Not Loaded");
            //}
        }
Exemple #4
0
 public ApplicationRecognizerAppIDent(NBARProtocolPortDatabase NBARProtocolPortDatabase) : base(NBARProtocolPortDatabase)
 {
 }
Exemple #5
0
        /// <summary>
        ///     Encapsulates basic Protocol  to Port mapping and manipulation Instance is shared through one
        ///     investigation so changes is global to all If some changes like to add well-known protocol to
        ///     port mapping are required, please feel free to update it in code of InbarProtocolPortDatabase If
        ///     change is localy significant it is required to do it in the constructor of
        ///     ApplicationRecognizer which is called before ConversationTracker it self.
        /// </summary>

        public ApplicationRecognizerDefault(NBARProtocolPortDatabase nbarProtocolPortDatabase, ApplicationRecognizerNBAR applicationRecognizerNBAR, ApplicationRecognizerRTP applicationRecognizerRTP) : base(nbarProtocolPortDatabase)
        {
            this.ApplicationRecognizerNBAR = applicationRecognizerNBAR;
            this.ApplicationRecognizerRTP  = applicationRecognizerRTP;
        }
Exemple #6
0
 protected ApplicationRecognizerBase(NBARProtocolPortDatabase nbarProtocolPortDatabase)
 {
     this.NBARProtocolPortDatabase = nbarProtocolPortDatabase;
 }
 public ApplicationRecognizerNBAR(NBARProtocolPortDatabase nbarProtocolPortDatabase) : base(nbarProtocolPortDatabase)
 {
 }