Beispiel #1
0
        public void TestContainsFP5()
        {
            var targetPrint = new FingerPrint("evil");
            var inputPrint  = new FingerPrint("live");

            Assert.AreEqual(true, targetPrint.Contains(inputPrint));
        }
Beispiel #2
0
        public async Task <String> RetrieveDHSessionKey(String PublickKey)
        {
            String DecryptedServerNumber;
            String readString = await ActivitySocket.read();

            ReadObj = JsonParse.ReadObject(readString);
            if (FingerPrint.Verification(ReadObj.getServerPrimeNumber(), PublickKey, ReadObj.getFingerPrint()))
            {
                if (MacAlgProvider.VerifyHMAC(ReadObj.getServerPrimeNumber(), SymmetricKey.StrKeyBase64,
                                              ReadObj.getHmacHash()))
                {
                    DecryptedServerNumber = AesEncryption.AES_Decrypt(ReadObj.getServerPrimeNumber(),
                                                                      SymmetricKey.StrKeyBase64);
                }
                else
                {
                    throw new Exception("Integrity of SymmetricKey canot verified");
                }
            }

            else
            {
                throw new Exception("Integrity of RSA canot verified");
            }

            return(GeneratoreMachine.SessionDHGenerator(DecryptedServerNumber));
        }
Beispiel #3
0
        /// <summary>
        /// Init: Calculate hardwareid.
        /// </summary>
        public KeyOnline(IPluginHost host)
        {
            m_host = host;
            FingerPrint clFingerPrint = new FingerPrint();

            HardwareId = clFingerPrint.Value();
        }
Beispiel #4
0
        public MainWindow()
        {
            InitializeComponent();

            // Verify licensing valid
            string licensePath  = AppConfigReadingService.GetConfigSetting("metadataFileDirectory") + "\\Licensing.txt";
            string savedLicense = IOService.ReadTextFileToString(licensePath);
            string validLicense = FingerPrint.Value();

            if (savedLicense == validLicense)
            {
                StartPage startPage = new StartPage();
                mainFrame.NavigationService.Navigate(startPage);
            }
            else
            {
                string           sMessageBoxText = "程序启动失败,序列号错误";
                string           sCaption        = "程序启动失败";
                MessageBoxButton btnMessageBox   = MessageBoxButton.OK;
                MessageBoxImage  icnMessageBox   = MessageBoxImage.Error;
                MessageBoxResult rsltMessageBox  = MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);

                switch (rsltMessageBox)
                {
                case MessageBoxResult.OK:
                    Application.Current.Shutdown();
                    return;
                }
            }


            //Testing();
            //Testing2();
        }
Beispiel #5
0
 /// <summary>
 ///     This function store the content of the fingerprint file in a variable.
 /// </summary>
 public static void LoadFingerPrint()
 {
     if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"]))
     {
         FingerPrint = new FingerPrint(@"Gamefiles/fingerprint.json");
     }
 }
 void ExtractUpk()
 {
     ResetProgress(Status.Extract);
     StartThread(delegate {
         if (File.Exists(_upkPath))
         {
             FingerPrint.StartWriting(_bundleFolder);
             if (UPKExtra.ExtraUPK(_upkPath, _bundleFolder, _progress, true, delegate(string path, byte[] bytes) {
                 FingerPrint.AddItem(path, MiscUtils.GetMd5HashFromBytes(bytes), _bundleFolder);
             }))
             {
                 FingerPrint.Flush();
                 ChangeStatus(Status.Done);
                 File.Delete(_upkPath);
             }
             else
             {
                 Fail();
             }
         }
         else
         {
             ChangeStatus(Status.Request);
         }
     });
 }
        public ObjectManager()
        {
            m_vTimerCanceled = false;

            m_vDatabase = new DatabaseManager();

            NpcLevels      = new Dictionary <int, string>();
            m_vRandomBases = new Dictionary <int, string>();
            FingerPrint    = new FingerPrint();

            MaxPlayerID   = Convert.ToInt32(m_vDatabase.GetMaxPlayerId() + 1);
            MaxAllianceID = Convert.ToInt32(m_vDatabase.GetMaxAllianceId() + 1);

            m_vAvatarSeed   = MaxPlayerID;
            m_vAllianceSeed = MaxAllianceID;

            using (StreamReader sr = new StreamReader(@"Gamefiles/starting_home.json"))
            {
                m_vHomeDefault = sr.ReadToEnd();
            }

            LoadNpcLevels();
            //LoadRandomBase(); // Useless atm

            TimerReference = new Timer(Save, null, 10000, 60000);
            Say("UCS Database has been succesfully loaded. (" + Convert.ToInt32(MaxAllianceID + MaxPlayerID) + "_Tables)");
        }
