private void btn_ImportData_Click(object sender, EventArgs e) { if (m_dgv_Data.Rows.Count != 64) { return; } List<string> KeyListTmp = new List<string>(); for (int i = 0; i < 64; i++) { KeyListTmp.Add(m_dgv_Data.Rows[i].Cells[4].Value.ToString()); KeyListTmp.Add(m_dgv_Data.Rows[i].Cells[5].Value.ToString()); } KeyListTmp = KeyListTmp.Distinct().ToList(); foreach (string item in KeyListTmp) { ListViewItem lvi = new ListViewItem(item); lv_KeyList.Items.Add(lvi); } }
private void GetUidToCrack(string sExecResultTmp, int ExitCode) { GetUid(sExecResultTmp, ExitCode); if (string.IsNullOrEmpty(Uid)) { if (pl.m_RetErrorMsg != null && pl.m_RetErrorMsg.Length != 0) { MessageBox.Show(pl.m_RetErrorMsg); } else { MessageBox.Show("Can not get the UID of the card"); } return; } if (FileLayer.Exists("key/" + Uid + ".dump")) { byte[] btBuf = FileLayer.Read("key/" + Uid + ".dump"); if (btBuf == null) { if (pl.m_RetErrorMsg != null && pl.m_RetErrorMsg.Length != 0) { MessageBox.Show(pl.m_RetErrorMsg); } else { if (pl.AsyncStart("nfc/mfoc.exe", "-P " + ud_Probe.Value.ToString() + " -T " + ud_distance.Value.ToString() + " -O key/" + Uid + ".dump", GetData) == false) { MessageBox.Show("已存在工作线程"); return; } } return; } List<string> KeyListTmp = new List<string>(); for (int i = 0; i < 64; i++) { byte[] btBufTmp = new byte[6]; Buffer.BlockCopy(btBuf, 64 * i + 48, btBufTmp, 0, 6); KeyListTmp.Add(HexStringByteArrayConverter.BytesToHexString(btBufTmp)); Buffer.BlockCopy(btBuf, 64 * i + 58, btBufTmp, 0, 6); KeyListTmp.Add(HexStringByteArrayConverter.BytesToHexString(btBufTmp)); } KeyListTmp = KeyListTmp.Distinct().ToList(); StringBuilder sbKeyArgv = new StringBuilder(); foreach (string item in KeyListTmp) { sbKeyArgv.Append(" -k "); sbKeyArgv.Append(item); } if (pl.AsyncStart("nfc/mfoc.exe", sbKeyArgv.ToString() + " -P " + ud_Probe.Value.ToString() + " -T " + ud_distance.Value.ToString() + " -O key/tmp.dump", GetData) == false) { MessageBox.Show("已存在工作线程"); return; } } else { if (pl.AsyncStart("nfc/mfoc.exe", "-P " + ud_Probe.Value.ToString() + " -T " + ud_distance.Value.ToString() + " -O key/" + Uid + ".dump", GetData) == false) { MessageBox.Show("已存在工作线程"); return; } } }