public LayeredServiceProviderResult(LayeredServiceProviderType type, RegistryInformation regInfo, string fileName = null)
 {
     ResultType          = ScanResultType.WinSockLayeredServiceProvider;
     ProviderResultType  = type;
     RegistryInformation = regInfo;
     FileName            = fileName;
 }
예제 #2
0
        private AppInitResult(RegistryHive hive, RegistryView view, string registryPath, string registryName)
        {
            ResultType = ScanResultType.AppInitDlLs;

            RegistryInformation = new RegistryInformation(hive, view, registryPath, registryName);
            //RegistryHive = hive;
            //RegistryView = view;
            //RegistryPath = registryPath;
        }
예제 #3
0
 public PluginResult(PluginResultType resultType, RegistryHive hive, RegistryView view, string registryPath, string title, string fileName, bool fileExists)
 {
     ResultType          = ScanResultType.InternetExplorerPlugin;
     PluginResultType    = resultType;
     RegistryInformation = new RegistryInformation(hive, view, registryPath);
     Title      = title;
     FileName   = fileName;
     FileExists = fileExists;
 }
예제 #4
0
        //public RegistryHive RegistryHive { get; private set; }
        //public RegistryView RegistryView { get; private set; }
        //public string RegistryPath { get; private set; }
        //public string Name { get; private set; }
        //public string Data { get; private set; }

        public MenuExtResult(RegistryHive hive, RegistryView view, string registryPath, string name, string data)
        {
            ResultType          = ScanResultType.InternetExplorerContextMenu;
            RegistryInformation = new RegistryInformation(hive, view, registryPath, name, data);
            //RegistryHive = hive;
            //RegistryView = view;
            //RegistryPath = registryPath;
            //Name = name;
            //Data = data;
        }
 public BrowserHelperObjectResult(BrowserHelperObjectResultType resultType, RegistryHive hive, RegistryView view, string registryPath, string clsidKey, string name, string fileName)
 {
     ResultType          = ScanResultType.BrowserHelperObject;
     BhoResultType       = resultType;
     RegistryInformation = new RegistryInformation(hive, view, registryPath);
     //RegistryHive = hive;
     //RegistryView = view;
     ClsidKey = clsidKey;
     Name     = name;
     FileName = fileName;
 }
예제 #6
0
 public RegistryResultItem(ScanResultType resultType, RegistryHive hive, RegistryView view, string registryPath,
                           string valueName = null, string value = null)
 {
     ResultType          = resultType;
     RegistryInformation = new RegistryInformation(hive, view, registryPath, valueName, value);
     //RegistryHive = hive;
     //RegistryView = view;
     //KeyName = registryPath;
     //ValueName = valueName;
     //Value = value;
 }
예제 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="resultType"></param>
 /// <param name="hive">RegistryHive</param>
 /// <param name="view">RegistryView</param>
 /// <param name="registryPath">Path of the Registry Key</param>
 /// <param name="clsidKey">Object CLSID</param>
 /// <param name="toolbarName"></param>
 /// <param name="toolbarFileName"></param>
 public ToolbarResult(ToolbarResultType resultType, RegistryHive hive, RegistryView view, string registryPath, string clsidKey, string toolbarName, string toolbarFileName)
 {
     ResultType          = ScanResultType.InternetExplorerToolbar;
     BhoResultType       = resultType;
     RegistryInformation = new RegistryInformation(hive, view, registryPath, clsidKey);
     //RegistryHive = hive;
     //RegistryView = view;
     //ClsidKey = clsidKey;
     ToolbarName     = toolbarName;
     ToolbarFileName = toolbarFileName;
 }
        //public RegistryHive RegistryHive { get; private set; }
        //public RegistryView RegistryView { get; private set; }
        //public string Path { get; private set; }
        //public string Name { get; private set; }
        //public object Value { get; private set; }

        public AdvancedOptionsResult(AdvancedOptionsResultType resultType, RegistryHive hive, RegistryView view, string path, string name, string value)
        {
            ResultType = ScanResultType.InternetExplorerAdvancedOptions;
            AdvancedOptionsResultType = resultType;
            RegistryInformation       = new RegistryInformation(hive, view, path, name, value);
            //RegistryHive = hive;
            //RegistryView = view;
            //Path = path;
            //Name = name;
            //Value = value;
        }
예제 #9
0
        private static async void StartWebApi(string hostBaseUrl, string webApiBaseUrl, string healthUrl)
        {
            var registryHost = new ConsulRegistryHost();

            _serviceRegistry = new ServiceRegistry(registryHost);

            _registryInformation = await _serviceRegistry.AddTenantAsync(new CustomWebApiRegistryTenant(new Uri(webApiBaseUrl)), "orders", "0.0.2", new Uri(healthUrl));

            _server = WebApp.Start <Startup>(hostBaseUrl);
            Log.Information("Orders Service running - listening at {0} ...", hostBaseUrl);
        }