Beispiel #8
0
        public void TestContainsFP4()
        {
            var targetPrint = new FingerPrint("Boobs");
            var inputPrint  = new FingerPrint("Boasegsdss");

            Assert.AreEqual(false, targetPrint.Contains(inputPrint));
        }
Beispiel #9
0
        static TelemetryMessage()
        {
            // Obtendo MachineID
            DefaultMachineID = FingerPrint.Value();

            DefaultStationName = Environment.GetEnvironmentVariable("COMPUTERNAME");
        }
Beispiel #10
0
        public void TestContainsFP1()
        {
            var targetPrint = new FingerPrint("Boobs");
            var inputPrint  = new FingerPrint("Bos");

            Assert.AreEqual(true, targetPrint.Contains(inputPrint));
        }
Beispiel #11
0
        public void TestContainsForNonExistant()
        {
            var fingerPrint = new FingerPrint("Boobs");
            var occ         = new Occurence('v', 1);

            Assert.AreEqual(false, fingerPrint.Contains(occ));
        }
Beispiel #12
0
        public void TestContainsTrue()
        {
            var fingerPrint = new FingerPrint("Boobs");
            var occ         = new Occurence('o', 2);

            Assert.AreEqual(true, fingerPrint.Contains(occ));
        }
Beispiel #13
0
        private bool DoRegistration(out int licensePeriod)
        {
            licensePeriod = 0;
            bool state = true;

            string key_60        = FingerPrint.GetHash(SerialNumber + AuthorizationKey + "60");
            string key_365       = FingerPrint.GetHash(SerialNumber + AuthorizationKey + "365");
            string key_unlimited = FingerPrint.GetHash(SerialNumber + AuthorizationKey + "3650");

            if (RegistrationNumber != null && RegistrationNumber == key_60)
            {
                licensePeriod = 60;
            }
            else if (RegistrationNumber != null && RegistrationNumber == key_365)
            {
                licensePeriod = 365;
            }
            else if (RegistrationNumber != null && RegistrationNumber == key_unlimited)
            {
                licensePeriod = 3650;
            }
            else
            {
                state = false;
            }
            return(state);
        }
Beispiel #14
0
 public UniversalClient()
 {
     Client                   = new TcpClient();
     Encryption               = new ClientRSA();
     clientSignature          = new Signature();
     clientSignature.clientId = FingerPrint.Value();
     clientSignature.clientIp = new WebClient().DownloadString("http://icanhazip.com");
 }
Beispiel #15
0
 public AbsenVerification(pegawai selectedPegawai)
 {
     InitializeComponent();
     Pegawai          = selectedPegawai;
     Finger           = ResourcesBase.GetFinger();
     this.DataContext = this;
     this.Loaded     += AbsenVerification_Loaded;
 }
Beispiel #16
0
 public void StaticEqualsTest()
 {
     Assert.IsTrue(FingerPrint.Equals(null, null));
     Assert.IsFalse(FingerPrint.Equals(new FingerPrint("123465ABCDE"), null));
     Assert.IsFalse(FingerPrint.Equals(null, new FingerPrint("123465ABCDE")));
     Assert.IsFalse(FingerPrint.Equals(new FingerPrint("123465ABCDE1"), new FingerPrint("123465ABCDE2")));
     Assert.IsTrue(FingerPrint.Equals(new FingerPrint("123465ABCDE"), new FingerPrint("123465ABCDE")));
 }
Beispiel #17
0
 public static FingerPrint GetSingleton()
 {
     if (m_singleton == null)
     {
         m_singleton = new FingerPrint();
     }
     return(m_singleton);
 }
Beispiel #18
0
 public void IsValidTest()
 {
     Assert.IsFalse(FingerPrint.IsValid(null));
     Assert.IsFalse(FingerPrint.IsValid(String.Empty));
     Assert.IsFalse(FingerPrint.IsValid("unit test"));
     Assert.IsFalse(KeyId.IsValid("子子子子子子子子子子子子子子子子"));
     Assert.IsTrue(FingerPrint.IsValid("123465ABCDE"));
 }
