This commit is contained in:
XAS-712 2019-03-02 18:23:59 +08:00
parent 7c4f1d7a7f
commit e7468547d6
8 changed files with 237 additions and 68 deletions

View File

@ -69,7 +69,6 @@
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.buttonECheckEncrypt = new System.Windows.Forms.Button(); this.buttonECheckEncrypt = new System.Windows.Forms.Button();
this.buttonEAdv = new System.Windows.Forms.Button();
this.buttoEScanCard = new System.Windows.Forms.Button(); this.buttoEScanCard = new System.Windows.Forms.Button();
this.groupBox7 = new System.Windows.Forms.GroupBox(); this.groupBox7 = new System.Windows.Forms.GroupBox();
this.buttonECuidWrite = new System.Windows.Forms.Button(); this.buttonECuidWrite = new System.Windows.Forms.Button();
@ -91,6 +90,8 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.groupBox8 = new System.Windows.Forms.GroupBox(); this.groupBox8 = new System.Windows.Forms.GroupBox();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.groupBox11 = new System.Windows.Forms.GroupBox();
this.checkBoxHardLowCost = new System.Windows.Forms.CheckBox();
this.groupBox13 = new System.Windows.Forms.GroupBox(); this.groupBox13 = new System.Windows.Forms.GroupBox();
this.checkBoxAutoSave = new System.Windows.Forms.CheckBox(); this.checkBoxAutoSave = new System.Windows.Forms.CheckBox();
this.checkBoxDefIsAdv = new System.Windows.Forms.CheckBox(); this.checkBoxDefIsAdv = new System.Windows.Forms.CheckBox();
@ -110,8 +111,9 @@
this.remoteVersionLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.remoteVersionLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripCheckUpdate = new System.Windows.Forms.ToolStripSplitButton(); this.toolStripCheckUpdate = new System.Windows.Forms.ToolStripSplitButton();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox11 = new System.Windows.Forms.GroupBox(); this.buttonEStop = new System.Windows.Forms.Button();
this.checkBoxHardLowCost = new System.Windows.Forms.CheckBox(); this.groupBox14 = new System.Windows.Forms.GroupBox();
this.checkBoxNewScan = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
@ -125,12 +127,13 @@
this.groupBox9.SuspendLayout(); this.groupBox9.SuspendLayout();
this.groupBox8.SuspendLayout(); this.groupBox8.SuspendLayout();
this.tabPage3.SuspendLayout(); this.tabPage3.SuspendLayout();
this.groupBox11.SuspendLayout();
this.groupBox13.SuspendLayout(); this.groupBox13.SuspendLayout();
this.groupBox12.SuspendLayout(); this.groupBox12.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericCLIFontSize)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericCLIFontSize)).BeginInit();
this.groupBox6.SuspendLayout(); this.groupBox6.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.groupBox11.SuspendLayout(); this.groupBox14.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
@ -494,6 +497,7 @@
// //
// tabPage2 // tabPage2
// //
this.tabPage2.Controls.Add(this.buttonEStop);
this.tabPage2.Controls.Add(this.label8); this.tabPage2.Controls.Add(this.label8);
this.tabPage2.Controls.Add(this.label7); this.tabPage2.Controls.Add(this.label7);
this.tabPage2.Controls.Add(this.label6); this.tabPage2.Controls.Add(this.label6);
@ -501,7 +505,6 @@
this.tabPage2.Controls.Add(this.label3); this.tabPage2.Controls.Add(this.label3);
this.tabPage2.Controls.Add(this.label2); this.tabPage2.Controls.Add(this.label2);
this.tabPage2.Controls.Add(this.buttonECheckEncrypt); this.tabPage2.Controls.Add(this.buttonECheckEncrypt);
this.tabPage2.Controls.Add(this.buttonEAdv);
this.tabPage2.Controls.Add(this.buttoEScanCard); this.tabPage2.Controls.Add(this.buttoEScanCard);
this.tabPage2.Controls.Add(this.groupBox7); this.tabPage2.Controls.Add(this.groupBox7);
this.tabPage2.Controls.Add(this.buttonEscan); this.tabPage2.Controls.Add(this.buttonEscan);
@ -581,16 +584,6 @@
this.buttonECheckEncrypt.UseVisualStyleBackColor = true; this.buttonECheckEncrypt.UseVisualStyleBackColor = true;
this.buttonECheckEncrypt.Click += new System.EventHandler(this.buttonECheckEncrypt_Click); this.buttonECheckEncrypt.Click += new System.EventHandler(this.buttonECheckEncrypt_Click);
// //
// buttonEAdv
//
this.buttonEAdv.Location = new System.Drawing.Point(574, 6);
this.buttonEAdv.Name = "buttonEAdv";
this.buttonEAdv.Size = new System.Drawing.Size(177, 40);
this.buttonEAdv.TabIndex = 4;
this.buttonEAdv.Text = "点此进入高级模式>>>";
this.buttonEAdv.UseVisualStyleBackColor = true;
this.buttonEAdv.Click += new System.EventHandler(this.buttonEAdv_Click);
//
// buttoEScanCard // buttoEScanCard
// //
this.buttoEScanCard.Location = new System.Drawing.Point(123, 24); this.buttoEScanCard.Location = new System.Drawing.Point(123, 24);
@ -819,6 +812,7 @@
// //
// tabPage3 // tabPage3
// //
this.tabPage3.Controls.Add(this.groupBox14);
this.tabPage3.Controls.Add(this.groupBox11); this.tabPage3.Controls.Add(this.groupBox11);
this.tabPage3.Controls.Add(this.groupBox13); this.tabPage3.Controls.Add(this.groupBox13);
this.tabPage3.Controls.Add(this.groupBox12); this.tabPage3.Controls.Add(this.groupBox12);
@ -829,6 +823,28 @@
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "软件设置"; this.tabPage3.Text = "软件设置";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
this.tabPage3.Click += new System.EventHandler(this.tabPage3_Click);
//
// groupBox11
//
this.groupBox11.Controls.Add(this.checkBoxHardLowCost);
this.groupBox11.Location = new System.Drawing.Point(209, 89);
this.groupBox11.Name = "groupBox11";
this.groupBox11.Size = new System.Drawing.Size(200, 91);
this.groupBox11.TabIndex = 14;
this.groupBox11.TabStop = false;
this.groupBox11.Text = "HardNested";
//
// checkBoxHardLowCost
//
this.checkBoxHardLowCost.AutoSize = true;
this.checkBoxHardLowCost.Location = new System.Drawing.Point(9, 24);
this.checkBoxHardLowCost.Name = "checkBoxHardLowCost";
this.checkBoxHardLowCost.Size = new System.Drawing.Size(104, 19);
this.checkBoxHardLowCost.TabIndex = 0;
this.checkBoxHardLowCost.Text = "单线程计算";
this.checkBoxHardLowCost.UseVisualStyleBackColor = true;
this.checkBoxHardLowCost.CheckedChanged += new System.EventHandler(this.checkBoxHardLowCost_CheckedChanged);
// //
// groupBox13 // groupBox13
// //
@ -1037,26 +1053,37 @@
this.timer1.Enabled = true; this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// groupBox11 // buttonEStop
// //
this.groupBox11.Controls.Add(this.checkBoxHardLowCost); this.buttonEStop.Font = new System.Drawing.Font("宋体", 11F);
this.groupBox11.Location = new System.Drawing.Point(209, 89); this.buttonEStop.Location = new System.Drawing.Point(662, 143);
this.groupBox11.Name = "groupBox11"; this.buttonEStop.Name = "buttonEStop";
this.groupBox11.Size = new System.Drawing.Size(200, 91); this.buttonEStop.Size = new System.Drawing.Size(89, 31);
this.groupBox11.TabIndex = 14; this.buttonEStop.TabIndex = 13;
this.groupBox11.TabStop = false; this.buttonEStop.Text = "停止";
this.groupBox11.Text = "HardNested"; this.buttonEStop.UseVisualStyleBackColor = true;
// //
// checkBoxHardLowCost // groupBox14
// //
this.checkBoxHardLowCost.AutoSize = true; this.groupBox14.Controls.Add(this.checkBoxNewScan);
this.checkBoxHardLowCost.Location = new System.Drawing.Point(9, 24); this.groupBox14.Location = new System.Drawing.Point(415, 3);
this.checkBoxHardLowCost.Name = "checkBoxHardLowCost"; this.groupBox14.Name = "groupBox14";
this.checkBoxHardLowCost.Size = new System.Drawing.Size(104, 19); this.groupBox14.Size = new System.Drawing.Size(150, 177);
this.checkBoxHardLowCost.TabIndex = 0; this.groupBox14.TabIndex = 15;
this.checkBoxHardLowCost.Text = "单线程计算"; this.groupBox14.TabStop = false;
this.checkBoxHardLowCost.UseVisualStyleBackColor = true; this.groupBox14.Text = "优化设置";
this.checkBoxHardLowCost.CheckedChanged += new System.EventHandler(this.checkBoxHardLowCost_CheckedChanged); //
// checkBoxNewScan
//
this.checkBoxNewScan.AutoSize = true;
this.checkBoxNewScan.Checked = true;
this.checkBoxNewScan.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxNewScan.Location = new System.Drawing.Point(6, 24);
this.checkBoxNewScan.Name = "checkBoxNewScan";
this.checkBoxNewScan.Size = new System.Drawing.Size(134, 19);
this.checkBoxNewScan.TabIndex = 1;
this.checkBoxNewScan.Text = "减少找设备延迟";
this.checkBoxNewScan.UseVisualStyleBackColor = true;
// //
// Form1 // Form1
// //
@ -1088,6 +1115,8 @@
this.groupBox9.PerformLayout(); this.groupBox9.PerformLayout();
this.groupBox8.ResumeLayout(false); this.groupBox8.ResumeLayout(false);
this.tabPage3.ResumeLayout(false); this.tabPage3.ResumeLayout(false);
this.groupBox11.ResumeLayout(false);
this.groupBox11.PerformLayout();
this.groupBox13.ResumeLayout(false); this.groupBox13.ResumeLayout(false);
this.groupBox13.PerformLayout(); this.groupBox13.PerformLayout();
this.groupBox12.ResumeLayout(false); this.groupBox12.ResumeLayout(false);
@ -1097,8 +1126,8 @@
this.groupBox6.PerformLayout(); this.groupBox6.PerformLayout();
this.statusStrip1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout(); this.statusStrip1.PerformLayout();
this.groupBox11.ResumeLayout(false); this.groupBox14.ResumeLayout(false);
this.groupBox11.PerformLayout(); this.groupBox14.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -1148,7 +1177,6 @@
private System.Windows.Forms.Button buttonEUIDWrite; private System.Windows.Forms.Button buttonEUIDWrite;
private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button buttonEMfWrite; private System.Windows.Forms.Button buttonEMfWrite;
private System.Windows.Forms.Button buttonEAdv;
private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel statusLabel; private System.Windows.Forms.ToolStripStatusLabel statusLabel;
private System.Windows.Forms.ToolStripStatusLabel runTimeLabel; private System.Windows.Forms.ToolStripStatusLabel runTimeLabel;
@ -1188,6 +1216,9 @@
private System.Windows.Forms.CheckBox checkBoxAutoSave; private System.Windows.Forms.CheckBox checkBoxAutoSave;
private System.Windows.Forms.GroupBox groupBox11; private System.Windows.Forms.GroupBox groupBox11;
private System.Windows.Forms.CheckBox checkBoxHardLowCost; private System.Windows.Forms.CheckBox checkBoxHardLowCost;
private System.Windows.Forms.Button buttonEStop;
private System.Windows.Forms.GroupBox groupBox14;
private System.Windows.Forms.CheckBox checkBoxNewScan;
} }
} }

