Skip to content

Commit

Permalink
fix *n
Browse files Browse the repository at this point in the history
修复字典测试后无法保存问题
修复字典测试字典路径有空格出错问题
加入MFF08工具
添加多处提示
  • Loading branch information
XAS-712 committed May 1, 2019
1 parent 5b6f819 commit 8399920
Show file tree
Hide file tree
Showing 8 changed files with 545 additions and 29 deletions.
17 changes: 15 additions & 2 deletions MifareOneTool/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 54 additions & 25 deletions MifareOneTool/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -112,13 +113,15 @@ void default_rpt(object sender, ProgressChangedEventArgs e)
}
}
omfd = "";
logAppend("");
Text = "MifareOne Tool - 运行完毕";
}
else if (e.ProgressPercentage == 102)
{
logAppend((string)e.UserState);
logAppend("##Nonce收集完毕##");
logAppend("您可以上传到云计算服务节点进行计算。");
logAppend("");

Text = "MifareOne Tool - 运行完毕";
}
Expand All @@ -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)
Expand All @@ -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<string> myReader = new List<string>();
process.OutputDataReceived += (s, _e) =>
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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, "##运行完毕##");
Expand Down Expand Up @@ -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空卡写入补丁");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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, "##运行完毕##");
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
}
3 changes: 3 additions & 0 deletions MifareOneTool/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<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="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">
<value>157, 17</value>
</metadata>
Expand Down
Loading

0 comments on commit 8399920

Please sign in to comment.