예제 #1
0
        public static void Init()
        {
            FingerprintService.InitFingerprint(new WindowsFingerprint());

            // These loosely typed parameter lists are rather gross. Is there a cleaner way to do this?
            // params: channel, autoReconnect
            PlatformTypes.Register <IPipeClient>((arr) => new WindowsPipeClient((string)arr[0], (arr.Length > 1) ? (bool)arr[1] : false));

            // params: channel
            PlatformTypes.Register <IPipeServer>((arr) => new WindowsPipeServer((string)arr[0]));

            PlatformTypes.Register <IGUIChecks>((arr) => new WindowsGUIChecks());

            PlatformTypes.Register <IAntitampering>((arr) => new WindowsAntitampering());

            PlatformTypes.Register <INetworkInfo>((arr) => new NetworkListUtil());

            PlatformTypes.Register <IAuthenticationStorage>((arr) => new RegistryAuthenticationStorage());

            PlatformTypes.Register <IPathProvider>((arr) => new WindowsPathProvider());

            PlatformTypes.Register <IFilterAgent>((arr) => new WindowsFilterAgent());

            PlatformTypes.Register <IFilterUpdater>((arr) => new WindowsFilterUpdater());
        }
예제 #2
0
        public static void ClassInit(TestContext context)
        {
            var antitampering = new Mock <IAntitampering>();

            PlatformTypes.Register <IPathProvider>((arr) => new Mocks.MockPathProvider());
            PlatformTypes.Register <IAntitampering>((arr) => antitampering.Object);
        }
예제 #3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Citadel.Core.Windows.Platform.Init();
            PlatformTypes.Register <IFilterStarter>((arr) => new WindowsFilterStarter());
            PlatformTypes.Register <IGuiServices>((arr) => new WindowsGuiServices());
            PlatformTypes.Register <ITrayIconController>((arr) => new WindowsTrayIconController());

            base.OnStartup(e);
        }
예제 #4
0
        public FilterServiceProvider()
        {
            Filter.Platform.Mac.Platform.Init();

            PlatformTypes.Register <IPlatformDns>((arr) => new MacPlatformDns());
            PlatformTypes.Register <IWifiManager>((arr) => new MacWifiManager());
            PlatformTypes.Register <IPlatformTrust>((arr) => new MacTrustManager());
            PlatformTypes.Register <ISystemServices>((arr) => new MacSystemServices());

            commonProvider = new CommonFilterServiceProvider();
        }
예제 #5
0
        static void Main(string[] args)
        {
            PlatformTypes.Register <IGuiServices>((arr) => new MacGuiServices());
            PlatformTypes.Register <IFilterStarter>((arr) => new MacFilterStarter());
            PlatformTypes.Register <ITrayIconController>((arr) => new MacTrayIconController());

            Filter.Platform.Mac.Platform.Init();

            CommonAppServices.Default.Init();

            NSApplication.Init();
            NSApplication.Main(args);
        }
예제 #6
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            Forms.Init();

            Filter.Platform.Mac.Platform.Init();
            PlatformTypes.Register <ITrayIconController>((arr) => new MacTrayIconController());
            PlatformTypes.Register <IGuiServices>((arr) => new MacGuiServices());
            PlatformTypes.Register <IFilterStarter>((arr) => new MacFilterStarter());


            var app = new CloudVeilGUI.App(false);

            LoadApplication(app);

            base.DidFinishLaunching(notification);
        }
