1.6.5半成

This commit is contained in:
XAS-712 2019-02-23 00:41:12 +08:00
parent 543c45b2b8
commit 7c4f1d7a7f
13 changed files with 274 additions and 114 deletions

View File

@ -92,6 +92,7 @@
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.groupBox13 = new System.Windows.Forms.GroupBox(); this.groupBox13 = new System.Windows.Forms.GroupBox();
this.checkBoxAutoSave = new System.Windows.Forms.CheckBox();
this.checkBoxDefIsAdv = new System.Windows.Forms.CheckBox(); this.checkBoxDefIsAdv = new System.Windows.Forms.CheckBox();
this.groupBox12 = new System.Windows.Forms.GroupBox(); this.groupBox12 = new System.Windows.Forms.GroupBox();
this.numericCLIFontSize = new System.Windows.Forms.NumericUpDown(); this.numericCLIFontSize = new System.Windows.Forms.NumericUpDown();
@ -109,7 +110,8 @@
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.checkBoxAutoSave = new System.Windows.Forms.CheckBox(); this.groupBox11 = new System.Windows.Forms.GroupBox();
this.checkBoxHardLowCost = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
@ -128,6 +130,7 @@
((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.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
@ -816,6 +819,7 @@
// //
// tabPage3 // tabPage3
// //
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);
this.tabPage3.Controls.Add(this.groupBox6); this.tabPage3.Controls.Add(this.groupBox6);
@ -837,6 +841,17 @@
this.groupBox13.TabStop = false; this.groupBox13.TabStop = false;
this.groupBox13.Text = "偏好设置"; this.groupBox13.Text = "偏好设置";
// //
// checkBoxAutoSave
//
this.checkBoxAutoSave.AutoSize = true;
this.checkBoxAutoSave.Location = new System.Drawing.Point(9, 46);
this.checkBoxAutoSave.Name = "checkBoxAutoSave";
this.checkBoxAutoSave.Size = new System.Drawing.Size(173, 19);
this.checkBoxAutoSave.TabIndex = 1;
this.checkBoxAutoSave.Text = "自动以UID名保存文件";
this.checkBoxAutoSave.UseVisualStyleBackColor = true;
this.checkBoxAutoSave.CheckedChanged += new System.EventHandler(this.checkBoxAutoSave_CheckedChanged);
//
// checkBoxDefIsAdv // checkBoxDefIsAdv
// //
this.checkBoxDefIsAdv.AutoSize = true; this.checkBoxDefIsAdv.AutoSize = true;
@ -1022,16 +1037,26 @@
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);
// //
// checkBoxAutoSave // groupBox11
// //
this.checkBoxAutoSave.AutoSize = true; this.groupBox11.Controls.Add(this.checkBoxHardLowCost);
this.checkBoxAutoSave.Location = new System.Drawing.Point(9, 46); this.groupBox11.Location = new System.Drawing.Point(209, 89);
this.checkBoxAutoSave.Name = "checkBoxAutoSave"; this.groupBox11.Name = "groupBox11";
this.checkBoxAutoSave.Size = new System.Drawing.Size(173, 19); this.groupBox11.Size = new System.Drawing.Size(200, 91);
this.checkBoxAutoSave.TabIndex = 1; this.groupBox11.TabIndex = 14;
this.checkBoxAutoSave.Text = "自动以UID名保存文件"; this.groupBox11.TabStop = false;
this.checkBoxAutoSave.UseVisualStyleBackColor = true; this.groupBox11.Text = "HardNested";
this.checkBoxAutoSave.CheckedChanged += new System.EventHandler(this.checkBoxAutoSave_CheckedChanged); //
// 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);
// //
// Form1 // Form1
// //
@ -1072,6 +1097,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.groupBox11.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -1159,6 +1186,8 @@
private System.Windows.Forms.GroupBox groupBox13; private System.Windows.Forms.GroupBox groupBox13;
private System.Windows.Forms.CheckBox checkBoxDefIsAdv; private System.Windows.Forms.CheckBox checkBoxDefIsAdv;
private System.Windows.Forms.CheckBox checkBoxAutoSave; private System.Windows.Forms.CheckBox checkBoxAutoSave;
private System.Windows.Forms.GroupBox groupBox11;
private System.Windows.Forms.CheckBox checkBoxHardLowCost;
} }
} }

View File