Beispiel #19
0
        public ActionResult DeleteConfirmed(int id)
        {
            FingerPrint fingerPrint = db.FingerPrints.Find(id);

            db.FingerPrints.Remove(fingerPrint);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #20
0
        private void ShowRecordFingerprint()
        {
            FingerPrint.GetSingleton().RemoveFingerprintEvent(Controls);
            var fingerForm = new FingerPrintForm();

            fingerForm.m_fingerPrintCallback = ReceiveFingerPrint;
            fingerForm.ShowDialog();
        }
Beispiel #21
0
        public Get_OutUpdateFingerAndPicr UpdateFingerAndPic(string data)
        {
            Get_InUpdateFingerAndPic   model = null;
            Get_OutUpdateFingerAndPicr json  = new Get_OutUpdateFingerAndPicr();

            try
            {
                //data = HttpUtility.UrlDecode(data);
                model = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InUpdateFingerAndPic>(data);
                DBTrainman db = new DBTrainman();
                bool       updateFingerPrint = false;
                bool       updatePicture     = false;
                int        i = db.UpdateFingerAndPic(model.trainman, out updateFingerPrint, out updatePicture);
                if (i == 1)
                {
                    json.result    = "0";
                    json.resultStr = "返回成功,成功更新一条数据!";
                    if (updateFingerPrint)  //指纹
                    {
                        FingerPrint FingerPrint_m = new FingerPrint();
                        FingerPrint_m.ID      = model.trainman.nID;
                        FingerPrint_m.Number  = model.trainman.strTrainmanNumber;
                        FingerPrint_m.Finger1 = model.trainman.FingerPrint1;
                        FingerPrint_m.Finger2 = model.trainman.FingerPrint2;
                        AddLog(2, Newtonsoft.Json.JsonConvert.SerializeObject(FingerPrint_m), model.trainman.strTrainmanNumber, strIdentifier_zhiwen);
                    }
                    if (updatePicture)    //图片
                    {
                        Picture Picture_m = new Picture();
                        Picture_m.ID     = model.trainman.nID;
                        Picture_m.Number = model.trainman.strTrainmanNumber;
                        Picture_m.Pic    = model.trainman.Picture;
                        AddLog(2, Newtonsoft.Json.JsonConvert.SerializeObject(Picture_m), model.trainman.strTrainmanNumber, strIdentifier_zhaopian);
                    }
                }
                else if (i == 2)
                {
                    json.result    = "1";
                    json.resultStr = "所传对象为空!修改失败!";
                }
                else if (i == 3)
                {
                    json.result    = "0";
                    json.resultStr = "未修改任何照片或指纹!";
                }
                else if (i == 0)
                {
                    json.result    = "1";
                    json.resultStr = "找不到该记录!";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Beispiel #22
0
    private void CheckFingerPrintWithServer(string json)
    {
        string   url      = "Assetbundle/CheckBundle";
        JsonData tempData = new JsonData();

                #if UNITY_ANDROID
        tempData["local_files"]    = json;
        tempData["no_compression"] = "1";
                #else
        tempData["local_files"] = Convert.ToBase64String(GZipUtil.Zip(json));
                #endif

        byte[] Data = System.Text.Encoding.UTF8.GetBytes(tempData.ToJson());
        StaticMonoBehaviour.Instance.StartCoroutine(HttpRequest.Instance.WebRequest(HttpRequest.HttpReqType.POST, url, Data, (string Json) => {
            JsonData tempJson = JsonMapper.ToObject(Json);
            JsonData data     = tempJson["data"];
                        #if UNITY_ANDROID
            string filesUpdate = data ["file_to_update"].ToString();
            string filesDelete = data ["file_to_delete"].ToString();
                        #else
            string filesUpdate = GZipUtil.UnZipToString(Convert.FromBase64String(data["file_to_update"].ToString()));
            string filesDelete = GZipUtil.UnZipToString(Convert.FromBase64String(data["file_to_delete"].ToString()));
            LogManager.Log("file_to_update: " + filesUpdate);
            LogManager.Log("file_to_delete: " + filesDelete);
                        #endif
            FingerPrint.StartWriting(m_AssetBundlePath);
            if (!string.IsNullOrEmpty(filesDelete))
            {
                JsonData jdFilesDelete = JsonMapper.ToObject(filesDelete);
                for (int i = 0; i < jdFilesDelete.Count; ++i)
                {
                    var filePath = m_AssetBundlePath + jdFilesDelete[i].ToString();
                    if (File.Exists(filePath))
                    {
                        File.Delete(filePath);
                    }
                    FingerPrint.DeleteItem(filePath, m_AssetBundlePath);
                }
            }
            FingerPrint.Flush();
            //有需要更新的文件
            if (!string.IsNullOrEmpty(filesUpdate))
            {
                JsonData jdFilesUpdate = JsonMapper.ToObject(filesUpdate);
                string staticServer    = data["static_server"].ToString();
                string platformPath    = data["platform_path"].ToString();
                List <string> paths    = GetPathFromJson(jdFilesUpdate, "");
                if (paths.Count > 0)
                {
                    DownloadFiles(paths, staticServer, platformPath);
                }
                else
                {
                    Ready();
                }
            }
        }, NetworkFail));
    }
Beispiel #23
0
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            AppDomain currentDomain = AppDomain.CurrentDomain;

            fingerprint = FingerPrint.Value();
            Initialize();
        }
Beispiel #24
0
        private void Button_Click_2(object sender, System.Windows.RoutedEventArgs e)
        {
            var r = FingerPrint.GetTags(myTracky.Path);

            if (r != null)
            {
                txtTitle.Text  = r.Title;
                txtArtist.Text = r.Artists[0].Name;
            }
        }
Beispiel #25
0
        private static void SaveFingerPrint(String destFileName, FingerPrint fingerPrint)
        {
            String fingerPrintFileName = FileDownloadHelper.MakeFingerPrintFilePath(destFileName);

            SecurityElement finger_print = new SecurityElement("finger_print");

            finger_print.AddAttribute("time_stamp", fingerPrint.timeStamp);
            finger_print.AddAttribute("file_size", fingerPrint.fileSize.ToString());

            File.WriteAllText(fingerPrintFileName, finger_print.ToString());
        }
Beispiel #26
0
 public ActionResult Edit([Bind(Include = "FingerPrintID,CustomerID,Arcs,Whorls,Loops")] FingerPrint fingerPrint)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fingerPrint).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "CustomerName", fingerPrint.CustomerID);
     return(View(fingerPrint));
 }
