Esempio n. 1
0
        static void Main(string[] args)
        {
            List<Ids.Common.Interfaces.ISensorReport> reporters = new List<Ids.Common.Interfaces.ISensorReport>();
            reporters.Add(new Ids.Common.Reporters.SimpleReportAgent());
            string connectionString = @"Data Source=UB1NB092\SQL2012;Initial Catalog=AzureIdsDb;Persist Security Info=True;User ID=cyberproduct;Password=x2000; Connect Timeout=600;Max Pool Size = 200;Pooling = True";

            AzureSqlDbReportAgent cloudDbReportAgent = new AzureSqlDbReportAgent(connectionString,String.Empty);

            reporters.Add(cloudDbReportAgent);
            CaptureDeviceDescription cdd = new CaptureDeviceDescription()
            {
                DeviceNumber = 0,
                TextInDeviceName = "whatever"
            };

            //www.google.com = 216.58.209.100
            //const string googleIpAddress = "216.58.209.100";
            //WebServerDosSensor wds = WebServerDosSensor.FactoryMethod(cdd, googleIpAddress, 443, false, reporters, 5000);
            //cloudDbReportAgent.UpdateSensorId(wds.GetSensorId());
            //wds.StartCapturing();
            //Console.ReadLine();
            //wds.StopCapturing();

            const string ftpIpAddress = "192.168.1.74";
            FtpServerDosSensor fds = FtpServerDosSensor.FactoryMethod(cdd, ftpIpAddress, 443, false, reporters, 5000);
            cloudDbReportAgent.UpdateSensorId(fds.GetSensorId());
            fds.StartCapturing();
            Console.ReadLine();
            fds.StopCapturing();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            List<Ids.Common.Interfaces.ISensorReport> reporters = new List<Ids.Common.Interfaces.ISensorReport>();
            reporters.Add(new Ids.Common.Reporters.SimpleReportAgent());
            CaptureDeviceDescription cdd = new CaptureDeviceDescription()
            {
                DeviceNumber = 0,
                TextInDeviceName = "whatever"
            };
            string enteredChar = "X";
            while (enteredChar != "s" && enteredChar != "p")
            {
                Console.WriteLine("enter type Statistics Capture (s) or Packet Capture (p):");
                 enteredChar = Console.ReadLine();
            }

            BaseSensor baseSensor = null;

            if (enteredChar == "p")
            {
                //baseSensor = new BaseSensor(cdd, "tcp and ip and dst port 80", SharpPcap.DeviceMode.Normal,reporters, 1000, Enumerations.SensorMode.PacketCapture);
                baseSensor = new BaseSensor(cdd, "dst 192.168.0.103", SharpPcap.DeviceMode.Normal, reporters, 10000, Enumerations.SensorMode.PacketCapture);
            }
            else
            {
                baseSensor = new BaseSensor(cdd, "tcp", SharpPcap.DeviceMode.Normal,reporters, 1000, Enumerations.SensorMode.Statistics);
            }

            baseSensor.StartCapturing();

            Console.ReadLine();
            baseSensor.StopCapturing();
        }
Esempio n. 3
0
        public void CreateBaseSensor_ReturnsSuccess()
        {
            //arrange
            CaptureDeviceDescription cdd = new CaptureDeviceDescription()
            {
                DeviceNumber = 0,
                TextInDeviceName = "whatever"
            };
            List<Ids.Common.Interfaces.ISensorReport> reporters = new List<Ids.Common.Interfaces.ISensorReport>();
            reporters.Add(new Ids.Common.Reporters.SimpleReportAgent());
            const string googleIpAddress = "216.58.209.100";

            //act
            WebServerDosSensor wds = WebServerDosSensor.FactoryMethod(cdd, googleIpAddress, 443, false, reporters, 1000);

            //assert
            Assert.IsNotNull(wds);
        }
Esempio n. 4
0
        public void CreateWebServerDosSensor_ReturnsSuccess()
        {
            //arrange
            CaptureDeviceDescription cdd = new CaptureDeviceDescription()
            {
                DeviceNumber = 0,
                TextInDeviceName = "whatever"
            };
            List<Ids.Common.Interfaces.ISensorReport> reporters = new List<Ids.Common.Interfaces.ISensorReport>();
            reporters.Add(new Ids.Common.Reporters.SimpleReportAgent());

            //act
            BaseSensor baseSensor = new BaseSensor(cdd, "tcp and ip and dst port 80", SharpPcap.DeviceMode.Normal, reporters, 1000, Enumerations.SensorMode.PacketCapture);
            baseSensor.StartCapturing();
            baseSensor.StopCapturing();

            //assert
            Assert.IsNotNull(baseSensor);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            List<Ids.Common.Interfaces.ISensorReport> reporters = new List<Ids.Common.Interfaces.ISensorReport>();
            string connectionString = @"Data Source=UB1NB092\SQL2012;Initial Catalog=AzureIdsDb;Persist Security Info=True;User ID=cyberproduct;Password=x2000; Connect Timeout=600;Max Pool Size = 200;Pooling = True";

            AzureSqlDbReportAgent cloudDbReportAgent = new AzureSqlDbReportAgent(connectionString,
                "7C8FA0D3-1F00-42F1-B849-184348D834F6");

            reporters.Add(cloudDbReportAgent);
            reporters.Add(new SimpleReportAgent());
            CaptureDeviceDescription cdd = new CaptureDeviceDescription()
            {
                DeviceNumber = 0,
                TextInDeviceName = "whatever"
            };
            string enteredChar = "X";
            while (enteredChar != "s" && enteredChar != "p")
            {
                Console.WriteLine("enter type Statistics Capture (s) or Packet Capture (p):");
                enteredChar = Console.ReadLine();
            }

            BaseSensor baseSensor = null;

            if (enteredChar == "p")
            {
                baseSensor = new BaseSensor(cdd, "port 21", SharpPcap.DeviceMode.Normal, reporters, 20000, Enumerations.SensorMode.PacketCapture);
            }
            else
            {
                baseSensor = new BaseSensor(cdd, "tcp", SharpPcap.DeviceMode.Normal, reporters, 1000, Enumerations.SensorMode.Statistics);
            }

            baseSensor.StartCapturing();

            Console.ReadLine();
            baseSensor.StopCapturing();
        }