@ -52,7 +52,7 @@ namespace MifareOneTool
if (File.Exists(omfd) && new FileInfo(omfd).Length > 1) if (File.Exists(omfd) && new FileInfo(omfd).Length > 1)
{ {
Directory.CreateDirectory("auto_keys"); Directory.CreateDirectory("auto_keys");
string filename = "auto_keys\\" + lastuid + "_" + DateTime.Now.ToString().Replace("/","-").Replace(" ","_").Replace(":","-") + ".mfd"; string filename = "auto_keys\\" + lastuid + "_" + DateTime.Now.ToString().Replace("/", "-").Replace(" ", "_").Replace(":", "-") + ".mfd";
if (File.Exists(filename)) if (File.Exists(filename))
{ {
File.Delete(filename); File.Delete(filename);
@ -101,6 +101,21 @@ namespace MifareOneTool
omfd = ""; omfd = "";
Text = "MifareOne Tool - 运行完毕"; Text = "MifareOne Tool - 运行完毕";
} }
else if (e.ProgressPercentage == 102)
{
string noncefile = lastuid;
lastuid = "";
if (File.Exists(noncefile))
{
logAppend("##Nonce收集完毕-" + noncefile + "##");
logAppend("您可以在本地计算,或是上传到云计算服务节点进行计算。");
}
else
{
logAppend("##Nonce收集出错##");
}
Text = "MifareOne Tool - 运行完毕";
}
Application.DoEvents(); Application.DoEvents();
} }
@ -147,6 +162,7 @@ namespace MifareOneTool
richTextBox1.ForeColor = Properties.Settings.Default.MainCLIColor; richTextBox1.ForeColor = Properties.Settings.Default.MainCLIColor;
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;
if (Properties.Settings.Default.DefIsAdv) if (Properties.Settings.Default.DefIsAdv)
{ {
tabControl1.SelectedIndex = 1; tabControl1.SelectedIndex = 1;
@ -1226,7 +1242,15 @@ namespace MifareOneTool
{ {
string hardargs = fhn.GetArg(); string hardargs = fhn.GetArg();
BackgroundWorker bgw = new BackgroundWorker(); BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += new DoWorkEventHandler(Hardnest); if (fhn.collectOnly())
{
lastuid = "0x" + GetUID() + fhn.GetFileAfter();
bgw.DoWork += new DoWorkEventHandler(CollectNonce);
}
else
{
bgw.DoWork += new DoWorkEventHandler(Hardnest);
}
bgw.WorkerReportsProgress = true; bgw.WorkerReportsProgress = true;
bgw.ProgressChanged += new ProgressChangedEventHandler(default_rpt); bgw.ProgressChanged += new ProgressChangedEventHandler(default_rpt);
bgw.RunWorkerAsync(hardargs); bgw.RunWorkerAsync(hardargs);
@ -1240,6 +1264,10 @@ namespace MifareOneTool
{ {
if (lprocess) { return; } if (lprocess) { return; }
ProcessStartInfo psi = new ProcessStartInfo("nfc-bin/libnfc_hardnested.exe"); ProcessStartInfo psi = new ProcessStartInfo("nfc-bin/libnfc_hardnested.exe");
if (Properties.Settings.Default.HardLowCost)
{
psi.FileName = "nfc-bin/libnfc_hardnestedlc.exe";
}
psi.Arguments = (string)e.Argument; psi.Arguments = (string)e.Argument;
psi.CreateNoWindow = true; psi.CreateNoWindow = true;
psi.UseShellExecute = false; psi.UseShellExecute = false;
@ -1265,6 +1293,35 @@ namespace MifareOneTool
} }
} }
void CollectNonce(object sender, DoWorkEventArgs e)
{
if (lprocess) { return; }
ProcessStartInfo psi = new ProcessStartInfo("nfc-bin/collect.exe");
psi.Arguments = (string)e.Argument;
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
lprocess = true;
BackgroundWorker b = (BackgroundWorker)sender;
process = Process.Start(psi); running = true;
process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data);
process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data);
//StreamReader stderr = process.StandardError;
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
lprocess = false; running = false;
if (process.ExitCode == 0)
{
b.ReportProgress(102, "##运行完毕##");
}
else
{
b.ReportProgress(100, "##运行出错##");
}
}
private void checkBoxAutoLoadKey_CheckedChanged(object sender, EventArgs e) private void checkBoxAutoLoadKey_CheckedChanged(object sender, EventArgs e)
{ {
Properties.Settings.Default.AutoLoadUidKey = checkBoxAutoLoadKey.Checked; Properties.Settings.Default.AutoLoadUidKey = checkBoxAutoLoadKey.Checked;
@ -1303,5 +1360,10 @@ namespace MifareOneTool
{ {
Properties.Settings.Default.AutoSave = checkBoxAutoSave.Checked; Properties.Settings.Default.AutoSave = checkBoxAutoSave.Checked;
} }
private void checkBoxHardLowCost_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.HardLowCost = checkBoxHardLowCost.Checked;
}
} }
} }