예제 #10
0
        public void ToString_WithHostAndPort_ReturnsHostAndPortString()
        {
            var endpoint = new RegistryInformation
            {
                Address = Guid.NewGuid().ToString(),
                Port    = 123
            };

            var actual = endpoint.ToString();

            Assert.Equal($"{endpoint.Address}:{endpoint.Port}", actual);
        }
예제 #11
0
        public void ToUri_WithNullScheme_ReturnsUriWithHttpScheme()
        {
            var endpoint = new RegistryInformation
            {
                Address = Guid.NewGuid().ToString(),
                Port    = 123
            };

            var actual = endpoint.ToUri();

            Assert.Equal("http", actual.Scheme);
        }
예제 #12
0
        public UrlSearchHookResult(UrlSearchHookResultType resultType, RegistryHive hive, RegistryView view, string registryPath, string registryName, string title, string fileName, bool fileExists)
        {
            ResultType = ScanResultType.RegistryMultipleValues;

            UrlSearchHookResultType = resultType;

            RegistryInformation = new RegistryInformation(hive, view, registryPath, registryName);

            Title      = title;
            FileName   = fileName;
            FileExists = fileExists;
        }
예제 #13
0
        public ControlIniResult(RegistryHive hive, RegistryView view, string registryPath, string name, string fileName)
            : this()
        {
            AutoRunResultType = ControlIniResultType.Registry;

            RegistryInformation = new RegistryInformation(hive, view, registryPath, name, fileName);
            //RegistryHive = hive;
            //RegistryView = view;
            //Path = registryPath;
            //Name = name;
            //FileName = fileName;
        }
예제 #14
0
        public static ChannelFactory <IService> CreateChannelFactory <IService>(RegistryInformation registryInformation)
        {
            var transmit = registryInformation.Tags.ToList()[1];
            var binding  = CreateBinding(transmit);
            var address  = CreateAddress(
                transmit,
                registryInformation.Address,
                registryInformation.Port.ToString(),
                typeof(IService).Name.TrimStart('I').ToLower());
            var endpoint = new EndpointAddress(address);
            var factory  = new ChannelFactory <IService>(binding, endpoint);

            factory.Endpoint.Behaviors.Add(new ProtoEndpointBehavior());
            return(factory);
        }
예제 #15
0
        public Task <RegistryInformation> RegisterServiceAsync(string serviceName, string version, Uri uri, Uri healthCheckUri = null, IEnumerable <string> tags = null)
        {
            var registryInformation = new RegistryInformation
            {
                Name    = serviceName,
                Id      = Guid.NewGuid().ToString(),
                Address = uri.Host,
                Port    = uri.Port,
                Version = version,
                Tags    = tags ?? Enumerable.Empty <string>()
            };

            ServiceInstances.Add(registryInformation);
            return(Task.FromResult(registryInformation));
        }
        public static string AddHealthCheck(this IApplicationBuilder app, RegistryInformation registryInformation, Uri checkUri, TimeSpan?interval = null, string notes = null)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (registryInformation == null)
            {
                throw new ArgumentNullException(nameof(registryInformation));
            }

            var    serviceRegistry = app.ApplicationServices.GetRequiredService <ServiceRegistry>();
            string checkId         = serviceRegistry.AddHealthCheckAsync(registryInformation.Name, registryInformation.Id, checkUri, interval, notes).GetAwaiter().GetResult();

            return(checkId);
        }
예제 #17
0
        //public ExtensionsResult()
        //{

        //}

        public ExtensionsResult(ExtensionsResultType resultType, RegistryHive hive, RegistryView view, string registryPath, string registryName, string clsidKey, string caption, string fileName, bool fileExists)
        {
            ResultType = ScanResultType.InternetExplorerExtension;

            ExtensionsResultType = resultType;

            RegistryInformation = new RegistryInformation(hive, view, registryPath, registryName);
            //RegistryHive = hive;
            //RegistryView = view;
            //RegistryPath = registryPath;

            ClsidKey = clsidKey;

            Caption    = caption;
            FileName   = fileName;
            FileExists = fileExists;
        }
        public async Task Endpoint_OneEndpoint_ReturnsEndpoint()
        {
            var endpoint = new RegistryInformation {
                Address = Guid.NewGuid().ToString(), Port = 123
            };

            var subscriber = Substitute.For <IServiceSubscriber>();

            subscriber.Endpoints().Returns(Task.FromResult(new List <RegistryInformation> {
                endpoint
            }));
            var lb = new RoundRobinLoadBalancer(subscriber);

            var actual = await lb.Endpoint();

            Assert.Equal(endpoint.Address, actual.Address);
            Assert.Equal(endpoint.Port, actual.Port);
        }