Beispiel #27
0
        private void FingerPrintForm_Load(object sender, EventArgs e)
        {
            FormManager.GetSingleton().SetCurrentFocusForm(this);
            m_zkFprint = FingerPrint.GetSingleton().GetFingerprint();

            FingerPrint.GetSingleton().SetupFingerprintEvent(Controls, zkFprint_OnFeatureInfo, zkFprint_OnImageReceived, zkFprint_OnEnroll, zkFprint_OnCapture);
            //Console.WriteLine();
            // m_zkFprint.BeginCapture();
            // m_zkFprint.CancelEnroll();
            m_zkFprint.EnrollCount = 3;
            m_zkFprint.BeginEnroll();
            ShowMessage("Please give fingerprint regiss.");
        }
Beispiel #28
0
        public static void GetPremiumScript(ScriptRequest eScriptRequest)
        {
            object ret = SendAuthData(UserData.SerialKey, FingerPrint.Value(), false);

            if (ret is Result)
            {
                Enum.TryParse(ret.ToString(), out Result result);
                if (result == Result.Success)
                {
                    object retScript = SendScriptRequest(eScriptRequest);
                }
            }
        }
Beispiel #29
0
 public static string GetBiosSerialNumber()
 {
     //List<Win32_BIOS> __BiosInfo = GetBiosInfo();
     //if (__BiosInfo != null)
     //{
     //    return __BiosInfo[0].SerialNumber;
     //}
     //else
     //{
     //    return null;
     //}
     return(FingerPrint.GetUniqueIdentifier());
 }
Beispiel #30
0
        public RegistrationViewModel(IDialogCoordinator instance)
        {
            GetSW_GUID();
            SerialNumber = FingerPrint.GetMAC().Replace(':', '-');
            summary      = FingerPrint.GetSummary() + "\nMAC\t" + SerialNumber + "\nGUID\t" + appGuid;


            dialogCoordinator = instance;

            OkCommand       = new RelayCommand(OnRegistration);
            CancelCommand   = new RelayCommand(OnCancel);
            LoadedCommand   = new RelayCommand(Loaded);
            UnloadedCommand = new RelayCommand(Unloaded);
        }
Beispiel #31
0
		private static void SaveFingerPrint(String destFileName, FingerPrint fingerPrint)
		{
			String fingerPrintFileName = FileDownloader.MakeFingerPrintFilePath(destFileName);

			SecurityElement finger_print = new SecurityElement("finger_print");

			finger_print.AddAttribute("time_stamp", fingerPrint.timeStamp);
			finger_print.AddAttribute("file_size", fingerPrint.fileSize.ToString());

			File.WriteAllText(fingerPrintFileName, finger_print.ToString());
		}
Beispiel #32
0
        // internal AND protected
        internal override GpgInterfaceResult ProcessLine(String line)
        {
            if (!GNUCheck(ref line))
                return GpgInterfaceResult.Success;

            switch (GetKeyword(ref line))
            {
                case GpgKeyword.NODATA:
                    return new GpgInterfaceResult(GpgInterfaceStatus.Error, GpgInterfaceMessage.DataError);

                case GpgKeyword.IMPORT_OK:
                {
                    String[] parts = line.Split(new Char[] { ' ' });

                    Int32 flag = Int32.Parse(parts[0], CultureInfo.InvariantCulture);
                    FingerPrint = new FingerPrint(parts[1]);

                    if (flag == 0)
                        Import = Import.Unchanged;
                    if ((flag & 1) == 1)
                        Import |= Import.NewKey;
                    if ((flag & 2) == 2)
                        Import |= Import.NewUserIds;
                    if ((flag & 4) == 4)
                        Import |= Import.NewSignatures;
                    if ((flag & 8) == 8)
                        Import |= Import.NewSubKeys;
                    if ((flag & 16) == 16)
                        Import |= Import.ContainsPrivateKey;

                    break;
                }
            }

            return GpgInterfaceResult.Success;
        }