public void Md5HashTest()
        {
            var module = new IpModule(new Url("http://192.168.1.199"), 8888,"TESThash")
            {
                Module = IpModuleType.Ip150,
                Session = Session,
            };

            var manager = new IpModuleManager(module);
            var hash = manager.GetMd5Hash();

            Assert.AreEqual(ExpectedHash, module.PasswordHash);
        }
        public void Rc4Test()
        {
            var module = new IpModule(new Url("http://192.168.1.199"), 8888, "TESThash")
            {
                Module = IpModuleType.Ip150,
                Session = Session,
                PasswordHash = ExpectedHash,
                PasswordFirstHash = ExpectedFirstHash,
            };

            var manager = new IpModuleManager(module);
            var rc4 = manager.GetRc4AsHexString();

            Assert.AreEqual(ExpectedRc4, module.UserKey);
        }
        public static void Run()
        {
            LogManager.LogFactory = new NLogFactory();
            var logger = LogManager.GetLogger(typeof(ServiceStartup));

            try
            {
                var module = new IpModule(new Url(ConfigurationManager.AppSettings["moduleIp"]), Convert.ToInt32(ConfigurationManager.AppSettings["panelCode"]), ConfigurationManager.AppSettings["password"]);
                appHost = new ParadoxAppListenerHost(module);

                appHost.Init();
                appHost.Start(ListeningOn);
                logger.InfoFormat("Listening On: {0}", ListeningOn);
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("{0}: {1}", ex.GetType().Name, ex.Message);
                throw;
            }
        }
        public IpModuleManager(IpModule module)
        {
            string[] phantomArgs = new string[] { "--webdriver-loglevel=NONE" };

            PhantomJSOptions options = new PhantomJSOptions();
            options.AddAdditionalCapability("phantomjs.cli.args", phantomArgs);

            Module = module;
            var driverService = PhantomJSDriverService.CreateDefaultService();
            driverService.HideCommandPromptWindow = true;
            driverService.LogFile = "phantomJSService.log";

            driver = new PhantomJSDriver(driverService, options);
            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));

            loginUrl = string.Format("{0}/login_page.html", Module.Url.Value.ToString());
            logoutUrl = string.Format("{0}/logout.html", Module.Url.Value.ToString());
            versionUrl = string.Format("{0}/version.html", Module.Url.Value.ToString());
            eventUrl = string.Format("{0}/event.html", Module.Url.Value.ToString());
            statusLiveUrl = string.Format("{0}/statuslive.html", Module.Url.Value.ToString());

            Devices = new List<Device>();
        }
 public ParadoxAppListenerHost(IpModule module)
     : base("Paradox HttpListener", typeof(ParadoxService).Assembly)
 {
     this.module = module;
 }
 public static AppHostHttpListenerBase GetAppHostListner()
 {
     LogManager.LogFactory = new NLogFactory();
     var module = new IpModule(new Url(ConfigurationManager.AppSettings["moduleIp"]), Convert.ToInt32(ConfigurationManager.AppSettings["panelCode"]), ConfigurationManager.AppSettings["password"]);
     return new ParadoxAppListenerHost(module);
 }