View File

@ -120,9 +120,6 @@
<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

@ -43,8 +43,11 @@
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.MCT格式ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MCT格式ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MCT格式ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -72,9 +75,6 @@
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.s50BindingSource = new System.Windows.Forms.BindingSource(this.components); this.s50BindingSource = new System.Windows.Forms.BindingSource(this.components);
this.MCT格式ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
@ -204,6 +204,14 @@
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(245, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(245, 6);
// //
// 导入MCT格式ToolStripMenuItem
//
this.MCT格式ToolStripMenuItem.Name = "导入MCT格式ToolStripMenuItem";
this.MCT格式ToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L)));
this.MCT格式ToolStripMenuItem.Size = new System.Drawing.Size(248, 24);
this.MCT格式ToolStripMenuItem.Text = "导入MCT格式";
this.MCT格式ToolStripMenuItem.Click += new System.EventHandler(this.MCT格式ToolStripMenuItem_Click);
//
// 导出为MCT格式ToolStripMenuItem // 导出为MCT格式ToolStripMenuItem
// //
this.MCT格式ToolStripMenuItem.Name = "导出为MCT格式ToolStripMenuItem"; this.MCT格式ToolStripMenuItem.Name = "导出为MCT格式ToolStripMenuItem";
@ -220,6 +228,19 @@
this.ToolStripMenuItem.Text = "导出密钥字典"; this.ToolStripMenuItem.Text = "导出密钥字典";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
// //
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(245, 6);
//
// 列出全卡密钥ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "列出全卡密钥ToolStripMenuItem";
this.ToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I)));
this.ToolStripMenuItem.Size = new System.Drawing.Size(248, 24);
this.ToolStripMenuItem.Text = "列出全卡密钥";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.dataGridView1); this.groupBox1.Controls.Add(this.dataGridView1);
@ -534,27 +555,6 @@
// //
this.s50BindingSource.DataSource = typeof(MifareOneTool.S50); this.s50BindingSource.DataSource = typeof(MifareOneTool.S50);
// //
// 导入MCT格式ToolStripMenuItem
//
this.MCT格式ToolStripMenuItem.Name = "导入MCT格式ToolStripMenuItem";
this.MCT格式ToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L)));
this.MCT格式ToolStripMenuItem.Size = new System.Drawing.Size(248, 24);
this.MCT格式ToolStripMenuItem.Text = "导入MCT格式";
this.MCT格式ToolStripMenuItem.Click += new System.EventHandler(this.MCT格式ToolStripMenuItem_Click);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(245, 6);
//
// 列出全卡密钥ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "列出全卡密钥ToolStripMenuItem";
this.ToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I)));
this.ToolStripMenuItem.Size = new System.Drawing.Size(248, 24);
this.ToolStripMenuItem.Text = "列出全卡密钥";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// FormHTool // FormHTool
// //
this.AcceptButton = this.buttonSaveSectorEdit; this.AcceptButton = this.buttonSaveSectorEdit;
@ -570,6 +570,7 @@
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "FormHTool"; this.Name = "FormHTool";
this.Text = "S50HTool-beta"; this.Text = "S50HTool-beta";
this.Load += new System.EventHandler(this.FormHTool_Load);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);

View File

@ -250,7 +250,9 @@ namespace MifareOneTool
list3.AddRange(kC); list3.AddRange(kC);
list3.AddRange(kB); list3.AddRange(kB);
byte[] block3 = list3.Take(16).ToArray(); byte[] block3 = list3.Take(16).ToArray();
byte lastUC=currentS50.Sectors[currentSector].Block[3][9];
currentS50.Sectors[currentSector].Block[3] = block3; currentS50.Sectors[currentSector].Block[3] = block3;
currentS50.Sectors[currentSector].Block[3][9] = lastUC;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
dataGridView1.Rows[i].Cells[0].Value = currentS50.Sectors[i].Info(i); dataGridView1.Rows[i].Cells[0].Value = currentS50.Sectors[i].Info(i);
@ -482,5 +484,10 @@ namespace MifareOneTool
richTextBox1.Clear(); richTextBox1.Clear();
richTextBox1.Text = sb.ToString(); richTextBox1.Text = sb.ToString();
} }
private void FormHTool_Load(object sender, EventArgs e)
{
ToolStripMenuItem_Click(sender, e);
}
} }
} }

View File

@ -123,9 +123,6 @@
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="s50BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="s50BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>155, 17</value> <value>155, 17</value>
</metadata> </metadata>

View File