예제 #19
0
        public RegistryClientShould()
        {
            var oneDotnetOne = new RegistryInformation {
                Name = "one", Address = "http://10.125.32.121", Port = 8888, Version = "1.0.0", Tags = new List <string> {
                    "key2value2", "key1value1"
                }
            };
            var oneDotnetTwo = new RegistryInformation {
                Name = "one", Address = "http://10.125.32.122", Port = 8889, Version = "1.0.0", Tags = new List <string> {
                    "key2value2", "key1value1"
                }
            };
            var twoDotnetOne = new RegistryInformation {
                Name = "two", Address = "http://10.126.32.121", Port = 8890, Version = "2.0.0", Tags = new List <string> {
                    "key2value2", "key1value1"
                }
            };
            var twoDotnetTwo = new RegistryInformation {
                Name = "two", Address = "http://10.126.32.122", Port = 8891, Version = "2.0.0", Tags = new List <string> {
                    "prefix/values", "key1value1"
                }
            };
            var threeDotnetOne = new RegistryInformation {
                Name = "three", Address = "http://http://10.127.32.121", Port = 8892, Version = "3.1.0", Tags = new List <string> {
                    "prefix/values", "key1value1"
                }
            };
            var threeDotnetTwo = new RegistryInformation {
                Name = "three", Address = "http://http://10.127.32.122", Port = 8893, Version = "3.2.0", Tags = new List <string> {
                    "prefix/values", "key1value1"
                }
            };

            _instances = new List <RegistryInformation> {
                oneDotnetOne,
                oneDotnetTwo,
                twoDotnetOne,
                twoDotnetTwo,
                threeDotnetOne,
                threeDotnetTwo
            };
        }
예제 #20
0
        public DpfResult(DpfResultType resultType, RegistryHive hive, RegistryView view, string registryPath, string clsid, string title, string codeBase)
        {
            ResultType = ScanResultType.DownloadedProgramFiles;

            DpfResultType = resultType;

            RegistryInformation = new RegistryInformation(hive, view, registryPath);

            Clsid    = clsid;
            Title    = title;
            CodeBase = codeBase;

            if (Uri.IsWellFormedUriString(codeBase, UriKind.Absolute))
            {
                CodeBaseExists = true;
            }
            else
            {
                CodeBaseExists = !string.IsNullOrEmpty(codeBase) && File.Exists(codeBase);
            }
        }
        public void Start()
        {
            var baseUrl   = new Uri("http://localhost:7777");
            var healthUrl = new Uri("http://localhost:7777/api/health/ping");

            WireAppDomainHandlers();
            InitializeMapper();
            SetupQueues();
            ListenOnQueues();

            var registryHost = new ConsulRegistryHost();

            _serviceRegistry = new ServiceRegistry(registryHost);

            Task.Run(async() =>
            {
                _registryInformation = await _serviceRegistry.AddTenantAsync(new CustomWebApiRegistryTenant(baseUrl), "orders", "0.0.2", healthUrl);

                _server = WebApp.Start <Startup>(baseUrl.ToString());
                Console.WriteLine("Orders Service running - listening at {0} ...", baseUrl);
            }).GetAwaiter().GetResult();
        }
예제 #22
0
 public RegeditResult(RegistryHive hive, RegistryView view, string path, string name, object value)
     : this()
 {
     RegistryInformation = new RegistryInformation(hive, view, path, name, value);
 }
 public static string FormatViewToString(this RegistryInformation information, string x64Value = X64_DEFAULT_VALUE)
 {
     return(information.View.FormatViewToString(x64Value));
 }
예제 #24
0
 public RegeditResult(RegistryInformation regInfo)
     : this()
 {
     RegistryInformation = regInfo;
 }
예제 #25
0
        public void  TrampArround()
        {
            var oneDotnetOne = new RegistryInformation {
                Name = "one", Address = "1", Port = 8888, Version = "1.0.0"
            };
            var oneDotnetTwo = new RegistryInformation {
                Name = "one", Address = "2", Port = 8889, Version = "1.0.0"
            };
            var twoDotnetOne = new RegistryInformation {
                Name = "one", Address = "3", Port = 8890, Version = "2.0.0"
            };
            var twoDotnetTwo = new RegistryInformation {
                Name = "one", Address = "4", Port = 8891, Version = "2.0.0"
            };
            var threeDotnetOne = new RegistryInformation {
                Name = "one", Address = "5", Port = 8892, Version = "3.1.0"
            };
            var threeDotnetTwo = new RegistryInformation {
                Name = "one", Address = "6", Port = 8893, Version = "3.2.0"
            };

            instances = new List <RegistryInformation> {
                oneDotnetOne,
                oneDotnetTwo,
                twoDotnetOne,
                twoDotnetTwo,
                threeDotnetOne,
                threeDotnetTwo
            };

            var router = new RoundRobinAddressRouter();

            var next = router.Choose(instances);

            Assert.NotNull(next);
            Assert.Equal("1", next.Address);

            next = router.Choose(instances);
            Assert.NotNull(next);
            Assert.Equal("2", next.Address);

            next = router.Choose(instances);
            Assert.NotNull(next);
            Assert.Equal("3", next.Address);

            next = router.Choose(instances);
            Assert.NotNull(next);
            Assert.Equal("4", next.Address);

            next = router.Choose(instances);
            Assert.NotNull(next);
            Assert.Equal("5", next.Address);

            next = router.Choose(instances);
            Assert.NotNull(next);
            Assert.Equal("6", next.Address);

            next = router.Choose(instances);
            Assert.NotNull(next);
            Assert.Equal("1", next.Address);
        }
 public IService GetServiceClient <IService>(RegistryInformation registryInformation, ProtocolConfiguration protocolConfiguration)
 {
     return((IService) new WCFRealProxy <IService>(registryInformation, protocolConfiguration).GetTransparentProxy());
 }
