diff --git a/MifareOneTool/Form1.Designer.cs b/MifareOneTool/Form1.Designer.cs index db9e79b..6bd8d3e 100644 --- a/MifareOneTool/Form1.Designer.cs +++ b/MifareOneTool/Form1.Designer.cs @@ -60,6 +60,7 @@ private void InitializeComponent() this.buttonDictMfoc = new System.Windows.Forms.Button(); this.buttonnKeysMfoc = new System.Windows.Forms.Button(); this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.buttonMFF08 = new System.Windows.Forms.Button(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.buttonEStop = new System.Windows.Forms.Button(); @@ -203,7 +204,7 @@ private void InitializeComponent() this.richTextBox1.ReadOnly = true; this.richTextBox1.Size = new System.Drawing.Size(576, 313); this.richTextBox1.TabIndex = 1; - this.richTextBox1.Text = "Hello,cardman!\n建议点击\"检测\"以加快后续运行速度\n"; + this.richTextBox1.Text = "Hello,cardman!\n首次运行建议点击\"检测设备\"以加快后续运行速度\n"; // // buttonMfRead // @@ -510,6 +511,7 @@ private void InitializeComponent() // // groupBox4 // + this.groupBox4.Controls.Add(this.buttonMFF08); this.groupBox4.Controls.Add(this.buttonDiffTool); this.groupBox4.Controls.Add(this.buttonHexTool); this.groupBox4.Location = new System.Drawing.Point(2, 75); @@ -521,6 +523,16 @@ private void InitializeComponent() this.groupBox4.TabStop = false; this.groupBox4.Text = "集成辅助工具"; // + // buttonMFF08 + // + this.buttonMFF08.Location = new System.Drawing.Point(90, 16); + this.buttonMFF08.Name = "buttonMFF08"; + this.buttonMFF08.Size = new System.Drawing.Size(117, 25); + this.buttonMFF08.TabIndex = 2; + this.buttonMFF08.Text = "MFF08 CUID修复"; + this.buttonMFF08.UseVisualStyleBackColor = true; + this.buttonMFF08.Click += new System.EventHandler(this.buttonMFF08_Click); + // // tabControl1 // this.tabControl1.Controls.Add(this.tabPage2); @@ -919,7 +931,7 @@ private void InitializeComponent() this.groupBox14.Margin = new System.Windows.Forms.Padding(2); this.groupBox14.Name = "groupBox14"; this.groupBox14.Padding = new System.Windows.Forms.Padding(2); - this.groupBox14.Size = new System.Drawing.Size(142, 142); + this.groupBox14.Size = new System.Drawing.Size(142, 140); this.groupBox14.TabIndex = 15; this.groupBox14.TabStop = false; this.groupBox14.Text = "优化设置"; @@ -1366,6 +1378,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox checkBoxMultiDev; private System.Windows.Forms.ToolStripStatusLabel curDevice; private System.Windows.Forms.CheckBox checkBoxCuidKeyOver; + private System.Windows.Forms.Button buttonMFF08; } } diff --git a/MifareOneTool/Form1.cs b/MifareOneTool/Form1.cs index ddc434d..754f9ca 100644 --- a/MifareOneTool/Form1.cs +++ b/MifareOneTool/Form1.cs @@ -55,6 +55,7 @@ void default_rpt(object sender, ProgressChangedEventArgs e) if (e.ProgressPercentage == 100) { logAppend((string)e.UserState); + logAppend(""); Text = "MifareOne Tool - 运行完毕"; } else if (e.ProgressPercentage == 101) @@ -112,6 +113,7 @@ void default_rpt(object sender, ProgressChangedEventArgs e) } } omfd = ""; + logAppend(""); Text = "MifareOne Tool - 运行完毕"; } else if (e.ProgressPercentage == 102) @@ -119,6 +121,7 @@ void default_rpt(object sender, ProgressChangedEventArgs e) logAppend((string)e.UserState); logAppend("##Nonce收集完毕##"); logAppend("您可以上传到云计算服务节点进行计算。"); + logAppend(""); Text = "MifareOne Tool - 运行完毕"; } @@ -138,13 +141,17 @@ void default_rpt(object sender, ProgressChangedEventArgs e) SetDeviceCombo.Items.AddRange(myReaders.ToArray()); SetDeviceCombo.SelectedIndex = 0; } + else + { + logAppend("没有发现任何有效的NFC设备。"); + logAppend("请检查接线是否正确/驱动是否正常安装/设备电源是否已经打开(对于具有电源开关的型号)。"); + } } else { logAppend((string)e.UserState); } Application.DoEvents(); - } private void logAppend(string msg) @@ -163,7 +170,8 @@ void list_dev(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行检测设备……"); running = true; List myReader = new List(); process.OutputDataReceived += (s, _e) => { @@ -195,9 +203,6 @@ private void Form1_Load(object sender, EventArgs e) { logAppend("#软件版本 " + Assembly.GetExecutingAssembly().GetName().Version.ToString()); localVersionLabel.Text = "本地版本 " + Assembly.GetExecutingAssembly().GetName().Version.ToString(); - //GitHubUpdate ghu = new GitHubUpdate(Properties.Settings.Default.GitHubR); - //ghu.Update(Properties.Settings.Default.GitHubR); - //remoteVersionLabel.Text = "远程版本 " + ghu.remoteVersion; Directory.CreateDirectory("auto_keys"); checkBoxAutoABN.Checked = Properties.Settings.Default.AutoABN; checkBoxWriteProtect.Checked = Properties.Settings.Default.WriteCheck; @@ -250,7 +255,9 @@ void list_tag(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0,"开始执行扫描卡片……"); + running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -370,7 +377,8 @@ void mf_read(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行读取卡片……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -502,7 +510,8 @@ void mf_write(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行写入M1卡片……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -558,7 +567,8 @@ void mfoc(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行MFOC解密……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -612,7 +622,8 @@ void reset_uid(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行重置UID卡片卡号……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -649,7 +660,8 @@ void format_uid(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行UID卡片全格……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -688,7 +700,8 @@ void bmf_read(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行UID卡片读取……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -747,7 +760,8 @@ void bmf_write(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行UID卡片写入……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -803,7 +817,8 @@ void set_uid(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行UID卡片设定卡号……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -834,6 +849,7 @@ void Mfcuk(object sender, DoWorkEventArgs e) lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; process = Process.Start(psi); + b.ReportProgress(0, "开始执行全加密卡片爆破……"); process.WaitForExit(); lprocess = false; running = false; b.ReportProgress(100, "##运行完毕##"); @@ -863,7 +879,7 @@ private void buttonCmfWrite_Click(object sender, EventArgs e) { cuidKeyOver = true; string uid = GetUID(); - S50 empty = new S50(Utils.Hex2Block(uid,4)); + S50 empty = new S50(Utils.Hex2Block(uid, 4)); empty.ExportToMfd("cuid_empty.kmf"); keymfd = "cuid_empty.kmf"; logAppend("已启用CUID空卡写入补丁"); @@ -911,7 +927,8 @@ void cmf_write(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行CUID/FUID卡片写入……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -960,14 +977,15 @@ void lock_ufuid(object sender, DoWorkEventArgs e) RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); byte[] uid = new byte[4]; rng.GetNonZeroBytes(uid); - psi.Arguments = "-l"; + psi.Arguments = "-q -l"; 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 = Process.Start(psi); + b.ReportProgress(0, "开始执行UFUID卡片锁定……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -1018,7 +1036,8 @@ void mf_format(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行格式化M1卡片……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -1179,7 +1198,8 @@ void MfDetect(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行检测卡片加密……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -1274,7 +1294,7 @@ private void buttonDictMfoc_Click(object sender, EventArgs e) return; } string rmfd = "Mfoc.tmp"; - string key = "-f " + filename + " "; + string key = "-f \"" + filename + "\" "; if (checkBoxAutoSave.Checked) { lastuid = GetUID(); @@ -1301,10 +1321,11 @@ void mfocCMD(object sender, DoWorkEventArgs e) psi.Arguments = "/T:0A " + args[2] + @" nfc-bin\mfoc.exe " + args[1] + " -O \"" + args[0] + "\""; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行字典模式MFOC解密……"); running = true; process.WaitForExit(); lprocess = false; running = false; - if (process.ExitCode == 0) + if (process.ExitCode == -1073741510) //Why this { b.ReportProgress(101, "##运行完毕##"); } @@ -1376,7 +1397,8 @@ void Hardnest(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行HardNested解密强化卡……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -1405,7 +1427,8 @@ void CollectNonce(object sender, DoWorkEventArgs e) psi.RedirectStandardError = true; lprocess = true; BackgroundWorker b = (BackgroundWorker)sender; - process = Process.Start(psi); running = true; + process = Process.Start(psi); + b.ReportProgress(0, "开始执行HardNested收集数据……"); running = true; process.OutputDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); process.ErrorDataReceived += (s, _e) => b.ReportProgress(0, _e.Data); //StreamReader stderr = process.StandardError; @@ -1495,5 +1518,11 @@ private void checkBoxCuidKeyOver_CheckedChanged(object sender, EventArgs e) { Properties.Settings.Default.CuidKeyOver = checkBoxCuidKeyOver.Checked; } + + private void buttonMFF08_Click(object sender, EventArgs e) + { + FormMFF08 mff08 = new FormMFF08(); + mff08.ShowDialog(); + } } } diff --git a/MifareOneTool/Form1.resx b/MifareOneTool/Form1.resx index 85a464d..245e50e 100644 --- a/MifareOneTool/Form1.resx +++ b/MifareOneTool/Form1.resx @@ -120,6 +120,9 @@ 17, 17 + + 17, 17 + 157, 17 diff --git a/MifareOneTool/FormMFF08.Designer.cs b/MifareOneTool/FormMFF08.Designer.cs new file mode 100644 index 0000000..0a1dd56 --- /dev/null +++ b/MifareOneTool/FormMFF08.Designer.cs @@ -0,0 +1,202 @@ +namespace MifareOneTool +{ + partial class FormMFF08 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMFF08)); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.buttonClr = new System.Windows.Forms.Button(); + this.buttonLoadKey = new System.Windows.Forms.Button(); + this.keyfileBox = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.buttonKeyWrite = new System.Windows.Forms.Button(); + this.buttonWriteEmpty = new System.Windows.Forms.Button(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.logBox = new System.Windows.Forms.RichTextBox(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(635, 100); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "说明"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 9.5F); + this.label1.ForeColor = System.Drawing.Color.Blue; + this.label1.Location = new System.Drawing.Point(6, 17); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(584, 39); + this.label1.TabIndex = 0; + this.label1.Text = "本工具由nfc-mfclassic做少许修改而来。可用于1K大小CUID卡0块损坏的修复。\r\n本工具可以修复:SAK写错(不认卡类型)、ATQA写错(不认卡大小)" + + ",对于BCC写错暂时无能为力。\r\n请准备好你最后一次写入该卡导致0块损坏的卡数据文件(如果卡片有加密)。"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.buttonClr); + this.groupBox2.Controls.Add(this.buttonLoadKey); + this.groupBox2.Controls.Add(this.keyfileBox); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Controls.Add(this.buttonKeyWrite); + this.groupBox2.Controls.Add(this.buttonWriteEmpty); + this.groupBox2.Location = new System.Drawing.Point(12, 118); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(635, 100); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "操作"; + // + // buttonClr + // + this.buttonClr.Location = new System.Drawing.Point(585, 33); + this.buttonClr.Name = "buttonClr"; + this.buttonClr.Size = new System.Drawing.Size(44, 23); + this.buttonClr.TabIndex = 4; + this.buttonClr.Text = "清除"; + this.buttonClr.UseVisualStyleBackColor = true; + this.buttonClr.Click += new System.EventHandler(this.buttonClr_Click); + // + // buttonLoadKey + // + this.buttonLoadKey.Location = new System.Drawing.Point(504, 33); + this.buttonLoadKey.Name = "buttonLoadKey"; + this.buttonLoadKey.Size = new System.Drawing.Size(75, 23); + this.buttonLoadKey.TabIndex = 1; + this.buttonLoadKey.Text = "加载…"; + this.buttonLoadKey.UseVisualStyleBackColor = true; + this.buttonLoadKey.Click += new System.EventHandler(this.buttonLoadKey_Click); + // + // keyfileBox + // + this.keyfileBox.Location = new System.Drawing.Point(237, 35); + this.keyfileBox.Name = "keyfileBox"; + this.keyfileBox.Size = new System.Drawing.Size(261, 21); + this.keyfileBox.TabIndex = 3; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(235, 20); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(227, 12); + this.label2.TabIndex = 2; + this.label2.Text = "最后一次写卡导致0块损坏的卡数据文件:"; + // + // buttonKeyWrite + // + this.buttonKeyWrite.Font = new System.Drawing.Font("宋体", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.buttonKeyWrite.Location = new System.Drawing.Point(121, 20); + this.buttonKeyWrite.Name = "buttonKeyWrite"; + this.buttonKeyWrite.Size = new System.Drawing.Size(83, 74); + this.buttonKeyWrite.TabIndex = 1; + this.buttonKeyWrite.Text = "修复写入\r\n有密码\r\nCUID卡"; + this.buttonKeyWrite.UseVisualStyleBackColor = true; + this.buttonKeyWrite.Click += new System.EventHandler(this.buttonKeyWrite_Click); + // + // buttonWriteEmpty + // + this.buttonWriteEmpty.Font = new System.Drawing.Font("宋体", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.buttonWriteEmpty.Location = new System.Drawing.Point(8, 20); + this.buttonWriteEmpty.Name = "buttonWriteEmpty"; + this.buttonWriteEmpty.Size = new System.Drawing.Size(83, 74); + this.buttonWriteEmpty.TabIndex = 0; + this.buttonWriteEmpty.Text = "修复写入\r\n无密空白\r\nCUID卡"; + this.buttonWriteEmpty.UseVisualStyleBackColor = true; + this.buttonWriteEmpty.Click += new System.EventHandler(this.buttonWriteEmpty_Click); + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.logBox); + this.groupBox3.Location = new System.Drawing.Point(12, 224); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(635, 188); + this.groupBox3.TabIndex = 0; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "日志"; + // + // logBox + // + this.logBox.BackColor = System.Drawing.Color.Black; + this.logBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.logBox.ForeColor = System.Drawing.Color.Gold; + this.logBox.Location = new System.Drawing.Point(3, 17); + this.logBox.Name = "logBox"; + this.logBox.ReadOnly = true; + this.logBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedVertical; + this.logBox.Size = new System.Drawing.Size(629, 168); + this.logBox.TabIndex = 0; + this.logBox.Text = resources.GetString("logBox.Text"); + // + // FormMFF08 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(659, 424); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.Name = "FormMFF08"; + this.Text = "MFF08 Tool-CUID修复工具"; + this.Load += new System.EventHandler(this.FormMFF08_Load); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Button buttonLoadKey; + private System.Windows.Forms.TextBox keyfileBox; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button buttonKeyWrite; + private System.Windows.Forms.Button buttonWriteEmpty; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.RichTextBox logBox; + private System.Windows.Forms.Button buttonClr; + } +} \ No newline at end of file diff --git a/MifareOneTool/FormMFF08.cs b/MifareOneTool/FormMFF08.cs new file mode 100644 index 0000000..719e5a5 --- /dev/null +++ b/MifareOneTool/FormMFF08.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Diagnostics; +using System.IO; + +namespace MifareOneTool +{ + public partial class FormMFF08 : Form + { + public FormMFF08() + { + InitializeComponent(); + } + + private void buttonLoadKey_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog(); + ofd.CheckFileExists = true; + ofd.Filter = "MFD文件|*.mfd|DUMP文件|*.dump"; + ofd.Title = "请选择最后一次写卡导致0块损坏的卡数据文件"; + ofd.Multiselect = false; + if (ofd.ShowDialog() == DialogResult.OK) + { + keyfileBox.Text = ofd.FileName; + } + } + + private void buttonClr_Click(object sender, EventArgs e) + { + keyfileBox.Text = ""; + } + + bool lprocess = false; + Process process; + + private void logAppend(string msg) + { + logBox.AppendText(msg + "\n"); + logBox.ScrollToCaret(); + } + + void default_rpt(object sender, ProgressChangedEventArgs e) + { + if (e.ProgressPercentage == 100) + { + logAppend((string)e.UserState); + groupBox2.Enabled = true; + } + else if (e.ProgressPercentage == 1) + { + groupBox2.Enabled = false; + } + else + { + logAppend((string)e.UserState); + } + Application.DoEvents(); + + } + + private void buttonWriteEmpty_Click(object sender, EventArgs e) + { + if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } + S50 empty = new S50(); + empty.ExportToMfd("mff08_empty.kmf"); + BackgroundWorker bgw = new BackgroundWorker(); + bgw.DoWork += new DoWorkEventHandler(cmf_write); + bgw.WorkerReportsProgress = true; + bgw.ProgressChanged += new ProgressChangedEventHandler(default_rpt); + bgw.RunWorkerAsync(new string[] { "mff08_empty.kmf", "A", "x", "" }); + } + + void cmf_write(object sender, DoWorkEventArgs e) + { + if (lprocess) { return; } + ProcessStartInfo psi = new ProcessStartInfo("nfc-bin/mff08.exe"); + string[] args = (string[])e.Argument; + psi.Arguments = "c " + args[1] + " u \"" + args[0] + "\""; + if (args[3] != "" && args[2] == "") + { + psi.Arguments += " \"" + args[3] + "\" f"; + } + psi.CreateNoWindow = true; + psi.UseShellExecute = false; + psi.RedirectStandardOutput = true; + psi.RedirectStandardError = true; + lprocess = true; + BackgroundWorker b = (BackgroundWorker)sender; + b.ReportProgress(1); + process = Process.Start(psi); + 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; + b.ReportProgress(100, "##运行完毕##"); + } + + private void buttonKeyWrite_Click(object sender, EventArgs e) + { + if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } + S50 empty = new S50(); + empty.ExportToMfd("mff08_empty.kmf"); + if (keyfileBox.Text == "") + { + MessageBox.Show("您没有给定最后一次写卡导致0块损坏的卡数据文件来作为写卡时的密钥源。\n操作终止。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + BackgroundWorker bgw = new BackgroundWorker(); + bgw.DoWork += new DoWorkEventHandler(cmf_write); + bgw.WorkerReportsProgress = true; + bgw.ProgressChanged += new ProgressChangedEventHandler(default_rpt); + bgw.RunWorkerAsync(new string[] { "mff08_empty.kmf", "C", "", keyfileBox.Text }); + } + + private void FormMFF08_Load(object sender, EventArgs e) + { + if (!File.Exists("nfc-bin/mff08.exe")) + { + MessageBox.Show("无法找到MFF08程序文件。\n操作终止。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/MifareOneTool/FormMFF08.resx b/MifareOneTool/FormMFF08.resx new file mode 100644 index 0000000..8901482 --- /dev/null +++ b/MifareOneTool/FormMFF08.resx @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 每个人使用CUID卡的时候,总会因不了解或是不经意犯下一些小错误。 +比如使用编辑器修改UID却没有改BCC,SAK=28的卡片解密后的文件直接写入,又或是从S70卡片导入数据写入1K卡却没有更正ATQA。 +MFF08工具给了你一次修复这些损坏卡片的机会。 +------------------------------------------------------------------------ + + + + \ No newline at end of file diff --git a/MifareOneTool/MifareOneTool.csproj b/MifareOneTool/MifareOneTool.csproj index 84374fc..36f5387 100644 --- a/MifareOneTool/MifareOneTool.csproj +++ b/MifareOneTool/MifareOneTool.csproj @@ -95,6 +95,12 @@ FormHTool.cs + + Form + + + FormMFF08.cs + @@ -110,6 +116,9 @@ FormHTool.cs + + FormMFF08.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/MifareOneTool/Properties/AssemblyInfo.cs b/MifareOneTool/Properties/AssemblyInfo.cs index 5a111ea..63b73db 100644 --- a/MifareOneTool/Properties/AssemblyInfo.cs +++ b/MifareOneTool/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.6.7.0")] -[assembly: AssemblyFileVersion("1.6.7.0")] +[assembly: AssemblyVersion("1.7.0.0")] +[assembly: AssemblyFileVersion("1.7.0.0")]