예제 #7
0
        public static void Init()
        {
            FingerprintService.InitFingerprint(new MacFingerprint());

            PlatformTypes.Register <IPipeServer>((arr) => new SocketPipeServer());

            // params: channel
            PlatformTypes.Register <IPipeClient>((arr) => new SocketPipeClient());

            PlatformTypes.Register <IGUIChecks>((arr) => new MacGUIChecks());

            PlatformTypes.Register <IAntitampering>((arr) => new MacAntitampering());

            PlatformTypes.Register <INetworkInfo>((arr) => new MacNetworkInfo());

            PlatformTypes.Register <IAuthenticationStorage>((arr) => new FileAuthenticationStorage());

            PlatformTypes.Register <IPathProvider>((arr) => new MacPathProvider());

            NativeLog.Init();
        }
        /// <summary>
        /// Default ctor.
        /// </summary>
        public FilterServiceProvider()
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
            {
                if (m_logger != null)
                {
                    m_logger.Error((Exception)e.ExceptionObject);
                }
                else
                {
                    File.WriteAllText("filterserviceprovider-unhandled-exception.log", $"Exception occurred: {((Exception)e.ExceptionObject).Message}");
                }
            };

            PlatformTypes.Register <IPlatformDns>((arr) => new WindowsDns());
            PlatformTypes.Register <IWifiManager>((arr) => new WindowsWifiManager());
            PlatformTypes.Register <IPlatformTrust>((arr) => new TrustManager());
            PlatformTypes.Register <ISystemServices>((arr) => new WindowsSystemServices(this));
            PlatformTypes.Register <IVersionProvider>((arr) => new VersionProvider());

            Citadel.Core.Windows.Platform.Init();

            m_provider = new CommonFilterServiceProvider(OnExtension);

            if (BitConverter.IsLittleEndian)
            {
                m_httpAltPort       = (ushort)IPAddress.HostToNetworkOrder((short)8080);
                m_httpsAltPort      = (ushort)IPAddress.HostToNetworkOrder((short)8443);
                m_httpsStandardPort = (ushort)IPAddress.HostToNetworkOrder((short)443);
                m_httpStandardPort  = (ushort)IPAddress.HostToNetworkOrder((short)80);
            }
            else
            {
                m_httpAltPort       = ((ushort)8080);
                m_httpsAltPort      = ((ushort)8443);
                m_httpsStandardPort = ((ushort)443);
                m_httpStandardPort  = ((ushort)80);
            }
        }
예제 #9
0
        public static void Main(string[] args)
        {
            var sentry = SentrySdk.Init(o =>
            {
                o.Dsn = new Dsn(CloudVeil.CompileSecrets.SentryDsn);

                o.BeforeBreadcrumb = (breadcrumb) =>
                {
                    if (breadcrumb.Message.Contains("Request"))
                    {
                        return(null);
                    }
                    else
                    {
                        return(breadcrumb);
                    }
                };
            });

            LoggerUtil.LoggerName = "CitadelGUI";

            bool startMinimized = false;

            foreach (string arg in args)
            {
                if (arg.IndexOf("StartMinimized") != -1)
                {
                    startMinimized = true;
                    break;
                }
            }

            try
            {
                if (Process.GetCurrentProcess().SessionId <= 0)
                {
                    try
                    {
                        LoggerUtil.GetAppWideLogger().Error("GUI client started in session 0 isolation. Exiting. This should not happen.");
                        Environment.Exit((int)ExitCodes.ShutdownWithoutSafeguards);
                        return;
                    }
                    catch (Exception e)
                    {
                        // XXX TODO - We can't really log here unless we do a direct to-file write.
                        Environment.Exit((int)ExitCodes.ShutdownWithoutSafeguards);
                        return;
                    }
                }

                Citadel.Core.Windows.Platform.Init();

                PlatformTypes.Register <IGuiServices>((arr) => new WindowsGuiServices());
                PlatformTypes.Register <ITrayIconController>((arr) => new WindowsTrayIconController());
            }
            catch
            {
                // Lets assume that if we can't even read our session ID, that we're in session 0.
                Environment.Exit((int)ExitCodes.ShutdownWithoutSafeguards);
                return;
            }

            var guiChecks = PlatformTypes.New <IGUIChecks>();

            try
            {
                RunGuiChecks(startMinimized);
            }
            catch (Exception e)
            {
                // The only way we got here is if the server isn't running, in which case we can do
                // nothing because its beyond our domain.
                LoggerUtil.RecursivelyLogException(LoggerUtil.GetAppWideLogger(), e);
                return;
            }

            try
            {
                MainLogger = LoggerUtil.GetAppWideLogger();
            }
            catch { }

            try
            {
                var app = new CitadelApp();
                app.InitializeComponent();
                app.Run();

                // Always release mutex.
                guiChecks.UnpublishRunningApp();
            }
            catch (Exception e)
            {
                try
                {
                    SentrySdk.CaptureException(e);
                    MainLogger = LoggerUtil.GetAppWideLogger();
                    LoggerUtil.RecursivelyLogException(MainLogger, e);
                }
                catch (Exception be)
                {
                    // XXX TODO - We can't really log here unless we do a direct to-file write.
                }
            }

            sentry.Dispose();

            // No matter what, always ensure that critical flags are removed from our process before exiting.
            CriticalKernelProcessUtility.SetMyProcessAsNonKernelCritical();
        }