@ -31,20 +31,21 @@
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.keyEdit = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.radioKey1A = new System.Windows.Forms.RadioButton();
this.radioKey1B = new System.Windows.Forms.RadioButton(); this.radioKey1B = new System.Windows.Forms.RadioButton();
this.radioKey1A = new System.Windows.Forms.RadioButton();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.sector1 = new System.Windows.Forms.TextBox();
this.keyEdit = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.radioKey2B = new System.Windows.Forms.RadioButton(); this.radioKey2B = new System.Windows.Forms.RadioButton();
this.radioKey2A = new System.Windows.Forms.RadioButton(); this.radioKey2A = new System.Windows.Forms.RadioButton();
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.sector2 = new System.Windows.Forms.TextBox();
this.sector1 = new System.Windows.Forms.TextBox(); this.checkBoxColOnly = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -86,50 +87,15 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "目标卡信息"; this.groupBox1.Text = "目标卡信息";
// //
// label1 // radioKey1B
// //
this.label1.AutoSize = true; this.radioKey1B.AutoSize = true;
this.label1.ForeColor = System.Drawing.Color.Blue; this.radioKey1B.Location = new System.Drawing.Point(259, 40);
this.label1.Location = new System.Drawing.Point(12, 192); this.radioKey1B.Name = "radioKey1B";
this.label1.Name = "label1"; this.radioKey1B.Size = new System.Drawing.Size(60, 19);
this.label1.Size = new System.Drawing.Size(202, 15); this.radioKey1B.TabIndex = 15;
this.label1.TabIndex = 3; this.radioKey1B.Text = "KeyB";
this.label1.Text = "解密时请保证设备良好散热!"; this.radioKey1B.UseVisualStyleBackColor = true;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 21);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(76, 15);
this.label2.TabIndex = 0;
this.label2.Text = "已知的Key";
//
// keyEdit
//
this.keyEdit.Location = new System.Drawing.Point(9, 39);
this.keyEdit.Name = "keyEdit";
this.keyEdit.Size = new System.Drawing.Size(120, 25);
this.keyEdit.TabIndex = 10;
this.keyEdit.Text = "ffffffffffff";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(132, 21);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(52, 15);
this.label3.TabIndex = 12;
this.label3.Text = "扇区号";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(190, 21);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(37, 15);
this.label4.TabIndex = 13;
this.label4.Text = "类型";
// //
// radioKey1A // radioKey1A
// //
@ -143,15 +109,58 @@
this.radioKey1A.Text = "KeyA"; this.radioKey1A.Text = "KeyA";
this.radioKey1A.UseVisualStyleBackColor = true; this.radioKey1A.UseVisualStyleBackColor = true;
// //
// radioKey1B // label4
// //
this.radioKey1B.AutoSize = true; this.label4.AutoSize = true;
this.radioKey1B.Location = new System.Drawing.Point(259, 40); this.label4.Location = new System.Drawing.Point(190, 21);
this.radioKey1B.Name = "radioKey1B"; this.label4.Name = "label4";
this.radioKey1B.Size = new System.Drawing.Size(60, 19); this.label4.Size = new System.Drawing.Size(37, 15);
this.radioKey1B.TabIndex = 15; this.label4.TabIndex = 13;
this.radioKey1B.Text = "KeyB"; this.label4.Text = "类型";
this.radioKey1B.UseVisualStyleBackColor = true; //
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(132, 21);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(52, 15);
this.label3.TabIndex = 12;
this.label3.Text = "扇区号";
//
// sector1
//
this.sector1.Location = new System.Drawing.Point(135, 39);
this.sector1.Name = "sector1";
this.sector1.Size = new System.Drawing.Size(46, 25);
this.sector1.TabIndex = 11;
this.sector1.Text = "0";
//
// keyEdit
//
this.keyEdit.Location = new System.Drawing.Point(9, 39);
this.keyEdit.Name = "keyEdit";
this.keyEdit.Size = new System.Drawing.Size(120, 25);
this.keyEdit.TabIndex = 10;
this.keyEdit.Text = "ffffffffffff";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 21);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(76, 15);
this.label2.TabIndex = 0;
this.label2.Text = "已知的Key";
//
// label1
//
this.label1.AutoSize = true;
this.label1.ForeColor = System.Drawing.Color.Blue;
this.label1.Location = new System.Drawing.Point(12, 192);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(202, 15);
this.label1.TabIndex = 3;
this.label1.Text = "解密时请保证设备良好散热!";
// //
// radioKey2B // radioKey2B
// //
@ -195,6 +204,7 @@
// //
// groupBox2 // groupBox2
// //
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);
this.groupBox2.Controls.Add(this.label5); this.groupBox2.Controls.Add(this.label5);
@ -215,13 +225,15 @@
this.sector2.TabIndex = 11; this.sector2.TabIndex = 11;
this.sector2.Text = "1"; this.sector2.Text = "1";
// //
// sector1 // checkBoxColOnly
// //
this.sector1.Location = new System.Drawing.Point(135, 39); this.checkBoxColOnly.AutoSize = true;
this.sector1.Name = "sector1"; this.checkBoxColOnly.Location = new System.Drawing.Point(9, 39);
this.sector1.Size = new System.Drawing.Size(46, 25); this.checkBoxColOnly.Name = "checkBoxColOnly";
this.sector1.TabIndex = 11; this.checkBoxColOnly.Size = new System.Drawing.Size(119, 19);
this.sector1.Text = "0"; this.checkBoxColOnly.TabIndex = 17;
this.checkBoxColOnly.Text = "只采集不计算";
this.checkBoxColOnly.UseVisualStyleBackColor = true;
// //
// FormHardNes // FormHardNes
// //
@ -269,5 +281,6 @@
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
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;
} }
} }