예제 #27
0
 public GroupPolicyResult(GroupPolicyResultType resultType, RegistryInformation registryInformation)
 {
     ResultType            = ScanResultType.GroupPolicySettings;
     RegistryInformation   = registryInformation;
     GroupPolicyResultType = resultType;
 }
예제 #28
0
        public InMemoryRegistryHostShould()
        {
            var oneDotOne = new RegistryInformation {
                Name = "One", Address = "http://1.1.0.0", Port = 1234, Version = "1.1.0", Tags = new List <string> {
                    "key1value1", "key2value2"
                }
            };
            var oneDotTwo = new RegistryInformation {
                Name = "One", Address = "http://1.2.0.0", Port = 1235, Version = "1.2.0", Tags = new List <string> {
                    "key1value1", "key2value2"
                }
            };
            var twoDotOne = new RegistryInformation {
                Name = "Two", Address = "http://2.1.0.0", Port = 1236, Version = "2.1.0", Tags = new List <string> {
                    "key1value1", "prefix/path"
                }
            };
            var twoDotTwo = new RegistryInformation {
                Name = "Two", Address = "http://2.2.0.0", Port = 1237, Version = "2.2.0", Tags = new List <string> {
                    "prefix/path", "key2value2"
                }
            };
            var threeDotOne = new RegistryInformation {
                Name = "Three", Address = "http://3.1.0.0", Port = 1238, Version = "3.1.0", Tags = new List <string> {
                    "prefix/orders", "key2value2"
                }
            };
            var threeDotTwo = new RegistryInformation {
                Name = "Three", Address = "http://3.2.0.0", Port = 1239, Version = "3.2.0", Tags = new List <string> {
                    "key1value1", "prefix/customers"
                }
            };
            var fourDotOne = new RegistryInformation {
                Name = "Four", Address = "http://4.1.0.0", Port = 1240, Version = "1.1.0"
            };
            var fourDotTwo = new RegistryInformation {
                Name = "Four", Address = "http://4.2.0.0", Port = 1241, Version = "1.2.0"
            };
            var fourDotThree = new RegistryInformation {
                Name = "Four", Address = "http://4.3.0.0", Port = 1242, Version = "2.1.0"
            };
            var fourDotFour = new RegistryInformation {
                Name = "Four", Address = "http://4.4.0.0", Port = 1243, Version = "2.2.0"
            };
            var fourDotFive = new RegistryInformation {
                Name = "Four", Address = "http://4.5.0.0", Port = 1244, Version = "3.2.0"
            };

            _instances = new List <RegistryInformation>
            {
                oneDotOne, oneDotTwo,
                twoDotOne, twoDotTwo,
                threeDotOne, threeDotTwo,
                fourDotOne, fourDotTwo, fourDotThree, fourDotFour, fourDotFive
            };

            _keyValues = new KeyValues()
                         .WithKeyValue("1", "One")
                         .WithKeyValue("1.1", "One.1")
                         .WithKeyValue("2", 2.0.ToString(CultureInfo.InvariantCulture))
                         .WithKeyValue("3", 3M.ToString(CultureInfo.InvariantCulture));

            _host = new InMemoryRegistryHost
            {
                ServiceInstances = _instances,
                KeyValues        = _keyValues
            };
        }
 public WCFRealProxy(RegistryInformation registryInformation, ProtocolConfiguration protocolConfiguration) : base(typeof(IService))
 {
     this.registryInformation   = registryInformation;
     this.protocolConfiguration = protocolConfiguration;
 }
예제 #30
0
 public AutoRunRegistryResult(RegistryHive hive, RegistryView view, string path, string name, string fileName = null)
     : this()
 {
     RegistryInfo = new RegistryInformation(hive, view, path, name, fileName);
     //FileName = fileName;
 }