Пример #1
0
        public void Run(IContext context, string channelName, IEnumerable <string> ipsWhitelist, int redirectionPort)
        {
            try
            {
                _whitelist       = ipsWhitelist.ToList().Select(IPAddress.Parse);
                _redirectionPort = (ushort)redirectionPort;

                _connectHook = LocalHook.Create(
                    LocalHook.GetProcAddress("Ws2_32.dll", "connect"),
                    new WinsockConnectDelegate(_onConnect), this);

                WakeUpProcess();
                var currentProcess = Process.GetCurrentProcess();
                _logger.NotifyInstalled(currentProcess.ProcessName, currentProcess.Id);
                _connectHook.ThreadACL.SetExclusiveACL(new[] { 0 });
            }
            catch (Exception ex) { _logger.OnError(ex); }
            while (true)
            {
                Thread.Sleep(1000);
            }
        }
Пример #2
0
        public void Run(IContext context, string channelName, List <string> ipsWhitelist, int redirectionPort)
        {
            _interface.NotifyInstalled(Process.GetCurrentProcess().ProcessName);

            try
            {
                _connectHook = LocalHook.Create(
                    LocalHook.GetProcAddress("Ws2_32.dll", "connect"),
                    new WinsockConnectDelegate(_onConnect), this);

                _connectHook.ThreadACL.SetExclusiveACL(new[] { 0 });
            }
            catch (Exception ex) { _interface.OnError(ex); }

            WakeUpProcess();
            while (true)
            {
                Thread.Sleep(1000);
            }
        }