void InvokeInsertItem(byte[] btBuf) { dgv_DumpData.Rows.Clear(); string szBuf = HexStringByteArrayConverter.BytesToHexString(btBuf); for (int i = 0; i < 64; i++) { dgv_DumpData.Rows.Add(); dgv_DumpData.Rows[i].Cells[0].Value = i.ToString(); dgv_DumpData.Rows[i].Cells[1].Value = szBuf.Substring(128 * i + 0, 32); dgv_DumpData.Rows[i].Cells[2].Value = szBuf.Substring(128 * i + 32, 32); dgv_DumpData.Rows[i].Cells[3].Value = szBuf.Substring(128 * i + 64, 32); dgv_DumpData.Rows[i].Cells[4].Value = szBuf.Substring(128 * i + 96, 12); dgv_DumpData.Rows[i].Cells[5].Value = szBuf.Substring(128 * i + 116, 12); dgv_DumpData.Rows[i].Cells[6].Value = szBuf.Substring(128 * i + 108, 8); } }
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; } } }