private void btnCachedKi_Click(object sender, EventArgs e) { string[] keys = KrakenClient.GetCachedKis(); StringBuilder text = new StringBuilder(); foreach (string key in keys) { text.Append(key).Append(" "); } txtA5Kc.Text = text.ToString(); }
private void krakenWorker_DoWork(object sender, DoWorkEventArgs e) { bool[] key1 = null; bool[] key2 = null; uint count1, count2; uint testCount, burstPerTest; uint success = 0, bursts = 0, kc_diff = 0; testCount = uint.Parse(textTestCount.Text); burstPerTest = uint.Parse(textBursts.Text); GSMParameters param = new GSMParameters(); byte[] kc, kc_calculated = null; kc = new byte[8]; Random rand = new Random(); KrakenClient kraken = new KrakenClient(Analyzer.KrakenHostAddress); if (!kraken.Connect()) { MessageBox.Show("Could not connect to kraken."); return; } for (uint i = 0; i < testCount; i++) { /* get new Kc */ rand.NextBytes(kc); kc_calculated = null; /* set framenumber for first burst */ param.FN = (uint)rand.Next(2715648); for (uint j = 0; j < burstPerTest && kc_calculated == null; j++) { count1 = param.Count; param.FN += 1; count2 = param.Count; key1 = generateStream(kc, count1); key2 = generateStream(kc, count2); kc_calculated = kraken.RequestResult(key1, count1, key2, count2); if (kc_calculated != null) { /* check if Kc are the same */ for (int k = 0; k < kc.Length; k++) { if (kc[k] != kc_calculated[k]) { kc_diff++; break; } if (k == 7) { success++; } } } bursts++; krakenWorker.ReportProgress(((int)i * (int)burstPerTest + (int)j + 1) * 100 / ((int)burstPerTest * (int)testCount)); } krakenWorker.ReportProgress(((int)(i + 1) * (int)burstPerTest) * 100 / ((int)burstPerTest * (int)testCount)); } MessageBox.Show("Cracking stats\n" + "\tburst crack tries: " + bursts + "\n" + "\tKc recovered: " + success + "/" + testCount + "\n" + "\tCoverage: " + (success * 100 / testCount) + "%\n" + "\tAvg. bursts needed to crack: " + ((float)(bursts - (testCount - success) * burstPerTest) / success)); }