View File

@ -22,11 +22,11 @@ namespace MifareOneTool
int trailer_block = 0; int trailer_block = 0;
if (sector < 32) if (sector < 32)
{ {
trailer_block = sector*4 + 3; trailer_block = sector * 4 + 3;
} }
else else
{ {
trailer_block = 128+16*(sector-32) + 15; trailer_block = 128 + 16 * (sector - 32) + 15;
} }
return trailer_block; return trailer_block;
} }
@ -36,12 +36,26 @@ namespace MifareOneTool
string arg = ""; string arg = "";
arg += keyEdit.Text.ToUpper() + " "; arg += keyEdit.Text.ToUpper() + " ";
arg += getBlock(Convert.ToInt32(sector1.Text.Trim())).ToString() + " "; arg += getBlock(Convert.ToInt32(sector1.Text.Trim())).ToString() + " ";
arg += (radioKey1A.Checked ?"A":"B") + " "; arg += (radioKey1A.Checked ? "A" : "B") + " ";
arg += getBlock(Convert.ToInt32(sector2.Text.Trim())).ToString() + " "; arg += getBlock(Convert.ToInt32(sector2.Text.Trim())).ToString() + " ";
arg += radioKey2A.Checked ? "A" : "B"; arg += radioKey2A.Checked ? "A" : "B";
return arg; return arg;
} }
public string GetFileAfter()
{
string a = "_";
a += string.Format("{0:D3}", getBlock(Convert.ToInt32(sector2.Text.Trim())));
a += radioKey2A.Checked ? "A" : "B";
a += ".txt";
return a;
}
public bool collectOnly()
{
return checkBoxColOnly.Checked;
}
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
this.DialogResult = DialogResult.Cancel; this.DialogResult = DialogResult.Cancel;

View File

@ -2,6 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using System.Diagnostics;
using System.Reflection;
namespace MifareOneTool namespace MifareOneTool
{ {
@ -13,9 +15,29 @@ namespace MifareOneTool
[STAThread] [STAThread]
static void Main() static void Main()
{ {
Application.EnableVisualStyles(); bool ret;
Application.SetCompatibleTextRenderingDefault(false); System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out ret);
Application.Run(new Form1()); if (ret)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
mutex.ReleaseMutex();
}
else
{
if (MessageBox.Show("您已经运行了MifareOne Tool打开多个本程序可能会造成冲突及不可预料到的错误。\n确认要继续吗", "您正在试图重复运行", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
mutex.ReleaseMutex();
}
else
{
Application.Exit();
}
}
} }
} }
} }

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: // 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.4.0")] [assembly: AssemblyVersion("1.6.5.0")]
[assembly: AssemblyFileVersion("1.6.4.0")] [assembly: AssemblyFileVersion("1.6.5.0")]

View File

@ -115,5 +115,17 @@ namespace MifareOneTool.Properties {
this["AutoSave"] = value; this["AutoSave"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool HardLowCost {
get {
return ((bool)(this["HardLowCost"]));
}
set {
this["HardLowCost"] = value;
}
}
} }
} }

View File

@ -26,5 +26,8 @@
<Setting Name="AutoSave" Type="System.Boolean" Scope="User"> <Setting Name="AutoSave" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="HardLowCost" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -38,6 +38,9 @@
<setting name="AutoSave" serializeAs="String"> <setting name="AutoSave" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="HardLowCost" serializeAs="String">
<value>False</value>
</setting>
</MifareOneTool.Properties.Settings> </MifareOneTool.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>