View File

@ -31,6 +31,8 @@ namespace MifareOneTool
{ {
if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; }
Form1.ActiveForm.Text = "MifareOne Tool - 运行中"; Form1.ActiveForm.Text = "MifareOne Tool - 运行中";
if (Properties.Settings.Default.NewScan)
{ File.Delete("libnfc.conf"); }
BackgroundWorker bgw = new BackgroundWorker(); BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(list_dev); bgw.DoWork += new DoWorkEventHandler(list_dev);
bgw.WorkerReportsProgress = true; bgw.WorkerReportsProgress = true;
@ -38,15 +40,25 @@ namespace MifareOneTool
bgw.RunWorkerAsync(); bgw.RunWorkerAsync();
} }
void writeConfig(string devstr, bool autoscan = true, bool intscan = false)
{
string cfg = "allow_autoscan = " + (autoscan ? "true" : "false") + "\n";
cfg += "allow_intrusive_scan = " + (intscan ? "true" : "false") + "\n";
cfg += "device.name = \"NFC-Device\"\n";
cfg += "device.connstring = \"" + devstr + "\"";
File.WriteAllText("libnfc.conf", cfg);
}
void default_rpt(object sender, ProgressChangedEventArgs e) void default_rpt(object sender, ProgressChangedEventArgs e)
{ {
logAppend((string)e.UserState);
if (e.ProgressPercentage == 100) if (e.ProgressPercentage == 100)
{ {
logAppend((string)e.UserState);
Text = "MifareOne Tool - 运行完毕"; Text = "MifareOne Tool - 运行完毕";
} }
else if (e.ProgressPercentage == 101) else if (e.ProgressPercentage == 101)
{ {
logAppend((string)e.UserState);
if (lastuid != "") if (lastuid != "")
{ {
if (File.Exists(omfd) && new FileInfo(omfd).Length > 1) if (File.Exists(omfd) && new FileInfo(omfd).Length > 1)
@ -74,7 +86,7 @@ namespace MifareOneTool
ofd.DefaultExt = ".mfd"; ofd.DefaultExt = ".mfd";
ofd.Title = "请选择MFD文件保存位置及文件名"; ofd.Title = "请选择MFD文件保存位置及文件名";
ofd.OverwritePrompt = true; ofd.OverwritePrompt = true;
ofd.Filter = "MFD文件|*.mfd|DUMP文件|*.dump"; ofd.Filter = "MFD文件|*.mfd;*.dump";
if (File.Exists(omfd) && new FileInfo(omfd).Length > 1) if (File.Exists(omfd) && new FileInfo(omfd).Length > 1)
{ {
if (ofd.ShowDialog() == DialogResult.OK) if (ofd.ShowDialog() == DialogResult.OK)
@ -103,19 +115,30 @@ namespace MifareOneTool
} }
else if (e.ProgressPercentage == 102) else if (e.ProgressPercentage == 102)
{ {
string noncefile = lastuid; logAppend((string)e.UserState);
lastuid = ""; logAppend("##Nonce收集完毕##");
if (File.Exists(noncefile)) logAppend("您可以在本地计算,或是上传到云计算服务节点进行计算。");
{
logAppend("##Nonce收集完毕-" + noncefile + "##");
logAppend("您可以在本地计算,或是上传到云计算服务节点进行计算。");
}
else
{
logAppend("##Nonce收集出错##");
}
Text = "MifareOne Tool - 运行完毕"; Text = "MifareOne Tool - 运行完毕";
} }
else if (e.ProgressPercentage == 103)
{
logAppend("识别了以下设备:");
List<string> myReaders = (List<string>)(e.UserState);
foreach (string reader in myReaders)
{
logAppend(reader);
}
if (myReaders.Count > 0)
{
logAppend("将自动选择首个设备:" + myReaders.First());
writeConfig(myReaders.First());
}
}
else
{
logAppend((string)e.UserState);
}
Application.DoEvents(); Application.DoEvents();
} }
@ -137,7 +160,22 @@ namespace MifareOneTool
lprocess = true; lprocess = true;
BackgroundWorker b = (BackgroundWorker)sender; BackgroundWorker b = (BackgroundWorker)sender;
process = Process.Start(psi); running = true; process = Process.Start(psi); running = true;
process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); List<string> myReader = new List<string>();
process.OutputDataReceived += (s, _e) =>
{
b.ReportProgress(0, _e.Data);
if (Properties.Settings.Default.NewScan)
{
if (!string.IsNullOrEmpty(_e.Data))
{
Match m = Regex.Match(_e.Data, "pn532_uart:COM\\d:115200");
if (m.Success)
{
myReader.Add(m.Value);
}
}
}
};
process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data);
//StreamReader stderr = process.StandardError; //StreamReader stderr = process.StandardError;
process.BeginOutputReadLine(); process.BeginOutputReadLine();
@ -145,6 +183,7 @@ namespace MifareOneTool
process.WaitForExit(); process.WaitForExit();
lprocess = false; lprocess = false;
running = false; running = false;
b.ReportProgress(103, myReader);
b.ReportProgress(100, "##运行完毕##"); b.ReportProgress(100, "##运行完毕##");
} }
@ -163,10 +202,12 @@ namespace MifareOneTool
buttonCLIColor.ForeColor = Properties.Settings.Default.MainCLIColor; buttonCLIColor.ForeColor = Properties.Settings.Default.MainCLIColor;
checkBoxDefIsAdv.Checked = Properties.Settings.Default.DefIsAdv; checkBoxDefIsAdv.Checked = Properties.Settings.Default.DefIsAdv;
checkBoxHardLowCost.Checked = Properties.Settings.Default.HardLowCost; checkBoxHardLowCost.Checked = Properties.Settings.Default.HardLowCost;
checkBoxNewScan.Checked = Properties.Settings.Default.NewScan;
if (Properties.Settings.Default.DefIsAdv) if (Properties.Settings.Default.DefIsAdv)
{ {
tabControl1.SelectedIndex = 1; tabControl1.SelectedIndex = 1;
} }
File.Delete("libnfc.conf");
} }
private void buttonScanCard_Click(object sender, EventArgs e) private void buttonScanCard_Click(object sender, EventArgs e)
@ -385,7 +426,7 @@ namespace MifareOneTool
string rmfd = ""; string rmfd = "";
OpenFileDialog ofd = new OpenFileDialog(); OpenFileDialog ofd = new OpenFileDialog();
ofd.CheckFileExists = true; ofd.CheckFileExists = true;
ofd.Filter = "MFD文件|*.mfd|DUMP文件|*.dump"; ofd.Filter = "MFD文件|*.mfd;*.dump";
ofd.Title = "请选择需要写入的MFD文件"; ofd.Title = "请选择需要写入的MFD文件";
ofd.Multiselect = false; ofd.Multiselect = false;
if (ofd.ShowDialog() == DialogResult.OK) if (ofd.ShowDialog() == DialogResult.OK)
@ -458,9 +499,10 @@ namespace MifareOneTool
string key = ""; string key = "";
if (Control.ModifierKeys == Keys.Control) if (Control.ModifierKeys == Keys.Control)
{ {
string[] ks = Interaction.InputBox("请输入已知的Key以英文半角逗号分隔。", "请输入已知Key", "FFFFFFFFFFFF", -1, -1).Trim().Split(','); string[] ks = Interaction.InputBox("请输入已知的Key以英文半角逗号分隔。", "请输入已知Key", Properties.Settings.Default.LastTryKey, -1, -1).Trim().Split(',');
if (ks.Length > 0) if (ks.Length > 0)
{ {
Properties.Settings.Default.LastTryKey = string.Join(",", ks);
foreach (string k in ks) foreach (string k in ks)
{ {
string pat = "[0-9A-Fa-f]{12}"; string pat = "[0-9A-Fa-f]{12}";
@ -650,7 +692,7 @@ namespace MifareOneTool
string rmfd = ""; string rmfd = "";
OpenFileDialog ofd = new OpenFileDialog(); OpenFileDialog ofd = new OpenFileDialog();
ofd.CheckFileExists = true; ofd.CheckFileExists = true;
ofd.Filter = "MFD文件|*.mfd|DUMP文件|*.dump"; ofd.Filter = "MFD文件|*.mfd;*.dump";
ofd.Title = "请选择需要写入的MFD文件"; ofd.Title = "请选择需要写入的MFD文件";
ofd.Multiselect = false; ofd.Multiselect = false;
if (ofd.ShowDialog() == DialogResult.OK) if (ofd.ShowDialog() == DialogResult.OK)
@ -792,7 +834,7 @@ namespace MifareOneTool
string rmfd = ""; string rmfd = "";
OpenFileDialog ofd = new OpenFileDialog(); OpenFileDialog ofd = new OpenFileDialog();
ofd.CheckFileExists = true; ofd.CheckFileExists = true;
ofd.Filter = "MFD文件|*.mfd|DUMP文件|*.dump"; ofd.Filter = "MFD文件|*.mfd;*.dump";
ofd.Title = "请选择需要写入的MFD文件"; ofd.Title = "请选择需要写入的MFD文件";
ofd.Multiselect = false; ofd.Multiselect = false;
if (ofd.ShowDialog() == DialogResult.OK) if (ofd.ShowDialog() == DialogResult.OK)
@ -1061,18 +1103,35 @@ namespace MifareOneTool
private void buttonCheckEncrypt_Click(object sender, EventArgs e) private void buttonCheckEncrypt_Click(object sender, EventArgs e)
{//其实这个mfdetect就是个mfoc阉割版。。只检测不破解而已所以-f -k什么的可以加上测试自己的key {//其实这个mfdetect就是个mfoc阉割版。。只检测不破解而已所以-f -k什么的可以加上测试自己的key
if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中"; if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中";
string key = "";
if (Control.ModifierKeys == Keys.Control)
{
string[] ks = Interaction.InputBox("请输入已知的Key以英文半角逗号分隔。", "请输入已知Key", Properties.Settings.Default.LastTryKey, -1, -1).Trim().Split(',');
if (ks.Length > 0)
{
Properties.Settings.Default.LastTryKey = string.Join(",", ks);
foreach (string k in ks)
{
string pat = "[0-9A-Fa-f]{12}";
if (Regex.IsMatch(k, pat))
{
key += "-k " + k.Substring(0, 12) + " ";
}
}
}
}
BackgroundWorker bgw = new BackgroundWorker(); BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(MfDetect); bgw.DoWork += new DoWorkEventHandler(MfDetect);
bgw.WorkerReportsProgress = true; bgw.WorkerReportsProgress = true;
bgw.ProgressChanged += new ProgressChangedEventHandler(default_rpt); bgw.ProgressChanged += new ProgressChangedEventHandler(default_rpt);
bgw.RunWorkerAsync(); bgw.RunWorkerAsync(key);
} }
void MfDetect(object sender, DoWorkEventArgs e) void MfDetect(object sender, DoWorkEventArgs e)
{ {
if (lprocess) { return; } if (lprocess) { return; }
ProcessStartInfo psi = new ProcessStartInfo("nfc-bin/mfdetect.exe"); ProcessStartInfo psi = new ProcessStartInfo("nfc-bin/mfdetect.exe");
psi.Arguments = "-O dummy.tmp"; psi.Arguments = (string)(e.Argument) + "-O dummy.tmp";
psi.CreateNoWindow = true; psi.CreateNoWindow = true;
psi.UseShellExecute = false; psi.UseShellExecute = false;
psi.RedirectStandardOutput = true; psi.RedirectStandardOutput = true;
@ -1125,9 +1184,10 @@ namespace MifareOneTool
if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中"; if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中";
string rmfd = "Mfoc.tmp"; string rmfd = "Mfoc.tmp";
string key = ""; string key = "";
string[] ks = Interaction.InputBox("请输入已知的Key以英文半角逗号分隔。", "请输入已知Key", "FFFFFFFFFFFF", -1, -1).Trim().Split(','); string[] ks = Interaction.InputBox("请输入已知的Key以英文半角逗号分隔。", "请输入已知Key", Properties.Settings.Default.LastTryKey, -1, -1).Trim().Split(',');
if (ks.Length > 0) if (ks.Length > 0)
{ {
Properties.Settings.Default.LastTryKey = string.Join(",", ks);
foreach (string k in ks) foreach (string k in ks)
{ {
string pat = "[0-9A-Fa-f]{12}"; string pat = "[0-9A-Fa-f]{12}";
@ -1244,7 +1304,7 @@ namespace MifareOneTool
BackgroundWorker bgw = new BackgroundWorker(); BackgroundWorker bgw = new BackgroundWorker();
if (fhn.collectOnly()) if (fhn.collectOnly())
{ {
lastuid = "0x" + GetUID() + fhn.GetFileAfter(); //lastuid = "0x" + GetUID() + fhn.GetFileAfter();
bgw.DoWork += new DoWorkEventHandler(CollectNonce); bgw.DoWork += new DoWorkEventHandler(CollectNonce);
} }
else else
@ -1365,5 +1425,10 @@ namespace MifareOneTool
{ {
Properties.Settings.Default.HardLowCost = checkBoxHardLowCost.Checked; Properties.Settings.Default.HardLowCost = checkBoxHardLowCost.Checked;
} }
private void tabPage3_Click(object sender, EventArgs e)
{
Properties.Settings.Default.NewScan = checkBoxNewScan.Checked;
}
} }
} }

View File

@ -120,6 +120,9 @@
<metadata name="toolTipHelp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTipHelp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="toolTipHelp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>157, 17</value> <value>157, 17</value>
</metadata> </metadata>

View File

@ -44,8 +44,9 @@
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.sector2 = new System.Windows.Forms.TextBox();
this.checkBoxColOnly = new System.Windows.Forms.CheckBox(); this.checkBoxColOnly = new System.Windows.Forms.CheckBox();
this.sector2 = new System.Windows.Forms.TextBox();
this.checkBoxCollectAll = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -56,7 +57,7 @@
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 25); this.button1.Size = new System.Drawing.Size(75, 25);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
this.button1.Text = "解密!"; this.button1.Text = "执行!";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
@ -204,6 +205,7 @@
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.checkBoxCollectAll);
this.groupBox2.Controls.Add(this.checkBoxColOnly); this.groupBox2.Controls.Add(this.checkBoxColOnly);
this.groupBox2.Controls.Add(this.radioKey2B); this.groupBox2.Controls.Add(this.radioKey2B);
this.groupBox2.Controls.Add(this.radioKey2A); this.groupBox2.Controls.Add(this.radioKey2A);
@ -217,23 +219,34 @@
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "解密设置"; this.groupBox2.Text = "解密设置";
// //
// checkBoxColOnly
//
this.checkBoxColOnly.AutoSize = true;
this.checkBoxColOnly.Location = new System.Drawing.Point(7, 24);
this.checkBoxColOnly.Name = "checkBoxColOnly";
this.checkBoxColOnly.Size = new System.Drawing.Size(119, 19);
this.checkBoxColOnly.TabIndex = 17;
this.checkBoxColOnly.Text = "只采集不计算";
this.checkBoxColOnly.UseVisualStyleBackColor = true;
//
// sector2 // sector2
// //
this.sector2.Location = new System.Drawing.Point(135, 39); this.sector2.Location = new System.Drawing.Point(135, 39);
this.sector2.Name = "sector2"; this.sector2.Name = "sector2";
this.sector2.Size = new System.Drawing.Size(46, 25); this.sector2.Size = new System.Drawing.Size(46, 25);
this.sector2.TabIndex = 11; this.sector2.TabIndex = 11;
this.sector2.Text = "1";
// //
// checkBoxColOnly // checkBoxCollectAll
// //
this.checkBoxColOnly.AutoSize = true; this.checkBoxCollectAll.AutoSize = true;
this.checkBoxColOnly.Location = new System.Drawing.Point(9, 39); this.checkBoxCollectAll.Location = new System.Drawing.Point(7, 49);
this.checkBoxColOnly.Name = "checkBoxColOnly"; this.checkBoxCollectAll.Name = "checkBoxCollectAll";
this.checkBoxColOnly.Size = new System.Drawing.Size(119, 19); this.checkBoxCollectAll.Size = new System.Drawing.Size(89, 19);
this.checkBoxColOnly.TabIndex = 17; this.checkBoxCollectAll.TabIndex = 18;
this.checkBoxColOnly.Text = "只采集不计算"; this.checkBoxCollectAll.Text = "全卡采集";
this.checkBoxColOnly.UseVisualStyleBackColor = true; this.checkBoxCollectAll.UseVisualStyleBackColor = true;
this.checkBoxCollectAll.Visible = false;
this.checkBoxCollectAll.CheckedChanged += new System.EventHandler(this.checkBoxCollectAll_CheckedChanged);
// //
// FormHardNes // FormHardNes
// //
@ -282,5 +295,6 @@
private System.Windows.Forms.TextBox sector2; private System.Windows.Forms.TextBox sector2;
private System.Windows.Forms.TextBox sector1; private System.Windows.Forms.TextBox sector1;
private System.Windows.Forms.CheckBox checkBoxColOnly; private System.Windows.Forms.CheckBox checkBoxColOnly;
private System.Windows.Forms.CheckBox checkBoxCollectAll;
} }
} }

View File

@ -121,5 +121,25 @@ namespace MifareOneTool
this.DialogResult = DialogResult.Yes; this.DialogResult = DialogResult.Yes;
this.Close(); this.Close();
} }
private void checkBoxCollectAll_CheckedChanged(object sender, EventArgs e)
{
if (checkBoxCollectAll.Checked)
{
checkBoxColOnly.Checked = true;
checkBoxColOnly.Enabled = false;
sector2.Enabled = false;
radioKey2A.Enabled = false;
radioKey2B.Enabled = false;
}
else
{
checkBoxColOnly.Checked = false;
checkBoxColOnly.Enabled = true;
sector2.Enabled = true;
radioKey2A.Enabled = true;
radioKey2B.Enabled = true;
}
}
} }
} }

View File

@ -127,5 +127,29 @@ namespace MifareOneTool.Properties {
this["HardLowCost"] = value; this["HardLowCost"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("ffffffffffff")]
public string LastTryKey {
get {
return ((string)(this["LastTryKey"]));
}
set {
this["LastTryKey"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool NewScan {
get {
return ((bool)(this["NewScan"]));
}
set {
this["NewScan"] = value;
}
}
} }
} }

View File

@ -29,5 +29,11 @@
<Setting Name="HardLowCost" Type="System.Boolean" Scope="User"> <Setting Name="HardLowCost" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="LastTryKey" Type="System.String" Scope="User">
<Value Profile="(Default)">ffffffffffff</Value>
</Setting>
<Setting Name="NewScan" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -41,6 +41,12 @@
<setting name="HardLowCost" serializeAs="String"> <setting name="HardLowCost" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="LastTryKey" serializeAs="String">
<value>ffffffffffff</value>
</setting>
<setting name="NewScan" serializeAs="String">
<value>True</value>
</setting>
</MifareOneTool.Properties.Settings> </MifareOneTool.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>