예제 #1
0
        /// <summary>
        /// Creates a new instance of a <see cref="ProxyServerMonitor"/> server, with the provided IP addrress and port.
        /// </summary>
        /// <param name="httpTracerService">The <see cref="IHttpTracerService"/> instance. </param>
        /// <param name="address">The IP Address the proxy server will be listening on.</param>
        /// <param name="port">The port number the proxy server will be listening on.</param>
        public ProxyServerMonitor(IHttpTracerService httpTracerService, string address = DEFAULT_ADDRESS, int port = DEFAULT_PORT)
        {
            NLogger = LogManager.GetCurrentClassLogger();

            this.HttpTracerService = httpTracerService;
            this.ServerAddress     = address;
            this.Port = port;
        }
예제 #2
0
        private static void Main(string[] args)
        {
            ConfigureDependencies();

            Console.CancelKeyPress += Console_CancelKeyPress;

            Console.WriteLine("\n ----==============----");
            Console.WriteLine(" Welcome to HTTP Logger");
            Console.WriteLine(" ----==============----");
            Console.WriteLine("\n Choose which type of HTTP monitoring you would like to use.\n");

            while (true)
            {
                Console.WriteLine(" 1. Proxy Server Monitoring [Allows HTTPS] - Recommended");
                Console.WriteLine(" 2. Raw Socket Monitoring [HTTP Only]");
                var key = Console.ReadKey(true);

                switch (key.KeyChar)
                {
                case '1':
                    _monitor = _container.GetService <IProxyServerMonitor>();
                    _monitor.Start();
                    break;

                case '2':
                    _monitor = _container.GetService <ISocketMonitor>();
                    _monitor.Start();
                    break;

                default:
                    Console.WriteLine("\n Sorry, invalid option.");
                    continue;
                }

                break;
            }

            _tracerService = _container.GetService <IHttpTracerService>();

            _tracerService.MonitorMostActiveRequest();
            _tracerService.MonitorHighTraffic(_threshold);

            _gui = _container.GetService <IUIService>();
            _gui.Render();
        }
예제 #3
0
 /// <summary>
 /// Creates a new instance of <see cref="SocketMonitor"/> monitoring data on a socket directly.
 /// </summary>
 /// <param name="httpTracerService"></param>
 public SocketMonitor(IHttpTracerService httpTracerService)
 {
     this.HttpTracerService = httpTracerService;
 }