├── .DS_Store
├── NFCGUI-Ganso
├── Unit1.cpp
├── Project1.res
├── Project1_Icon8.ico
├── README.md
├── Project1.cbproj.local
├── Project1.cpp
├── Unit1.h
├── Unit1.dfm
└── Project1.cbproj
├── NFCGUI-Pangu
├── NFCGUI
│ ├── app.config
│ ├── ico256.ico
│ ├── Resources
│ │ ├── mfoc.exe
│ │ ├── nfc.dll
│ │ ├── libnfc.dll
│ │ ├── libusb0.dll
│ │ ├── nfc-list.exe
│ │ ├── nfc-poll.exe
│ │ ├── nfc-probe.exe
│ │ ├── nfc-relay.exe
│ │ ├── nfc-anticol.exe
│ │ ├── nfc-mfsetuid.exe
│ │ ├── nfc-dep-target.exe
│ │ ├── nfc-mfclassic.exe
│ │ ├── nfc-relay-picc.exe
│ │ ├── nfc-dep-initiator.exe
│ │ ├── nfc-emulate-tag.exe
│ │ ├── nfc-emulate-uid.exe
│ │ ├── nfc-mfultralight.exe
│ │ ├── nfc-read-forum-tag3.exe
│ │ ├── nfc-emulate-forum-tag2.exe
│ │ └── nfc-emulate-forum-tag4.exe
│ ├── obj
│ │ ├── Debug
│ │ │ ├── NFCGUI-Pro.exe
│ │ │ ├── NFCGUI-Pro.pdb
│ │ │ ├── NFCGui(GPCPC的冲突版本).exe
│ │ │ ├── NFCGui(GPCPC的冲突版本).pdb
│ │ │ ├── NFCGui.FrmMain.resources
│ │ │ ├── NFCGui.FrmKeyManage.resources
│ │ │ ├── NFCGui.Properties.Resources.resources
│ │ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ │ ├── NFCGUIPro.csproj.GenerateResource.Cache
│ │ │ ├── TempPE
│ │ │ │ └── Properties.Resources.Designer.cs.dll
│ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ ├── NFCGUIPro.csprojResolveAssemblyReference.cache
│ │ │ ├── NFCGUIPro.csproj.GenerateResource(GPCPC的冲突版本).Cache
│ │ │ ├── NFCGUIPro.csproj.FileListAbsolute(GPCPC的冲突版本).txt
│ │ │ └── NFCGUIPro.csproj.FileListAbsolute.txt
│ │ └── Release
│ │ │ ├── NFCGUI-Pro.exe
│ │ │ ├── NFCGUI-Pro.pdb
│ │ │ ├── NFCGui.FrmMain.resources
│ │ │ ├── NFCGui.FrmKeyManage.resources
│ │ │ ├── NFCGUIPro.csproj.GenerateResource.Cache
│ │ │ ├── NFCGui.Properties.Resources.resources
│ │ │ ├── TempPE
│ │ │ └── Properties.Resources.Designer.cs.dll
│ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ └── NFCGUIPro.csproj.FileListAbsolute.txt
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── AssemblyInfo.cs
│ │ ├── Settings.Designer.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── Common
│ │ ├── NfcWorker.cs
│ │ ├── MfocWorker.cs
│ │ ├── LogManage.cs
│ │ ├── AccessCondition.cs
│ │ ├── Common.cs
│ │ └── ExcelIO.cs
│ ├── Program.cs
│ ├── NFCGUIPro.csproj
│ ├── FrmKeyManage.cs
│ ├── FrmKeyManage.Designer.cs
│ └── FrmMain.cs
├── README.md
└── NFCGUI.sln
├── .gitignore
└── README.md
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/.DS_Store
--------------------------------------------------------------------------------
/NFCGUI-Ganso/Unit1.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Ganso/Unit1.cpp
--------------------------------------------------------------------------------
/NFCGUI-Ganso/Project1.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Ganso/Project1.res
--------------------------------------------------------------------------------
/NFCGUI-Ganso/Project1_Icon8.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Ganso/Project1_Icon8.ico
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/ico256.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/ico256.ico
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/mfoc.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/mfoc.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc.dll
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/libnfc.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/libnfc.dll
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/libusb0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/libusb0.dll
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-list.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-list.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-poll.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-poll.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-probe.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-probe.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-relay.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-relay.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-anticol.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-anticol.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-mfsetuid.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-mfsetuid.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUI-Pro.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUI-Pro.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUI-Pro.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUI-Pro.pdb
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGUI-Pro.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGUI-Pro.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGUI-Pro.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGUI-Pro.pdb
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-dep-target.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-dep-target.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-mfclassic.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-mfclassic.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-relay-picc.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-relay-picc.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-dep-initiator.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-dep-initiator.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-emulate-tag.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-emulate-tag.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-emulate-uid.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-emulate-uid.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-mfultralight.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-mfultralight.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-read-forum-tag3.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-read-forum-tag3.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGui(GPCPC的冲突版本).exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGui(GPCPC的冲突版本).exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGui(GPCPC的冲突版本).pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGui(GPCPC的冲突版本).pdb
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-emulate-forum-tag2.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-emulate-forum-tag2.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Resources/nfc-emulate-forum-tag4.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/Resources/nfc-emulate-forum-tag4.exe
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGui.FrmMain.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGui.FrmMain.resources
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGui.FrmMain.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGui.FrmMain.resources
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGui.FrmKeyManage.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGui.FrmKeyManage.resources
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGui.FrmKeyManage.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGui.FrmKeyManage.resources
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGui.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGui.Properties.Resources.resources
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUIPro.csproj.GenerateResource.Cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUIPro.csproj.GenerateResource.Cache
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGUIPro.csproj.GenerateResource.Cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGUIPro.csproj.GenerateResource.Cache
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGui.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGui.Properties.Resources.resources
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 |
6 | # Compiled Dynamic libraries
7 | *.so
8 | *.dylib
9 |
10 | # Compiled Static libraries
11 | *.lai
12 | *.la
13 | *.a
14 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUIPro.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUIPro.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Release/TempPE/Properties.Resources.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Release/TempPE/Properties.Resources.Designer.cs.dll
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUIPro.csproj.GenerateResource(GPCPC的冲突版本).Cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RadioWar/NFCGUI/HEAD/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUIPro.csproj.GenerateResource(GPCPC的冲突版本).Cache
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/NFCGUI-Ganso/README.md:
--------------------------------------------------------------------------------
1 | # NFCGUI-Ganso
2 | - NFCGUI 0.1~0.5版本
3 |
4 | 从0.1至0.5版本,NFCGUI采用BC++编写,直接调用libnfc套件,修复多个程序缺陷并公开源码。
5 |
6 | #NFCGUI更新日志
7 | * V0.1~0.5版本
8 |
9 | - 增加自动Fixdump功能,对于mfocGUI生成的dumpfile文件进行优化,修补了其1K大小的问题。
10 | - 修复DUMP文件以及KEY文件路径以及名称存在空格后,程序提示无法找到nfc-mfclassic.exe的问题。
11 | - 修复一些人为错误
12 |
13 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/README.md:
--------------------------------------------------------------------------------
1 | #Pangu版本介绍
2 | - NFCGUI 1.0版本
3 |
4 | 从1.0版本开始,NFCGUI自身整合libnfc所调用的所有程序,当执行或关闭NFCGUI之后相应的调用程序就会自动释放或删除,故此有可能会引起部分杀毒软件的报警。
5 |
6 | - NFCGUI 1.5版本
7 |
8 | 该版本是最后一个单独的基于ACR122U的功能版本,并且整合了mfoc破解功能,原有2.0即先有1.5版本!
9 |
10 | #Pangu更新历史
11 |
12 | - V1.0版本
13 |
14 |
15 | 1. 重写NFCGUI相关代码
16 | 2. 增加简体中文、繁体中文、英文语言选择
17 | 3. 增加DumpFile显示功能模块
18 | 4. 增加对于DumpFile的效验位显示
19 | 5. 修复相关程序错误
20 |
21 |
22 | - V1.5版本(最后一个纯NFCGUI版本)
23 |
24 |
25 | 1. 增加mfoc破解功能
26 | 2. 增加密钥导入导出功能
27 | 3. 增加基于MIFARE CLASSIC系列的控制位功能
28 |
29 |
30 | - V2.0版本(未来版本!NFCGUI将会与Proxmark3GUI整合)
31 |
32 |
33 | 1. 删除mfoc破解功能权限
34 | 2. 增加对于卡的实时读取、写入操作功能
35 | 3. 增加对于卡的还原数据、还原Key为12个F
36 | 4. 默认语言设置为“简体中文”
37 | 5. 增加对于Dump文件的编辑功能
38 | 6. 将“Key文件”选项归纳为实时读取、写入操作功能部分
39 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Release/NFCGUIPro.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Release\NFCGUI-Pro.exe.config
2 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Release\NFCGUI-Pro.exe
3 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Release\NFCGUI-Pro.pdb
4 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Release\NFCGui.FrmKeyManage.resources
5 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Release\NFCGui.FrmMain.resources
6 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Release\NFCGui.Properties.Resources.resources
7 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Release\NFCGUIPro.csproj.GenerateResource.Cache
8 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Release\NFCGUI-Pro.exe
9 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Release\NFCGUI-Pro.pdb
10 |
--------------------------------------------------------------------------------
/NFCGUI-Ganso/Project1.cbproj.local:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1899-12-30 00:00:00.000.390,E:\Demos\libnfcgui\Unit1.h=d:\我的文档\RAD Studio\Projects\Unit1.h
5 | 1899-12-30 00:00:00.000.046,=d:\我的文档\RAD Studio\Projects\Unit1.cpp
6 | 1899-12-30 00:00:00.000.390,E:\Demos\libnfcgui\Unit1.cpp=d:\我的文档\RAD Studio\Projects\Unit1.cpp
7 | 1899-12-30 00:00:00.000.437,E:\Demos\libnfcgui\Project1.cbproj=d:\我的文档\RAD Studio\Projects\Project1.cbproj
8 | 1899-12-30 00:00:00.000.390,E:\Demos\libnfcgui\Unit1.dfm=d:\我的文档\RAD Studio\Projects\Unit1.dfm
9 |
10 |
11 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUIPro.csproj.FileListAbsolute(GPCPC的冲突版本).txt:
--------------------------------------------------------------------------------
1 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Debug\NFCGui.exe.config
2 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Debug\NFCGui.exe.config
3 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Debug\NFCGui.exe
4 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Debug\NFCGui.pdb
5 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.FrmKeyManage.resources
6 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.FrmMain.resources
7 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.Properties.Resources.resources
8 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGUIPro.csproj.GenerateResource.Cache
9 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.exe
10 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.pdb
11 |
--------------------------------------------------------------------------------
/NFCGUI-Ganso/Project1.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------------
2 |
3 | #include
4 | #pragma hdrstop
5 | #include
6 | //---------------------------------------------------------------------------
7 |
8 |
9 |
10 |
11 | USEFORM("Unit1.cpp", Form1);
12 | //---------------------------------------------------------------------------
13 | WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
14 | {
15 | try
16 | {
17 | Application->Initialize();
18 | Application->MainFormOnTaskBar = true;
19 | Application->CreateForm(__classid(TForm1), &Form1);
20 | Application->Run();
21 | }
22 | catch (Exception &exception)
23 | {
24 | Application->ShowException(&exception);
25 | }
26 | catch (...)
27 | {
28 | try
29 | {
30 | throw Exception("");
31 | }
32 | catch (Exception &exception)
33 | {
34 | Application->ShowException(&exception);
35 | }
36 | }
37 | return 0;
38 | }
39 | //---------------------------------------------------------------------------
40 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("NFCGUI")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("RadioWar")]
12 | [assembly: AssemblyProduct("NFCGUI")]
13 | [assembly: AssemblyCopyright("Copyright © RadioWar:SLODT 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 | // 将 ComVisible 设置为 false 使此程序集中的类型
17 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
18 | // 则将该类型上的 ComVisible 特性设置为 true。
19 | [assembly: ComVisible(false)]
20 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
21 | [assembly: Guid("e3318158-0b25-435e-a848-9f8d5214caf9")]
22 | // 程序集的版本信息由下面四个值组成:
23 | //
24 | // 主版本
25 | // 次版本
26 | // 生成号
27 | // 修订号
28 | //
29 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
30 | // 方法是按如下所示使用“*”:
31 | // [assembly: AssemblyVersion("1.0.*")]
32 | [assembly: AssemblyVersion("1.0.0.0")]
33 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #为什么开源?
2 |
3 | RadioWar“创立”至今已经很多年了,正如我们“团队”成员所说:“这只是一个兴趣小组,没啥的!”,所以我们虎头蛇尾的搞了一大堆“领先”国内外的“东西”出来,却没有心思和时间维护,故此我们就把手上的项目都公开,希望国内真正有心思、有时间的朋友一起维护起来!
4 |
5 | 我们把东西开源了!又有真正人来维护?最起码淘宝商家开心了!又有东西可以拿去骗钱了!
6 |
7 | #什么是 NFCGUI ?
8 | 一款图形化NFC协议安全分析工具,主要针对Mifare卡,基于libnfc完成。
9 |
10 | #NFCGUI版本划分
11 | - Ganso为原始版本,功能最少,因为只是完成当时的想法而设计的。
12 | - Pangu为功能加强,带有破解等功能,但不稳定。
13 |
14 | 公开版本只针对了nfc-list/nfc-mfclassic/nfc-mfsetuid三个程序的操作简化,接下来我们会尽量做到支持整个Libnfc开发套件。
15 | 因libnfc作为开源套件所以并不支持ACR122U为207或以上固件版本,从香港团购代购回来的ACR122U固件版本为103确认支持!
16 |
17 | #NFCGUI更新日志
18 |
19 | V0.1~0.5版本
20 |
21 | 1. 增加自动Fixdump功能,对于mfocGUI生成的dumpfile文件进行优化,修补了其1K大小的问题。
22 | 2. 修复DUMP文件以及KEY文件路径以及名称存在空格后,程序提示无法找到nfc-mfclassic.exe的问题。
23 | 3. 修复一些人为错误
24 |
25 | V1.0版本
26 |
27 | 1. 重写NFCGUI相关代码
28 | 2. 增加简体中文、繁体中文、英文语言选择
29 | 3. 增加DumpFile显示功能模块
30 | 4. 增加对于DumpFile的效验位显示
31 | 5. 修复相关程序错误
32 |
33 | V1.5版本(最后一个纯NFCGUI版本)
34 |
35 | 1. 增加mfoc破解功能
36 | 2. 增加密钥导入导出功能
37 | 3. 增加基于MIFARE CLASSIC系列的控制位功能
38 |
39 | #NFCGUI界面截图:
40 | 
41 |
42 | #NFCGUI使用说明:
43 |
44 | NFCGUI必须与编译好的libnfc放在相同目录下,否者无法执行相关命令,按照Libnfc的设备支持列表,NFCGUI支持所有基于PN532芯片解决方案,所以在香港代购回来的ACR122U使用毫无问题!
45 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.17929
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace NFCGui.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/obj/Debug/NFCGUIPro.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGUIPro.csprojResolveAssemblyReference.cache
2 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.FrmKeyManage.resources
3 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.FrmMain.resources
4 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.Properties.Resources.resources
5 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGUIPro.csproj.GenerateResource.Cache
6 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.FrmKeyManage.resources
7 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.FrmMain.resources
8 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGui.Properties.Resources.resources
9 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGUIPro.csproj.GenerateResource.Cache
10 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Debug\NFCGUI-Pro.exe.config
11 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Debug\NFCGUI-Pro.exe
12 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Debug\NFCGUI-Pro.pdb
13 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGUI-Pro.exe
14 | I:\微云网盘\网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGUI-Pro.pdb
15 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Debug\NFCGUI-Pro.exe.config
16 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGUI-Pro.exe
17 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\obj\Debug\NFCGUI-Pro.pdb
18 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Debug\NFCGUI-Pro.exe
19 | D:\微云网盘\59787\NFCGUIPro\trunk\NFCGui\bin\Debug\NFCGUI-Pro.pdb
20 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NFCGUIPro", "NFCGui\NFCGUIPro.csproj", "{A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}"
5 | EndProject
6 | Global
7 | GlobalSection(SubversionScc) = preSolution
8 | Svn-Managed = True
9 | Manager = AnkhSVN - Subversion Support for Visual Studio
10 | EndGlobalSection
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Debug|Mixed Platforms = Debug|Mixed Platforms
14 | Debug|Win32 = Debug|Win32
15 | Release|Any CPU = Release|Any CPU
16 | Release|Mixed Platforms = Release|Mixed Platforms
17 | Release|Win32 = Release|Win32
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
23 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
24 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}.Debug|Win32.ActiveCfg = Debug|Any CPU
25 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}.Release|Any CPU.Build.0 = Release|Any CPU
27 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
28 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
29 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}.Release|Win32.ActiveCfg = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/NFCGUI-Ganso/Unit1.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------------
2 |
3 | #ifndef Unit1H
4 | #define Unit1H
5 | //---------------------------------------------------------------------------
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | //---------------------------------------------------------------------------
13 | class TForm1 : public TForm
14 | {
15 | __published: // IDE-managed Components
16 | TMemo *Memo1;
17 | TGroupBox *GroupBox1;
18 | TButton *Button1;
19 | TButton *Button2;
20 | TEdit *Edit1;
21 | TEdit *Edit2;
22 | TLabel *Label1;
23 | TLabel *Label2;
24 | TGroupBox *GroupBox2;
25 | TButton *Button3;
26 | TEdit *Edit3;
27 | TEdit *Edit4;
28 | TGroupBox *GroupBox3;
29 | TButton *Button4;
30 | TRadioButton *RadioButton1;
31 | TRadioButton *RadioButton2;
32 | TRadioButton *RadioButton3;
33 | TRadioButton *RadioButton4;
34 | TGroupBox *GroupBox4;
35 | TLabel *Label3;
36 | TLabel *Label4;
37 | TButton *Button5;
38 | TButton *Button6;
39 | TEdit *Edit5;
40 | TEdit *Edit6;
41 | TButton *Button7;
42 | TRadioButton *RadioButton5;
43 | TRadioButton *RadioButton6;
44 | TOpenDialog *OpenDialog1;
45 | TLabel *Label5;
46 | TLabel *Label6;
47 | TPanel *Panel1;
48 | AnsiString __fastcall PipeCall(AnsiString szAppName, AnsiString szCmdLine) ;
49 | void __fastcall Button1Click(TObject *Sender);
50 | void __fastcall Button7Click(TObject *Sender);
51 | void __fastcall Button5Click(TObject *Sender);
52 | void __fastcall Button6Click(TObject *Sender);
53 | void __fastcall Button2Click(TObject *Sender);
54 | void __fastcall Button3Click(TObject *Sender);
55 | void __fastcall Edit2KeyPress(TObject *Sender, System::WideChar &Key);
56 | void __fastcall Button4Click(TObject *Sender);
57 | private: // User declarations
58 | public: // User declarations
59 | __fastcall TForm1(TComponent* Owner);
60 | };
61 | //---------------------------------------------------------------------------
62 | extern PACKAGE TForm1 *Form1;
63 | //---------------------------------------------------------------------------
64 | #endif
65 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Common/NfcWorker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.CompilerServices;
6 | using System.Windows.Forms;
7 | using System.Diagnostics;
8 |
9 | namespace NFCGui.Common
10 | {
11 | //enum NFCRun
12 | //{
13 | // nfc-anticol,nfc-dep-initiator,nfc-dep-target
14 | //}
15 | class NfcWorker
16 | {
17 | public static String NfcCall(string nfcrun, string Args)
18 | {
19 | Common.CreateNFCFiles();
20 | Process process=new Process
21 | {
22 | StartInfo={
23 | CreateNoWindow=true,
24 | UseShellExecute=false,
25 | RedirectStandardOutput=true,
26 | FileName=System.IO.Path.GetTempPath() + @"\\" + nfcrun,
27 | Arguments=Args
28 | }
29 | };
30 | process.Start();
31 | string output="";
32 | while (!process.HasExited)
33 | {
34 | output=process.StandardOutput.ReadToEnd();
35 | }
36 | process.WaitForExit();
37 | Log.WriteLog(output);
38 | // process.Close();
39 | return output;
40 | }
41 |
42 | public static bool checkDevice()
43 | {
44 | string str="";
45 | if (!str.Contains("No device found"))
46 | {
47 | Process process=new Process
48 | {
49 | StartInfo={
50 | UseShellExecute=false,
51 | RedirectStandardOutput=true,
52 | CreateNoWindow=true,
53 | FileName=Application.StartupPath + @"\nfc-list.exe"
54 | }
55 | };
56 | process.Start();
57 | // process.Start();
58 | string str2="";
59 | while (!process.HasExited)
60 | {
61 | str2=process.StandardOutput.ReadToEnd();
62 | }
63 | process.WaitForExit();
64 | Log.WriteLog(str2);
65 | }
66 | return false;
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Common/MfocWorker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Diagnostics;
6 | using System.Windows.Forms;
7 |
8 | namespace NFCGui.Common
9 | {
10 | class MfocWorker
11 | {
12 | public static void mfoc(FrmMain gui, int probes, int distance, string dumpName, string keys)
13 | {
14 | keys=keys.Length < 12 ? "-k b5ff67cba951 -k 44dd5a385aaf -k 21a600056cb0 -k b1aca33180a5 -k dd61eb6bce22 -k 1565a172770f -k 3e84d2612e2a -k f23442436765 -k 79674f96c771 -k 87df99d496cb -k c5132c8980bc -k a21680c27773 -k f26e21edcee2 -k 675557ecc92e -k f4396e468114 -k 6db17c16b35b -k 4186562a5bb2 -k 2feae851c199 -k db1a3338b2eb -k 157b10d84c6b -k a643f952ea57 -k df37dcb6afb3 -k 4c32baf326e0 -k 91ce16c07ac5 -k 3c5d1c2bcd18 -k c3f19ec592a2 -k f72a29005459 -k 185fa3438949 -k 321a695bd266 -k d327083a60a7 -k 45635ef66ef3 -k 5481986d2d62 -k cba6ae869ad5 -k 645a166b1eeb -k a7abbc77cc9e -k f792c4c76a5c -k bfb6796a11db" : keys;
15 | Common.CreateFiles();
16 | Process process=new Process
17 | {
18 | StartInfo={
19 | WindowStyle=ProcessWindowStyle.Hidden,
20 | CreateNoWindow=true,
21 | UseShellExecute=false,
22 | RedirectStandardOutput=true,
23 | FileName=System.IO.Path.GetTempPath() + @"\\mfoc.exe",
24 | Arguments=string.Concat(new object[]
25 | {
26 | "mfoc -O ",
27 | dumpName,
28 | " -P ",
29 | probes,
30 | " -T ",
31 | distance,
32 | " ",
33 | keys
34 | })
35 | }
36 | };
37 | // process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
38 | // process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
39 | process.Start();
40 | process.StartInfo.WindowStyle=ProcessWindowStyle.Hidden;
41 | string val="";
42 | val=process.StandardOutput.ReadToEnd();
43 | if (val != null)
44 | {
45 | Log.WriteLog(LogFile.RunningTime, val);
46 | gui.updateLogBox(val);
47 | gui.updateLogBox("\n");
48 | }
49 | process.WaitForExit();
50 | TimeSpan span=DateTime.Now.Subtract(process.StartTime);
51 | if (val.Contains("Auth with all sectors succeeded, dumping keys to a file!"))
52 | {
53 | MessageBox.Show(string.Concat(new object[]
54 | {
55 | "完成!\n总耗时:",
56 | span.Hours,
57 | "小时",
58 | span.Minutes,
59 | "分",
60 | span.Seconds,
61 | "秒 \n 日志已记录到文件: ",
62 | dumpName
63 | }));
64 | gui.updateStatus(2);
65 | }
66 | else
67 | {
68 | // gui.updateStatus(0);
69 | MessageBox.Show("操作失败,请重试!");
70 | gui.updateStatus(0);
71 | }
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 | using System.Text;
6 | using System.IO;
7 |
8 | namespace NFCGui
9 | {
10 | static class Program
11 | {
12 | static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
13 | {
14 | string str=GetExceptionMsg(e.Exception, e.ToString());
15 | MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
16 | Common.Log.WriteLog(str);
17 | }
18 |
19 | static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
20 | {
21 | string str=GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
22 | MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
23 | Common.Log.WriteLog(str);
24 | }
25 |
26 | ///
27 | /// 生成自定义异常消息
28 | ///
29 | /// 异常对象
30 | /// 备用异常消息:当ex为null时有效
31 | /// 异常字符串文本
32 | static string GetExceptionMsg(Exception ex, string backStr)
33 | {
34 | StringBuilder sb=new StringBuilder();
35 | sb.AppendLine("\r\n****************************异常文本****************************");
36 | sb.AppendLine("【出现时间】:" + DateTime.Now.ToString());
37 | if (ex != null)
38 | {
39 | sb.AppendLine("【异常类型】:" + ex.GetType().Name);
40 | sb.AppendLine("【异常信息】:" + ex.Message);
41 | sb.AppendLine("【堆栈调用】:" + ex.StackTrace);
42 | }
43 | else
44 | {
45 | sb.AppendLine("【未处理异常】:" + backStr);
46 | }
47 | sb.AppendLine("***************************************************************");
48 | return sb.ToString();
49 | }
50 |
51 | ///
52 | /// 应用程序的主入口点。
53 | ///
54 | [STAThread]
55 | static void Main()
56 | {
57 | try
58 | {
59 | //设置应用程序处理异常方式:ThreadException处理
60 | Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
61 | //处理UI线程异常
62 | Application.ThreadException+=new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
63 | //处理非UI线程异常
64 | AppDomain.CurrentDomain.UnhandledException+=new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
65 |
66 | Common.Common.CreateFiles();
67 |
68 | #region 应用程序的主入口点
69 | Application.EnableVisualStyles();
70 | Application.SetCompatibleTextRenderingDefault(false);
71 | Application.Run(new FrmMain());
72 | // Application.Run(new FrmKeyManage());
73 | #endregion
74 | }
75 | catch (Exception ex)
76 | {
77 | string str=GetExceptionMsg(ex, string.Empty);
78 | MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
79 | Common.Log.WriteLog(str);
80 | }
81 | }
82 | }
83 | //static class Program
84 | //{
85 | // ///
86 | // /// 应用程序的主入口点。
87 | // ///
88 | // [STAThread]
89 | // static void Main()
90 | // {
91 | // Application.EnableVisualStyles();
92 | // Application.SetCompatibleTextRenderingDefault(false);
93 | // Application.Run(new Form1());
94 | // }
95 | //}
96 | }
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/NFCGUIPro.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {A74B7BE3-C623-4B3C-A59B-8A7542F6D44E}
8 | WinExe
9 | Properties
10 | NFCGui
11 | NFCGUI-Pro
12 | v4.0
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | ico256.ico
36 |
37 |
38 |
39 | True
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | Form
61 |
62 |
63 | FrmKeyManage.cs
64 |
65 |
66 | Form
67 |
68 |
69 | FrmMain.cs
70 |
71 |
72 |
73 |
74 | FrmKeyManage.cs
75 |
76 |
77 | FrmMain.cs
78 |
79 |
80 | ResXFileCodeGenerator
81 | Resources.Designer.cs
82 | Designer
83 |
84 |
85 | True
86 | Resources.resx
87 | True
88 |
89 |
90 |
91 | SettingsSingleFileGenerator
92 | Settings.Designer.cs
93 |
94 |
95 | True
96 | Settings.settings
97 | True
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
169 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Common/LogManage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.IO;
6 |
7 | namespace NFCGui.Common
8 | {
9 | public static class Log
10 | {
11 | private static LogManager logManager;
12 | static Log()
13 | {
14 | logManager=new LogManager();
15 | }
16 |
17 | public static void WriteLog(LogFile logFile, string msg)
18 | {
19 | logManager.WriteLog(logFile, msg);
20 | }
21 |
22 | public static void WriteLog(string logFile, string msg)
23 | {
24 | logManager.WriteLog(logFile, msg);
25 | }
26 |
27 | public static void WriteLog(string msg)
28 | {
29 | logManager.WriteLog(msg);
30 | }
31 | }
32 |
33 | public class LogManager
34 | {
35 | private string logFileName=string.Empty;
36 | private string logPath="Log";
37 | private string logFileExtName="log";
38 | private bool writeLogTime=true;
39 | private bool logFileNameEndWithDate=true;
40 | private Encoding logFileEncoding=Encoding.UTF8;
41 | private object obj=new object();
42 | #region 构造函数
43 | public LogManager()
44 | {
45 | this.LogPath="Log";
46 | this.LogFileExtName="log";
47 | this.WriteLogTime=true;
48 | this.logFileNameEndWithDate=true;
49 | this.logFileEncoding=Encoding.UTF8;
50 | }
51 |
52 | public LogManager(string logPath, string logFileExtName, bool writeLogTime)
53 | {
54 | this.LogPath=logPath;
55 | this.LogFileExtName=logFileExtName;
56 | this.WriteLogTime=writeLogTime;
57 | this.logFileNameEndWithDate=true;
58 | this.logFileEncoding=Encoding.UTF8;
59 | }
60 |
61 | #endregion
62 | #region 属性
63 | ///
64 | /// Log 文件路径
65 | ///
66 | public string LogPath
67 | {
68 | get
69 | {
70 | if (this.logPath == null || this.logPath == string.Empty)
71 | {
72 | //Application.StartupPath
73 | this.logPath=AppDomain.CurrentDomain.BaseDirectory;
74 | }
75 | return this.logPath;
76 | }
77 | set
78 | {
79 | this.logPath=value;
80 | if (this.logPath == null || this.logPath == string.Empty)
81 | {
82 | //Application.StartupPath
83 | this.logPath=AppDomain.CurrentDomain.BaseDirectory;
84 | }
85 | else
86 | {
87 | try
88 | {
89 | // 判断是否不是绝对路径(绝对路径里还有":")
90 | if (this.logPath.IndexOf(Path.VolumeSeparatorChar) >= 0)
91 | {
92 | /* 绝对路径 */ }
93 | else
94 | {
95 | // 相对路径
96 | this.logPath=AppDomain.CurrentDomain.BaseDirectory + this.logPath;
97 | }
98 | if (!Directory.Exists(this.logPath))
99 | Directory.CreateDirectory(this.logPath);
100 | }
101 | catch
102 | {
103 | this.logPath=AppDomain.CurrentDomain.BaseDirectory;
104 | }
105 | if (!this.logPath.EndsWith(@"\"))
106 | this.logPath+=@"\";
107 | }
108 | }
109 | }
110 | ///
111 | /// Log 文件扩展名
112 | ///
113 | public string LogFileExtName
114 | {
115 | get
116 | {
117 | return this.logFileExtName;
118 | }
119 | set
120 | {
121 | this.logFileExtName=value;
122 | }
123 | }
124 | ///
125 | /// 是否在每个Log行前面添加当前时间
126 | ///
127 | public bool WriteLogTime
128 | {
129 | get
130 | {
131 | return this.writeLogTime;
132 | }
133 | set
134 | {
135 | this.writeLogTime=value;
136 | }
137 | }
138 | ///
139 | /// 日志文件名是否带日期
140 | ///
141 | public bool LogFileNameEndWithDate
142 | {
143 | get
144 | {
145 | return logFileNameEndWithDate;
146 | }
147 | set
148 | {
149 | logFileNameEndWithDate=value;
150 | }
151 | }
152 | ///
153 | /// 日志文件的字符编码
154 | ///
155 | public Encoding LogFileEncoding
156 | {
157 | get
158 | {
159 | return logFileEncoding;
160 | }
161 | set
162 | {
163 | logFileEncoding=value;
164 | }
165 | }
166 | #endregion
167 | #region 公有方法
168 | public void WriteLog(string logFile, string msg)
169 | {
170 | lock (obj)
171 | {
172 | try
173 | {
174 | string dateString=string.Empty;
175 | if (this.logFileNameEndWithDate || logFile.Length == 0)
176 | {
177 | dateString=DateTime.Now.ToString("yyyyMMdd");
178 | }
179 | logFileName=string.Format("{0}{1}{2}.{3}",
180 | this.LogPath,
181 | logFile,
182 | dateString,
183 | this.logFileExtName);
184 | using (StreamWriter sw=new StreamWriter(logFileName, true, logFileEncoding))
185 | {
186 | if (writeLogTime)
187 | {
188 | sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":\t" + msg);
189 | }
190 | else
191 | {
192 | sw.WriteLine(msg);
193 | }
194 | }
195 | }
196 | catch
197 | {
198 | }
199 | }
200 | }
201 |
202 | public void WriteLog(LogFile logFile, string msg)
203 | {
204 | this.WriteLog(logFile.ToString(), msg);
205 | }
206 |
207 | public void WriteLog(string msg)
208 | {
209 | this.WriteLog(string.Empty, msg);
210 | }
211 | #endregion
212 | }
213 |
214 | public enum LogFile
215 | {
216 | Trace,
217 | Error,
218 | SQL,
219 | SQLError,
220 | RunningTime
221 | }
222 | }
--------------------------------------------------------------------------------
/NFCGUI-Ganso/Unit1.dfm:
--------------------------------------------------------------------------------
1 | object Form1: TForm1
2 | Left = 0
3 | Top = 0
4 | BorderIcons = [biSystemMenu, biMinimize]
5 | Caption = 'NFC GUI FREE 0.3'
6 | ClientHeight = 532
7 | ClientWidth = 641
8 | Color = cl3DLight
9 | Font.Charset = DEFAULT_CHARSET
10 | Font.Color = clWindowText
11 | Font.Height = -11
12 | Font.Name = 'Tahoma'
13 | Font.Style = []
14 | OldCreateOrder = False
15 | PixelsPerInch = 96
16 | TextHeight = 13
17 | object Memo1: TMemo
18 | Left = 8
19 | Top = 318
20 | Width = 610
21 | Height = 194
22 | Color = cl3DLight
23 | Lines.Strings = (
24 | 'NFC GUI FREE 03')
25 | ReadOnly = True
26 | ScrollBars = ssVertical
27 | TabOrder = 0
28 | end
29 | object GroupBox1: TGroupBox
30 | Left = 15
31 | Top = 16
32 | Width = 217
33 | Height = 145
34 | Caption = #22522#26412#21151#33021
35 | TabOrder = 1
36 | object Label1: TLabel
37 | Left = 24
38 | Top = 66
39 | Width = 42
40 | Height = 13
41 | Caption = #21407'UID'#65306
42 | end
43 | object Label2: TLabel
44 | Left = 24
45 | Top = 111
46 | Width = 42
47 | Height = 13
48 | Caption = #26032'UID'#65306
49 | end
50 | object Button1: TButton
51 | Left = 24
52 | Top = 21
53 | Width = 75
54 | Height = 25
55 | Caption = #35835#22522#26412#20449#24687
56 | TabOrder = 0
57 | OnClick = Button1Click
58 | end
59 | object Button2: TButton
60 | Left = 118
61 | Top = 21
62 | Width = 75
63 | Height = 25
64 | Caption = #20462#25913'UID'
65 | TabOrder = 1
66 | OnClick = Button2Click
67 | end
68 | object Edit1: TEdit
69 | Left = 80
70 | Top = 60
71 | Width = 113
72 | Height = 27
73 | Color = cl3DLight
74 | Font.Charset = DEFAULT_CHARSET
75 | Font.Color = clWindowText
76 | Font.Height = -16
77 | Font.Name = 'Tahoma'
78 | Font.Style = []
79 | MaxLength = 8
80 | ParentFont = False
81 | ReadOnly = True
82 | TabOrder = 2
83 | end
84 | object Edit2: TEdit
85 | Left = 80
86 | Top = 103
87 | Width = 113
88 | Height = 27
89 | Font.Charset = DEFAULT_CHARSET
90 | Font.Color = clWindowText
91 | Font.Height = -16
92 | Font.Name = 'Tahoma'
93 | Font.Style = []
94 | MaxLength = 8
95 | ParentFont = False
96 | TabOrder = 3
97 | OnKeyPress = Edit2KeyPress
98 | end
99 | end
100 | object GroupBox2: TGroupBox
101 | Left = 256
102 | Top = 16
103 | Width = 369
104 | Height = 57
105 | Caption = #26522#20030#21151#33021
106 | TabOrder = 2
107 | object Label5: TLabel
108 | Left = 256
109 | Top = 26
110 | Width = 48
111 | Height = 13
112 | Caption = #20844#24046#33539#22260
113 | end
114 | object Label6: TLabel
115 | Left = 124
116 | Top = 26
117 | Width = 72
118 | Height = 13
119 | Caption = #25506#27979#27599#20010#25159#21306
120 | end
121 | object Button3: TButton
122 | Left = 24
123 | Top = 21
124 | Width = 75
125 | Height = 25
126 | Caption = #26522#20030#23494#38053
127 | Enabled = False
128 | TabOrder = 0
129 | OnClick = Button3Click
130 | end
131 | object Edit3: TEdit
132 | Left = 208
133 | Top = 23
134 | Width = 26
135 | Height = 21
136 | MaxLength = 2
137 | NumbersOnly = True
138 | TabOrder = 1
139 | Text = '20'
140 | end
141 | object Edit4: TEdit
142 | Left = 319
143 | Top = 23
144 | Width = 26
145 | Height = 21
146 | MaxLength = 2
147 | NumbersOnly = True
148 | TabOrder = 2
149 | Text = '20'
150 | end
151 | end
152 | object GroupBox3: TGroupBox
153 | Left = 256
154 | Top = 79
155 | Width = 369
156 | Height = 81
157 | Caption = #35835#12289#20889#21151#33021
158 | TabOrder = 3
159 | object Button4: TButton
160 | Left = 24
161 | Top = 21
162 | Width = 75
163 | Height = 25
164 | Caption = #35835#12289#20889#21345
165 | TabOrder = 0
166 | OnClick = Button4Click
167 | end
168 | object Panel1: TPanel
169 | Left = 136
170 | Top = 3
171 | Width = 233
172 | Height = 75
173 | BevelOuter = bvNone
174 | Ctl3D = False
175 | ParentCtl3D = False
176 | TabOrder = 1
177 | object RadioButton1: TRadioButton
178 | Left = 32
179 | Top = 16
180 | Width = 89
181 | Height = 17
182 | Caption = #35835#19968#33324#30333#21345
183 | Checked = True
184 | TabOrder = 0
185 | TabStop = True
186 | end
187 | object RadioButton2: TRadioButton
188 | Left = 135
189 | Top = 16
190 | Width = 81
191 | Height = 17
192 | Caption = #35835'UID'#30333#21345
193 | TabOrder = 1
194 | end
195 | object RadioButton3: TRadioButton
196 | Left = 33
197 | Top = 47
198 | Width = 89
199 | Height = 17
200 | Caption = #20889#19968#33324#30333#21345
201 | TabOrder = 2
202 | end
203 | object RadioButton4: TRadioButton
204 | Left = 136
205 | Top = 47
206 | Width = 89
207 | Height = 17
208 | Caption = #20889'UID'#30333#21345
209 | TabOrder = 3
210 | end
211 | end
212 | end
213 | object GroupBox4: TGroupBox
214 | Left = 15
215 | Top = 167
216 | Width = 610
217 | Height = 145
218 | Caption = #25991#20214#35774#32622
219 | TabOrder = 4
220 | object Label3: TLabel
221 | Left = 24
222 | Top = 31
223 | Width = 55
224 | Height = 13
225 | Caption = 'DUMP '#25991#20214
226 | end
227 | object Label4: TLabel
228 | Left = 24
229 | Top = 89
230 | Width = 45
231 | Height = 13
232 | Caption = 'KEY '#25991#20214
233 | end
234 | object Button5: TButton
235 | Left = 544
236 | Top = 22
237 | Width = 42
238 | Height = 25
239 | Caption = #25171#24320
240 | TabOrder = 0
241 | OnClick = Button5Click
242 | end
243 | object Button6: TButton
244 | Left = 544
245 | Top = 80
246 | Width = 42
247 | Height = 25
248 | Caption = #25171#24320
249 | TabOrder = 1
250 | OnClick = Button6Click
251 | end
252 | object Edit5: TEdit
253 | Left = 24
254 | Top = 53
255 | Width = 562
256 | Height = 21
257 | MaxLength = 256
258 | TabOrder = 2
259 | Text = 'c:\d.dump'
260 | end
261 | object Edit6: TEdit
262 | Left = 24
263 | Top = 111
264 | Width = 562
265 | Height = 21
266 | MaxLength = 256
267 | TabOrder = 3
268 | end
269 | object Button7: TButton
270 | Left = 488
271 | Top = 80
272 | Width = 25
273 | Height = 25
274 | Caption = #8595
275 | TabOrder = 4
276 | OnClick = Button7Click
277 | end
278 | object RadioButton5: TRadioButton
279 | Left = 152
280 | Top = 88
281 | Width = 113
282 | Height = 17
283 | Caption = 'KEY A'
284 | Checked = True
285 | TabOrder = 5
286 | TabStop = True
287 | end
288 | object RadioButton6: TRadioButton
289 | Left = 296
290 | Top = 88
291 | Width = 113
292 | Height = 17
293 | Caption = 'KEY B'
294 | TabOrder = 6
295 | end
296 | end
297 | object OpenDialog1: TOpenDialog
298 | Left = 504
299 | Top = 176
300 | end
301 | end
302 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.17929
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace NFCGui.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NFCGui.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// 查找 System.Byte[] 类型的本地化资源。
65 | ///
66 | internal static byte[] libnfc {
67 | get {
68 | object obj = ResourceManager.GetObject("libnfc", resourceCulture);
69 | return ((byte[])(obj));
70 | }
71 | }
72 |
73 | ///
74 | /// 查找 System.Byte[] 类型的本地化资源。
75 | ///
76 | internal static byte[] libusb0 {
77 | get {
78 | object obj = ResourceManager.GetObject("libusb0", resourceCulture);
79 | return ((byte[])(obj));
80 | }
81 | }
82 |
83 | ///
84 | /// 查找 System.Byte[] 类型的本地化资源。
85 | ///
86 | internal static byte[] mfoc {
87 | get {
88 | object obj = ResourceManager.GetObject("mfoc", resourceCulture);
89 | return ((byte[])(obj));
90 | }
91 | }
92 |
93 | ///
94 | /// 查找 System.Byte[] 类型的本地化资源。
95 | ///
96 | internal static byte[] nfc {
97 | get {
98 | object obj = ResourceManager.GetObject("nfc", resourceCulture);
99 | return ((byte[])(obj));
100 | }
101 | }
102 |
103 | ///
104 | /// 查找 System.Byte[] 类型的本地化资源。
105 | ///
106 | internal static byte[] nfc_anticol {
107 | get {
108 | object obj = ResourceManager.GetObject("nfc_anticol", resourceCulture);
109 | return ((byte[])(obj));
110 | }
111 | }
112 |
113 | ///
114 | /// 查找 System.Byte[] 类型的本地化资源。
115 | ///
116 | internal static byte[] nfc_dep_initiator {
117 | get {
118 | object obj = ResourceManager.GetObject("nfc_dep_initiator", resourceCulture);
119 | return ((byte[])(obj));
120 | }
121 | }
122 |
123 | ///
124 | /// 查找 System.Byte[] 类型的本地化资源。
125 | ///
126 | internal static byte[] nfc_dep_target {
127 | get {
128 | object obj = ResourceManager.GetObject("nfc_dep_target", resourceCulture);
129 | return ((byte[])(obj));
130 | }
131 | }
132 |
133 | ///
134 | /// 查找 System.Byte[] 类型的本地化资源。
135 | ///
136 | internal static byte[] nfc_emulate_forum_tag2 {
137 | get {
138 | object obj = ResourceManager.GetObject("nfc_emulate_forum_tag2", resourceCulture);
139 | return ((byte[])(obj));
140 | }
141 | }
142 |
143 | ///
144 | /// 查找 System.Byte[] 类型的本地化资源。
145 | ///
146 | internal static byte[] nfc_emulate_forum_tag4 {
147 | get {
148 | object obj = ResourceManager.GetObject("nfc_emulate_forum_tag4", resourceCulture);
149 | return ((byte[])(obj));
150 | }
151 | }
152 |
153 | ///
154 | /// 查找 System.Byte[] 类型的本地化资源。
155 | ///
156 | internal static byte[] nfc_emulate_tag {
157 | get {
158 | object obj = ResourceManager.GetObject("nfc_emulate_tag", resourceCulture);
159 | return ((byte[])(obj));
160 | }
161 | }
162 |
163 | ///
164 | /// 查找 System.Byte[] 类型的本地化资源。
165 | ///
166 | internal static byte[] nfc_emulate_uid {
167 | get {
168 | object obj = ResourceManager.GetObject("nfc_emulate_uid", resourceCulture);
169 | return ((byte[])(obj));
170 | }
171 | }
172 |
173 | ///
174 | /// 查找 System.Byte[] 类型的本地化资源。
175 | ///
176 | internal static byte[] nfc_list {
177 | get {
178 | object obj = ResourceManager.GetObject("nfc_list", resourceCulture);
179 | return ((byte[])(obj));
180 | }
181 | }
182 |
183 | ///
184 | /// 查找 System.Byte[] 类型的本地化资源。
185 | ///
186 | internal static byte[] nfc_mfclassic {
187 | get {
188 | object obj = ResourceManager.GetObject("nfc_mfclassic", resourceCulture);
189 | return ((byte[])(obj));
190 | }
191 | }
192 |
193 | ///
194 | /// 查找 System.Byte[] 类型的本地化资源。
195 | ///
196 | internal static byte[] nfc_mfsetuid {
197 | get {
198 | object obj = ResourceManager.GetObject("nfc_mfsetuid", resourceCulture);
199 | return ((byte[])(obj));
200 | }
201 | }
202 |
203 | ///
204 | /// 查找 System.Byte[] 类型的本地化资源。
205 | ///
206 | internal static byte[] nfc_mfultralight {
207 | get {
208 | object obj = ResourceManager.GetObject("nfc_mfultralight", resourceCulture);
209 | return ((byte[])(obj));
210 | }
211 | }
212 |
213 | ///
214 | /// 查找 System.Byte[] 类型的本地化资源。
215 | ///
216 | internal static byte[] nfc_poll {
217 | get {
218 | object obj = ResourceManager.GetObject("nfc_poll", resourceCulture);
219 | return ((byte[])(obj));
220 | }
221 | }
222 |
223 | ///
224 | /// 查找 System.Byte[] 类型的本地化资源。
225 | ///
226 | internal static byte[] nfc_probe {
227 | get {
228 | object obj = ResourceManager.GetObject("nfc_probe", resourceCulture);
229 | return ((byte[])(obj));
230 | }
231 | }
232 |
233 | ///
234 | /// 查找 System.Byte[] 类型的本地化资源。
235 | ///
236 | internal static byte[] nfc_read_forum_tag3 {
237 | get {
238 | object obj = ResourceManager.GetObject("nfc_read_forum_tag3", resourceCulture);
239 | return ((byte[])(obj));
240 | }
241 | }
242 |
243 | ///
244 | /// 查找 System.Byte[] 类型的本地化资源。
245 | ///
246 | internal static byte[] nfc_relay {
247 | get {
248 | object obj = ResourceManager.GetObject("nfc_relay", resourceCulture);
249 | return ((byte[])(obj));
250 | }
251 | }
252 |
253 | ///
254 | /// 查找 System.Byte[] 类型的本地化资源。
255 | ///
256 | internal static byte[] nfc_relay_picc {
257 | get {
258 | object obj = ResourceManager.GetObject("nfc_relay_picc", resourceCulture);
259 | return ((byte[])(obj));
260 | }
261 | }
262 | }
263 | }
264 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\Resources\libnfc.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
123 |
124 |
125 | ..\Resources\libusb0.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
126 |
127 |
128 | ..\Resources\mfoc.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
129 |
130 |
131 | ..\Resources\nfc.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
132 |
133 |
134 | ..\Resources\nfc-anticol.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
135 |
136 |
137 | ..\Resources\nfc-dep-initiator.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
138 |
139 |
140 | ..\Resources\nfc-dep-target.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
141 |
142 |
143 | ..\Resources\nfc-emulate-forum-tag2.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
144 |
145 |
146 | ..\Resources\nfc-emulate-forum-tag4.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
147 |
148 |
149 | ..\Resources\nfc-emulate-tag.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
150 |
151 |
152 | ..\Resources\nfc-emulate-uid.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
153 |
154 |
155 | ..\Resources\nfc-list.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
156 |
157 |
158 | ..\Resources\nfc-mfclassic.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
159 |
160 |
161 | ..\Resources\nfc-mfsetuid.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
162 |
163 |
164 | ..\Resources\nfc-mfultralight.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
165 |
166 |
167 | ..\Resources\nfc-poll.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
168 |
169 |
170 | ..\Resources\nfc-probe.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
171 |
172 |
173 | ..\Resources\nfc-read-forum-tag3.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
174 |
175 |
176 | ..\Resources\nfc-relay.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
177 |
178 |
179 | ..\Resources\nfc-relay-picc.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
180 |
181 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Common/AccessCondition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Collections;
6 |
7 | namespace NFCGui.Common
8 | {
9 | internal class HexEncoding
10 | {
11 | public static string ToString(byte[] val)
12 | {
13 | string returnStr="";
14 | if (val != null)
15 | {
16 | for (int i=0; i < val.Length; i++)
17 | {
18 | returnStr+=val[i].ToString("X2");
19 | }
20 | }
21 | return returnStr;
22 | }
23 |
24 | public static Byte[] GetBytes(string val, out int discarded)
25 | {
26 | byte[] result=GetBytes(val);
27 | discarded=result.Length;
28 | return result;
29 | }
30 |
31 | public static Byte[] GetBytes(string val)
32 | {
33 | string hexString=val.Replace(" ", "");
34 | if ((hexString.Length % 2) != 0)
35 | hexString+="0";
36 | byte[] returnBytes=new byte[hexString.Length / 2];
37 | for (int i=0; i < returnBytes.Length; i++)
38 | returnBytes[i]=Convert.ToByte(hexString.Substring(i * 2, 2), 16);
39 | // discarded = returnBytes.Length;
40 | return returnBytes;
41 | }
42 | }
43 |
44 | public enum MadVersionEnum
45 | {
46 | NoMad,
47 | Version1,
48 | Version2
49 | }
50 |
51 | public class AccessCondition
52 | {
53 | public AccessCondition()
54 | {
55 | this.GetAccessConditions();
56 | }
57 |
58 | public AccessCondition(String AccessString)
59 | {
60 | this.accessConditionBytes=HexEncoding.GetBytes(AccessString.PadRight(8, '0'));
61 | this.GetAccessConditions();
62 | }
63 |
64 | public AccessCondition(Byte[] AccessBytes)
65 | {
66 | this.accessConditionBytes=AccessBytes;
67 | this.GetAccessConditions();
68 | }
69 |
70 | private bool multiApplicationCard=false;
71 | public bool MultiApplicationCard
72 | {
73 | get
74 | {
75 | return this.multiApplicationCard;
76 | }
77 | set
78 | {
79 | this.multiApplicationCard=value;
80 | }
81 | }
82 | private MadVersionEnum madVersion=MadVersionEnum.Version2;
83 | public MadVersionEnum MadVersion
84 | {
85 | get
86 | {
87 | return this.madVersion;
88 | }
89 | set
90 | {
91 | this.madVersion=value;
92 | }
93 | }
94 | private byte[] accessBits;
95 | public byte[] AccessBits
96 | {
97 | get
98 | {
99 | this.GetAccessConditions();
100 | return this.accessBits;
101 | }
102 | set
103 | {
104 | this.accessBits=value;
105 | }
106 | }
107 | private byte[] accessConditionBytes;
108 | public String AccessConditionString
109 | {
110 | get
111 | {
112 | this.CalculateAccessBits();
113 | return HexEncoding.ToString(this.accessConditionBytes);
114 | }
115 | set
116 | {
117 | this.accessConditionBytes=HexEncoding.GetBytes(value.PadRight(8, '0'));
118 | }
119 | }
120 | public Byte[] AccessConditionBytes
121 | {
122 | get
123 | {
124 | this.CalculateAccessBits();
125 | return this.accessConditionBytes;
126 | }
127 | set
128 | {
129 | this.accessConditionBytes=value;
130 | }
131 | }
132 | private void CalculateAccessBits()
133 | {
134 | this.accessConditionBytes=this.CalculateAccessBits(this.accessBits);
135 | }
136 |
137 | private bool standardizedcards=false;
138 | public bool StandardizedCards
139 | {
140 | get
141 | {
142 | return this.standardizedcards;
143 | }set
144 | {
145 | this.standardizedcards=value;
146 | }
147 | }
148 | public byte[] CalculateAccessBits(byte[] data)
149 | {
150 | // byte[] data=this.accessBits;
151 | BitArray[] bitConds=new BitArray[4];
152 |
153 | bitConds[0]=new BitArray(new byte[] { data[0] });
154 | bitConds[1]=new BitArray(new byte[] { data[1] });
155 | bitConds[2]=new BitArray(new byte[] { data[2] });
156 | bitConds[3]=new BitArray(new byte[] { data[3] });
157 | BitArray byte6=new BitArray(8);
158 | byte6.Set(0, !bitConds[0].Get(0)); // ! C1-0
159 | byte6.Set(1, !bitConds[1].Get(0)); // ! C1-1
160 | byte6.Set(2, !bitConds[2].Get(0)); // ! C1-2
161 | byte6.Set(3, !bitConds[3].Get(0)); // ! C1-3
162 | byte6.Set(4, !bitConds[0].Get(1)); // ! C2-0
163 | byte6.Set(5, !bitConds[1].Get(1)); // ! C2-1
164 | byte6.Set(6, !bitConds[2].Get(1)); // ! C2-2
165 | byte6.Set(7, !bitConds[3].Get(1)); // ! C2-3
166 | BitArray byte7=new BitArray(8);
167 | byte7.Set(0, !bitConds[0].Get(2)); // ! C3-0
168 | byte7.Set(1, !bitConds[1].Get(2)); // ! C3-1
169 | byte7.Set(2, !bitConds[2].Get(2)); // ! C3-2
170 | byte7.Set(3, !bitConds[3].Get(2)); // ! C3-3
171 | byte7.Set(4, bitConds[0].Get(0)); // C1-0
172 | byte7.Set(5, bitConds[1].Get(0)); // C1-1
173 | byte7.Set(6, bitConds[2].Get(0)); // C1-2
174 | byte7.Set(7, bitConds[3].Get(0)); // C1-3
175 | BitArray byte8=new BitArray(8);
176 | byte8.Set(0, bitConds[0].Get(1)); // C2-0
177 | byte8.Set(1, bitConds[1].Get(1)); // C2-1
178 | byte8.Set(2, bitConds[2].Get(1)); // C2-2
179 | byte8.Set(3, bitConds[3].Get(1)); // C2-3
180 | byte8.Set(4, bitConds[0].Get(2)); // C3-0
181 | byte8.Set(5, bitConds[1].Get(2)); // C3-1
182 | byte8.Set(6, bitConds[2].Get(2)); // C3-2
183 | byte8.Set(7, bitConds[3].Get(2)); // C3-3
184 | BitArray byte9=new BitArray(8);
185 | if (this.madVersion == MadVersionEnum.Version1)
186 | {
187 | byte9.Set(0, true);
188 | byte9.Set(1, false);
189 | byte9.Set(7, true);
190 | }
191 | else if (this.madVersion == MadVersionEnum.Version2)
192 | {
193 | byte9.Set(0, false);
194 | byte9.Set(1, true);
195 | byte9.Set(7, true);
196 | }
197 |
198 | byte9.Set(6, this.multiApplicationCard);
199 |
200 | Byte[] bits=new Byte[4];
201 | byte6.CopyTo(bits, 0);
202 | byte7.CopyTo(bits, 1);
203 | byte8.CopyTo(bits, 2);
204 |
205 | byte9.CopyTo(bits, 3); if (this.standardizedcards)
206 | {
207 | bits[3]=0x69;
208 | }
209 | // this.accessConditionBytes=bits;
210 | return bits;
211 | }
212 |
213 | private string verifyaccessstring="";
214 | private string verfyaccesssresult="";
215 | public String VerifyAccessConditionsString
216 | {
217 | get
218 | {
219 | return this.verifyaccessstring;
220 | }
221 | set
222 | {
223 | this.verifyaccessstring=value;
224 | }
225 | }
226 | public bool isVerifyAccessConditions
227 | {
228 | get
229 | {
230 | return this.VerifyAccessConditions();
231 | }
232 | }
233 | private bool isverifyaccess=false;
234 | public string VerifyAccessConditionsResult
235 | {
236 | get
237 | {
238 | return this.verfyaccesssresult;
239 | }
240 | }
241 | private bool VerifyAccessConditions()
242 | {
243 | this.isverifyaccess=this.VerifyAccessConditions(this.verifyaccessstring);
244 | return this.isverifyaccess ;
245 | }
246 |
247 | public bool VerifyAccessConditions(String str)
248 | {
249 | this.isverifyaccess=false;
250 | this.verifyaccessstring=str.PadRight(8, '0');
251 | this.accessConditionBytes=HexEncoding.GetBytes(this.verifyaccessstring);
252 |
253 | this.GetAccessConditions();
254 | this.CalculateAccessBits();
255 | this.verfyaccesssresult=HexEncoding.ToString(this.accessConditionBytes);
256 | this.isverifyaccess=(this.verifyaccessstring.Substring(0, 6) == this.verfyaccesssresult.Substring(0, 6));
257 |
258 | return this.isverifyaccess;
259 | }
260 |
261 | public Byte[] GetAccessConditions(byte[] data)
262 | {
263 | // byte[] data = this.accessConditionBytes;
264 | BitArray byte6=new BitArray(new Byte[] { 0xFF });
265 | BitArray byte7=new BitArray(new Byte[] { 0x07 });
266 | BitArray byte8=new BitArray(new Byte[] { 0x80 });
267 | BitArray byte9=new BitArray(new Byte[] { 0x69 });
268 |
269 | if (data != null)
270 | {
271 | byte6=new BitArray(new Byte[] { data[0] });
272 | byte7=new BitArray(new Byte[] { data[1] });
273 | byte8=new BitArray(new Byte[] { data[2] });
274 | byte9=new BitArray(new Byte[] { data[3] });
275 | }
276 | this.standardizedcards=(data == null) || (data[3] == 0x69) ;
277 |
278 | BitArray[] condBits=new BitArray[4];
279 | Byte[] result=new Byte[4];
280 | condBits[0]=new BitArray(new bool[]
281 | {
282 | byte7.Get(4), // C1-0
283 | byte8.Get(0), // C2-0
284 | byte8.Get(4) // C3-0
285 | });
286 |
287 | condBits[1]=new BitArray(new bool[]
288 | {
289 | byte7.Get(5), // C1-1
290 | byte8.Get(1), // C2-1
291 | byte8.Get(5) // C3-1
292 | });
293 |
294 | condBits[2]=new BitArray(new bool[]
295 | {
296 | byte7.Get(6), // C1-2
297 | byte8.Get(2), // C2-2
298 | byte8.Get(3) // C2-3
299 | });
300 |
301 | condBits[3]=new BitArray(new bool[]
302 | {
303 | byte7.Get(7), // C1-3
304 | byte8.Get(3), // C2-3
305 | byte8.Get(7) // C3-3
306 | });
307 |
308 | this.madVersion=MadVersionEnum.NoMad;
309 | if (byte9.Get(7))
310 | {
311 | if (byte9.Get(0))
312 | this.madVersion=MadVersionEnum.Version1;
313 | if (byte9.Get(1))
314 | this.madVersion=MadVersionEnum.Version2;
315 | }
316 | multiApplicationCard=byte9.Get(6);
317 |
318 | condBits[0].CopyTo(result, 0);
319 | condBits[1].CopyTo(result, 1);
320 | condBits[2].CopyTo(result, 2);
321 |
322 | condBits[3].CopyTo(result, 3);
323 |
324 | // this.accessBits = result;
325 | return result;
326 | }
327 |
328 | private void GetAccessConditions()
329 | {
330 | this.accessBits=this.GetAccessConditions(this.accessConditionBytes);
331 | }
332 | }
333 | }
--------------------------------------------------------------------------------
/NFCGUI-Ganso/Project1.cbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {9F50D2E9-7D03-4FF1-8FCB-61F67ECD5B07}
4 | 13.4
5 | VCL
6 | Project1.cpp
7 | True
8 | Release
9 | Win32
10 | 1
11 | Application
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Cfg_1
29 | true
30 | true
31 |
32 |
33 | true
34 | Base
35 | true
36 |
37 |
38 | true
39 | Cfg_2
40 | true
41 | true
42 |
43 |
44 | <_TCHARMapping>wchar_t
45 | CppVCLApplication
46 | E:\Demos\libnfcgui\;$(ILINK_LibraryPath)
47 | fmx;rtl;dbrtl;IndySystem;DbxClientDriver;DataSnapCommon;xmlrtl;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;soaprtl;DBXOracleDriver;CustomIPTransport;dsnap;DBXInformixDriver;fmxase;IndyCore;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;IPIndyImpl;$(PackageImports)
48 | true
49 | System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)
50 | rtl.lib;vcl.lib
51 | $(BDS)\bin\cbuilder_PROJECTICON.ico
52 | true
53 | E:\Demos\libnfcgui\;$(IncludePath)
54 | JPHNE
55 | true
56 | .\$(Platform)\$(Config)
57 | .\$(Platform)\$(Config)
58 | false
59 | true
60 | true
61 | $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath)
62 |
63 |
64 | Project1_Icon7.ico
65 | frx16;Rave100VCL;inetdbbde;DBXOdbcDriver;DBXSybaseASEDriver;vclimg;frxDB16;fs16;vclactnband;vclie;vcltouch;DBXDb2Driver;bcbsmp;vclribbon;frxe16;fsDB16;vcl;DBXMSSQLDriver;CodeSiteExpressPkg;vclx;bdertl;bcbie
66 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
67 | $(BDSINCLUDE)\windows\vcl;$(IncludePath)
68 | true
69 | 1033
70 | $(BDS)\bin\default_app.manifest
71 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
72 |
73 |
74 | false
75 | true
76 | false
77 | true
78 | _DEBUG;$(Defines)
79 | false
80 | None
81 | DEBUG
82 | true
83 | true
84 | true
85 | true
86 | Full
87 | true
88 | $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath)
89 | $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath)
90 |
91 |
92 | rtl.lib;vcl.lib
93 | true
94 | Project1_Icon9.ico
95 | 1033
96 |
97 |
98 | NDEBUG;$(Defines)
99 | None
100 |
101 |
102 | false
103 | rtl.lib;vcl.lib
104 | false
105 | false
106 | false
107 | true
108 | false
109 | Project1_Icon5.ico
110 | 1033
111 | false
112 | false
113 |
114 |
115 |
116 | 0
117 |
118 |
119 |
120 | dfm
121 | Unit1.h
122 | 1
123 |
124 |
125 |
126 | Cfg_2
127 | Base
128 |
129 |
130 | Base
131 |
132 |
133 | Cfg_1
134 | Base
135 |
136 |
137 |
138 | CPlusPlusBuilder.Personality.12
139 | CppVCLApplication
140 |
141 |
142 |
143 | False
144 | False
145 | 1
146 | 0
147 | 0
148 | 0
149 | False
150 | False
151 | False
152 | False
153 | False
154 | 2052
155 | 936
156 |
157 |
158 |
159 |
160 | 1.0.0.0
161 |
162 |
163 |
164 |
165 |
166 | 1.0.0.0
167 |
168 |
169 |
170 | False
171 | True
172 | True
173 |
174 |
175 | Project1.cpp
176 |
177 |
178 | Embarcadero LiveBindings Components
179 | Embarcadero Database Components
180 | Embarcadero MyBase DataAccess Components
181 | Embarcadero InternetExpress Components
182 | Embarcadero dbExpress Components
183 | Embarcadero DBExpress DataSnap Common Design package
184 | Embarcadero DBExpress DataSnap Server Components
185 | Embarcadero Control Panel Applet Package
186 | Embarcadero LiveBindings Components FireMonkey
187 | Embarcadero LiveBindings Components VCL
188 | Delphi 1.0 Compatibility Components
189 | Embarcadero BDE DB Components
190 | Embarcadero DataSnap Connection Components
191 | Embarcadero InterBase Express Components
192 | Embarcadero ADO DB Components
193 | Embarcadero WebSnap Components
194 | Embarcadero Intro Driver Components
195 | Embarcadero SimpleDataset Component (DBX)
196 | Embarcadero Cloud management components
197 | Embarcadero DBExpress DataSnap Client Components
198 | Embarcadero DBExpress DataSnap Server Transport Components
199 | Embarcadero DBExpress DataSnap Provider Client Components
200 | Embarcadero DataSnap Connector Components
201 | TeeChart Standard FMX Components
202 | TeeChart Standard VCL Components
203 | IntraWeb 12.0 Design Package for RAD Studio XE2
204 | Internet Explorer Components
205 | Embarcadero C++Builder Office 2000 Servers Package
206 | Embarcadero C++Builder Office XP Servers Package
207 |
208 |
209 |
210 | False
211 |
212 | True
213 |
214 |
215 | 12
216 |
217 |
218 |
219 |
220 |
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Common/Common.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.IO;
6 | using System.Windows.Forms;
7 |
8 | namespace NFCGui.Common
9 | {
10 | class Common
11 | {
12 | public static string StringToHexString(string s, Encoding encode)
13 | {
14 | byte[] b=encode.GetBytes(s);//按照指定编码将string编程字节数组
15 | string result=string.Empty;
16 | for (int i=0; i < b.Length; i++)//逐字节变为16进制字符,以%隔开
17 | {
18 | result+=Convert.ToString(b[i], 16);
19 | }
20 | return result;
21 | }
22 |
23 | public static string HexStringToString(string hs, Encoding encode)
24 | {
25 | //以%分割字符串,并去掉空字符
26 | char[] chars=hs.ToCharArray();
27 | byte[] b=new byte[chars.Length];
28 | //逐个字符变为16进制字节数据
29 | for (int i=0; i < chars.Length; i++)
30 | {
31 | b[i]=Convert.ToByte(chars[i].ToString(), 16);
32 | }
33 | //按照指定编码将字节数组变为字符串
34 | return encode.GetString(b);
35 | }
36 |
37 | public static string byteToHexStr(byte[] bytes)
38 | {
39 | string returnStr="";
40 | if (bytes != null)
41 | {
42 | for (int i=0; i < bytes.Length; i++)
43 | {
44 | returnStr+=bytes[i].ToString("X2");
45 | }
46 | }
47 | return returnStr;
48 | }
49 |
50 | public static byte[] strToToHexByte(string hexString)
51 | {
52 | hexString=hexString.Replace(" ", "");
53 | if ((hexString.Length % 2) != 0)
54 | hexString+="0";
55 | byte[] returnBytes=new byte[hexString.Length / 2];
56 | for (int i=0; i < returnBytes.Length; i++)
57 | returnBytes[i]=Convert.ToByte(hexString.Substring(i * 2, 2), 16);
58 | return returnBytes;
59 | }
60 |
61 | public static string UnHex(string hex, Encoding chs)
62 | {
63 | if (hex == null)
64 | {
65 | return "";
66 | }
67 | hex=hex.Replace(",", "");
68 | hex=hex.Replace("\n", "");
69 | hex=hex.Replace("\\", "");
70 | hex=hex.Replace(" ", "");
71 | if (hex.Length % 2 != 0)
72 | {
73 | hex+="20";//空格
74 | }
75 | // 需要将 hex 转换成 byte 数组。
76 | byte[] bytes=new byte[hex.Length / 2];
77 |
78 | for (int i=0; i < bytes.Length; i++)
79 | {
80 | try
81 | {
82 | // 每两个字符是一个 byte。
83 | bytes[i]=byte.Parse(hex.Substring(i * 2, 2),
84 | System.Globalization.NumberStyles.HexNumber);
85 | }
86 | catch
87 | {
88 | // Rethrow an exception with custom message.
89 | // throw new ArgumentException("hex is not a valid hex number!", "hex");
90 | }
91 | }
92 | // System.Text.Encoding chs = System.Text.Encoding.GetEncoding(charset);
93 | return chs.GetString(bytes);
94 | }
95 |
96 | public static string ToHex(string s, Encoding chs, bool fenge)
97 | {
98 | if ((s.Length % 2) != 0)
99 | {
100 | s+=" ";//空格
101 | //throw new ArgumentException("s is not valid chinese string!");
102 | }
103 | //System.Text.Encoding chs = System.Text.Encoding.GetEncoding(charset);
104 | byte[] bytes=chs.GetBytes(s);
105 | string str="";
106 | for (int i=0; i < bytes.Length; i++)
107 | {
108 | str+=string.Format("{0:X}", bytes[i]);
109 | if (fenge && (i != bytes.Length - 1))
110 | {
111 | str+=string.Format("{0}", ",");
112 | }
113 | }
114 | return str.ToLower();
115 | }
116 |
117 | public static void CreateNFCFiles()
118 | {
119 | try
120 | {
121 | String libnfcdll=System.IO.Path.GetTempPath() + @"\\libnfc.dll";
122 | String libusb0dll=System.IO.Path.GetTempPath() + @"\\libusb0.dll";
123 | String filename=""; //System.IO.Path.GetTempPath() + @"\\nfc-anticol.exe";
124 | FileStream fs;
125 | byte[] buffer;
126 | if (!File.Exists(libnfcdll))
127 | {
128 | fs=new FileStream(libnfcdll, FileMode.CreateNew, FileAccess.Write);
129 | buffer=Properties.Resources.libnfc;
130 | fs.Write(buffer, 0, buffer.Length);
131 | fs.Close();
132 | }
133 | if (!File.Exists(libusb0dll))
134 | {
135 | fs=new FileStream(libusb0dll, FileMode.CreateNew, FileAccess.Write);
136 | buffer=Properties.Resources.libusb0;
137 | fs.Write(buffer, 0, buffer.Length);
138 | fs.Close();
139 | }
140 | filename=System.IO.Path.GetTempPath() + @"\\nfc-anticol.exe";
141 | if (!File.Exists(filename))
142 | {
143 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
144 | buffer=Properties.Resources.nfc_anticol;
145 | fs.Write(buffer, 0, buffer.Length);
146 | fs.Close();
147 | }
148 | filename=System.IO.Path.GetTempPath() + @"\\nfc-dep-initiator.exe";
149 | if (!File.Exists(filename))
150 | {
151 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
152 | buffer=Properties.Resources.nfc_dep_initiator;
153 | fs.Write(buffer, 0, buffer.Length);
154 | fs.Close();
155 | }
156 | filename=System.IO.Path.GetTempPath() + @"\\nfc-dep-target.exe";
157 | if (!File.Exists(filename))
158 | {
159 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
160 | buffer=Properties.Resources.nfc_dep_target;
161 | fs.Write(buffer, 0, buffer.Length);
162 | fs.Close();
163 | }
164 | filename=System.IO.Path.GetTempPath() + @"\\nfc-emulate-forum-tag2.exe";
165 | if (!File.Exists(filename))
166 | {
167 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
168 | buffer=Properties.Resources.nfc_emulate_forum_tag2;
169 | fs.Write(buffer, 0, buffer.Length);
170 | fs.Close();
171 | }filename=System.IO.Path.GetTempPath() + @"\\nfc-emulate-forum-tag4.exe";
172 | if (!File.Exists(filename))
173 | {
174 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
175 | buffer=Properties.Resources.nfc_emulate_forum_tag4;
176 | fs.Write(buffer, 0, buffer.Length);
177 | fs.Close();
178 | }
179 | filename=System.IO.Path.GetTempPath() + @"\\nfc-emulate-tag.exe";
180 | if (!File.Exists(filename))
181 | {
182 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
183 | buffer=Properties.Resources.nfc_emulate_tag;
184 | fs.Write(buffer, 0, buffer.Length);
185 | fs.Close();
186 | }
187 | // nfc-emulate-uid.exe
188 | filename=System.IO.Path.GetTempPath() + @"\\nfc-emulate-uid.exe";
189 | if (!File.Exists(filename))
190 | {
191 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
192 | buffer=Properties.Resources.nfc_emulate_uid;
193 | fs.Write(buffer, 0, buffer.Length);
194 | fs.Close();
195 | }
196 | filename=System.IO.Path.GetTempPath() + @"\\nfc-list.exe";
197 | if (!File.Exists(filename))
198 | {
199 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
200 | buffer=Properties.Resources.nfc_list;
201 | fs.Write(buffer, 0, buffer.Length);
202 | fs.Close();
203 | }
204 | filename=System.IO.Path.GetTempPath() + @"\\nfc-mfclassic.exe";
205 | if (!File.Exists(filename))
206 | {
207 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
208 | buffer=Properties.Resources.nfc_mfclassic;
209 | fs.Write(buffer, 0, buffer.Length);
210 | fs.Close();
211 | }
212 | filename=System.IO.Path.GetTempPath() + @"\\nfc-mfsetuid.exe";
213 | if (!File.Exists(filename))
214 | {
215 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
216 | buffer=Properties.Resources.nfc_mfsetuid;
217 | fs.Write(buffer, 0, buffer.Length);
218 | fs.Close();
219 | }
220 |
221 | filename=System.IO.Path.GetTempPath() + @"\\nfc-mfultralight.exe";
222 | if (!File.Exists(filename))
223 | {
224 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
225 | buffer=Properties.Resources.nfc_mfultralight;
226 | fs.Write(buffer, 0, buffer.Length);
227 | fs.Close();
228 | }
229 | filename=System.IO.Path.GetTempPath() + @"\\nfc-poll.exe";
230 | if (!File.Exists(filename))
231 | {
232 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
233 | buffer=Properties.Resources.nfc_poll;
234 | fs.Write(buffer, 0, buffer.Length);
235 | fs.Close();
236 | }
237 | filename=System.IO.Path.GetTempPath() + @"\\nfc-probe.exe";
238 | if (!File.Exists(filename))
239 | {
240 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
241 | buffer=Properties.Resources.nfc_probe;
242 | fs.Write(buffer, 0, buffer.Length);
243 | fs.Close();
244 | }
245 | filename=System.IO.Path.GetTempPath() + @"\\nfc-read-forum-tag3.exe";
246 | if (!File.Exists(filename))
247 | {
248 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
249 | buffer=Properties.Resources.nfc_read_forum_tag3;
250 | fs.Write(buffer, 0, buffer.Length);
251 | fs.Close();
252 | }
253 | filename=System.IO.Path.GetTempPath() + @"\\nfc-relay.exe";
254 | if (!File.Exists(filename))
255 | {
256 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
257 | buffer=Properties.Resources.nfc_relay;
258 | fs.Write(buffer, 0, buffer.Length);
259 | fs.Close();
260 | }
261 | filename=System.IO.Path.GetTempPath() + @"\\nfc-relay-picc.exe";
262 | if (!File.Exists(filename))
263 | {
264 | fs=new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
265 | buffer=Properties.Resources.nfc_relay_picc;
266 | fs.Write(buffer, 0, buffer.Length);
267 | fs.Close();
268 | }
269 | }
270 | catch
271 | {
272 | MessageBox.Show("程序读写权限不足!", "权限错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
273 | Application.Exit();
274 | }
275 | }
276 |
277 | public static void CreateFiles()
278 | {
279 | try
280 | {
281 | String nfcdll=System.IO.Path.GetTempPath() + @"\\nfc.dll";
282 | String mfocexe=System.IO.Path.GetTempPath() + @"\\mfoc.exe";
283 | FileStream fs;
284 | byte[] buffer;
285 | if (!File.Exists(nfcdll))
286 | {
287 | fs=new FileStream(nfcdll, FileMode.CreateNew, FileAccess.Write);
288 | buffer=Properties.Resources.nfc;
289 | fs.Write(buffer, 0, buffer.Length);
290 | fs.Close();
291 | }
292 | if (!File.Exists(mfocexe))
293 | {
294 | fs=new FileStream(mfocexe, FileMode.CreateNew, FileAccess.Write);
295 | buffer=Properties.Resources.mfoc;
296 | fs.Write(buffer, 0, buffer.Length);
297 | fs.Close();
298 | }
299 | }
300 | catch
301 | {
302 | MessageBox.Show("程序读写权限不足!", "权限错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
303 | Application.Exit();
304 | }
305 | }
306 | }
307 | }
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/Common/ExcelIO.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************
2 | * 创 建 人: SamWang
3 | * 创建时间: 2012-3-16 9:59
4 | * 描 述:
5 | * 导入导出Excel通用类
6 | * 版 本: V1.0
7 | * 环 境: VS2005
8 | ******************************************************************/
9 | using System;
10 | using System.Collections.Generic;
11 | using System.Text;
12 | //using System.Windows.Forms;
13 | using Excel = Microsoft.Office.Interop.Excel;
14 | using System.Data;
15 | using System.Drawing;
16 | using System.Collections;
17 | using System.Diagnostics;
18 | using System.Data.OleDb;
19 |
20 | namespace NFCGui.Common
21 | {
22 | public class ExcelIO : IDisposable
23 | {
24 | #region Constructors
25 | private ExcelIO()
26 | {
27 | status=IsExistExecl() ? 0 : -1;
28 | }
29 |
30 | public static ExcelIO GetInstance()
31 | {
32 | //if(instance == null)
33 | //{
34 | // lock (syncRoot)
35 | // {
36 | // if(instance == null)
37 | // {
38 | // instance = new ExcelIO();
39 | // }
40 | // }
41 | //}
42 | //return instance;
43 | return new ExcelIO();
44 | }
45 |
46 | #endregion
47 |
48 | #region Fields
49 | private static ExcelIO instance;
50 | private static readonly object syncRoot=new object();
51 | private string returnMessage;
52 | private Excel.Application xlApp;
53 | private Excel.Workbooks workbooks=null;
54 | private Excel.Workbook workbook=null;
55 | private Excel.Worksheet worksheet=null;
56 | private Excel.Range range=null;
57 | private int status=-1;
58 | private bool disposed=false;//是否已经释放资源的标记
59 | #endregion
60 |
61 | #region Properties
62 | ///
63 | /// 返回信息
64 | ///
65 | public string ReturnMessage
66 | {
67 | get
68 | {
69 | return returnMessage;
70 | }
71 | }
72 |
73 | ///
74 | /// 状态:0-正常,-1-失败 1-成功
75 | ///
76 | public int Status
77 | {
78 | get
79 | {
80 | return status;
81 | }
82 | }
83 | #endregion
84 |
85 | #region Methods
86 | ///
87 | /// 判断是否安装Excel
88 | ///
89 | ///
90 | protected bool IsExistExecl()
91 | {
92 | try
93 | {
94 | xlApp=new Excel.Application();
95 | if (xlApp == null)
96 | {
97 | returnMessage="无法创建Excel对象,可能您的计算机未安装Excel!";
98 | return false;
99 | }
100 | }
101 | catch (Exception ex)
102 | {
103 | returnMessage="请正确安装Excel!";
104 | //throw ex;
105 | return false;
106 | }
107 |
108 | return true;
109 | }
110 |
111 | ///
112 | /// 获得保存路径
113 | ///
114 | ///
115 | //public static string SaveFileDialog()
116 | //{
117 | // SaveFileDialog sfd = new SaveFileDialog();
118 | // sfd.DefaultExt = "xls";
119 | // sfd.Filter = "Excel文件(*.xls)|*.xls";
120 | // if (sfd.ShowDialog() == DialogResult.OK)
121 | // {
122 | // return sfd.FileName;
123 | // }
124 | // return string.Empty;
125 | //}
126 |
127 | ///
128 | /// 获得打开文件的路径
129 | ///
130 | ///
131 | //public static string OpenFileDialog()
132 | //{
133 | // OpenFileDialog ofd = new OpenFileDialog();
134 | // ofd.DefaultExt = "xls";
135 | // ofd.Filter = "Excel文件(*.xls)|*.xls";
136 | // if (ofd.ShowDialog() == DialogResult.OK)
137 | // {
138 | // return ofd.FileName;
139 | // }
140 | // return string.Empty;
141 | //}
142 |
143 | ///
144 | /// 设置单元格边框
145 | ///
146 | protected void SetCellsBorderAround()
147 | {
148 | range.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlThin, Excel.XlColorIndex.xlColorIndexAutomatic, null);
149 | //if (dt.Rows.Count > 0)
150 | //{
151 | // range.Borders[Excel.XlBordersIndex.xlInsideHorizontal].ColorIndex = Excel.XlColorIndex.xlColorIndexAutomatic;
152 | // range.Borders[Excel.XlBordersIndex.xlInsideHorizontal].LineStyle = Excel.XlLineStyle.xlContinuous;
153 | // range.Borders[Excel.XlBordersIndex.xlInsideHorizontal].Weight = Excel.XlBorderWeight.xlThin;
154 | //}
155 | //if (dt.Columns.Count > 1)
156 | {
157 | range.Borders[Excel.XlBordersIndex.xlInsideVertical].ColorIndex=Excel.XlColorIndex.xlColorIndexAutomatic;
158 | range.Borders[Excel.XlBordersIndex.xlInsideVertical].LineStyle=Excel.XlLineStyle.xlContinuous;
159 | range.Borders[Excel.XlBordersIndex.xlInsideVertical].Weight=Excel.XlBorderWeight.xlThin;
160 | }
161 | }
162 |
163 | ///
164 | /// 将DataTable导出Excel
165 | ///
166 | /// 数据集
167 | /// 保存路径
168 | /// 报表名称
169 | /// 是否成功
170 | public bool DataTableToExecl(DataTable dt, string saveFileName, string reportName)
171 | {
172 | //判断是否安装Excel
173 | bool fileSaved=false;
174 | if (status == -1)
175 | return fileSaved;
176 | //判断数据集是否为null
177 | if (dt == null)
178 | {
179 | returnMessage="无引出数据!";
180 | return false;
181 | }
182 | //判断保存路径是否有效
183 | if (!saveFileName.Contains(":"))
184 | {
185 | returnMessage="引出路径有误!请选择正确路径!";
186 | return false;
187 | }
188 |
189 | //创建excel对象
190 | workbooks=xlApp.Workbooks;
191 | workbook=workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
192 | worksheet=workbook.Worksheets[1];//取得sheet1
193 | worksheet.Cells.Font.Size=10;
194 | worksheet.Cells.NumberFormat="@";
195 | long totalCount=dt.Rows.Count;
196 | long rowRead=0;
197 | float percent=0;
198 | int rowIndex=0;
199 |
200 | //第一行为报表名称,如果为null则不保存该行
201 | ++rowIndex;
202 | worksheet.Cells[rowIndex, 1]=reportName;
203 | range=worksheet.Cells[rowIndex, 1];
204 | range.Font.Bold=true;
205 |
206 | //写入字段(标题)
207 | ++rowIndex;
208 | for (int i=0; i < dt.Columns.Count; i++)
209 | {
210 | worksheet.Cells[rowIndex, i + 1]=dt.Columns[i].ColumnName;
211 | range=worksheet.Cells[rowIndex, i + 1];
212 |
213 | range.Font.Color=ColorTranslator.ToOle(Color.Blue);
214 | range.Interior.Color=dt.Columns[i].Caption == "表体" ? ColorTranslator.ToOle(Color.SkyBlue) : ColorTranslator.ToOle(Color.Yellow);
215 | }
216 |
217 | //写入数据
218 | ++rowIndex;
219 | for (int r=0; r < dt.Rows.Count; r++)
220 | {
221 | for (int i=0; i < dt.Columns.Count; i++)
222 | {
223 | worksheet.Cells[r + rowIndex, i + 1]=dt.Rows[r][i].ToString();
224 | }
225 | rowRead++;
226 | percent=((float)(100 * rowRead)) / totalCount;
227 | }
228 |
229 | //画单元格边框
230 | range=worksheet.get_Range(worksheet.Cells[2, 1], worksheet.Cells[dt.Rows.Count + 2, dt.Columns.Count]);
231 | this.SetCellsBorderAround();
232 |
233 | //列宽自适应
234 | range.EntireColumn.AutoFit();
235 |
236 | //保存文件
237 | if (saveFileName != "")
238 | {
239 | try
240 | {
241 | workbook.Saved=true;
242 | workbook.SaveCopyAs(saveFileName);
243 | fileSaved=true;
244 | }
245 | catch (Exception ex)
246 | {
247 | fileSaved=false;
248 | returnMessage="导出文件时出错,文件可能正被打开!\n" + ex.Message;
249 | }
250 | }
251 | else
252 | {
253 | fileSaved=false;
254 | }
255 |
256 | //释放Excel对应的对象(除xlApp,因为创建xlApp很花时间,所以等析构时才删除)
257 | //Dispose(false);
258 | Dispose();
259 | return fileSaved;
260 | }
261 |
262 | ///
263 | /// 导入EXCEL到DataSet
264 | ///
265 | /// Excel全路径文件名
266 | /// 导入成功的DataSet
267 | public DataSet ImportExcel(string fileName)
268 | {
269 | if (status == -1)
270 | return null;
271 | //判断文件是否被其他进程使用
272 | try
273 | {
274 | workbook=xlApp.Workbooks.Open(fileName, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, 1, 0);
275 | worksheet=workbook.Worksheets[1];
276 | }
277 | catch
278 | {
279 | returnMessage="Excel文件处于打开状态,请保存关闭";
280 | return null;
281 | }
282 |
283 | //获得所有Sheet名称
284 | int n=workbook.Worksheets.Count;
285 | string[] sheetSet=new string[n];
286 | ArrayList al=new ArrayList();
287 | for (int i=0; i < n; i++)
288 | {
289 | sheetSet[i]=((Excel.Worksheet)workbook.Worksheets[i + 1]).Name;
290 | }
291 |
292 | //释放Excel相关对象
293 | Dispose();
294 |
295 | //把EXCEL导入到DataSet
296 | DataSet ds=null;
297 | //string connStr = " Provider = Microsoft.ACE.OLEDB.12.0 ; Data Source = " + fileName + ";Extended Properties=\"Excel 12.0;HDR=No;IMEX=1;\"";
298 | List connStrs=new List();
299 | connStrs.Add("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " + fileName + ";Extended Properties=\"Excel 8.0;HDR=No;IMEX=1;\"");
300 | connStrs.Add("Provider = Microsoft.ACE.OLEDB.12.0 ; Data Source = " + fileName + ";Extended Properties=\"Excel 12.0;HDR=No;IMEX=1;\"");
301 | // connStrs.Add("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + fileName);
302 | foreach (string connStr in connStrs)
303 | {
304 | ds=GetDataSet(connStr, sheetSet);
305 | if (ds != null)
306 | break;
307 | }
308 | return ds;
309 | }
310 |
311 | ///
312 | /// 通过olddb获得dataset
313 | ///
314 | ///
315 | ///
316 | protected DataSet GetDataSet(string connStr, string[] sheetSet)
317 | {
318 | DataSet ds=null;
319 | using (OleDbConnection conn=new OleDbConnection(connStr))
320 | {
321 | try
322 | {
323 | conn.Open();
324 | OleDbDataAdapter da;
325 | ds=new DataSet();
326 | for (int i=0; i < sheetSet.Length; i++)
327 | {
328 | string sql="select * from [" + sheetSet[i] + "$] ";
329 | da=new OleDbDataAdapter(sql, conn);
330 | da.Fill(ds, sheetSet[i]);
331 | da.Dispose();
332 | }
333 | conn.Close();
334 | conn.Dispose();
335 | }
336 | catch (Exception ex)
337 | {
338 | return null;
339 | }
340 | }
341 | return ds;
342 | }
343 |
344 | ///
345 | /// 释放Excel对应的对象资源
346 | ///
347 | ///
348 | protected virtual void Dispose(bool disposing)
349 | {
350 | try
351 | {
352 | if (!disposed)
353 | {
354 | if (disposing)
355 | {
356 | if (range != null)
357 | {
358 | System.Runtime.InteropServices.Marshal.ReleaseComObject(range);
359 | range=null;
360 | }
361 | if (worksheet != null)
362 | {
363 | System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet);
364 | worksheet=null;
365 | }
366 | if (workbook != null)
367 | {
368 | System.Runtime.InteropServices.Marshal.ReleaseComObject(workbook);
369 | workbook=null;
370 | }
371 | if (workbooks != null)
372 | {
373 | xlApp.Application.Workbooks.Close();
374 | System.Runtime.InteropServices.Marshal.ReleaseComObject(workbooks);
375 | workbooks=null;
376 | }
377 | if (xlApp != null)
378 | {
379 | xlApp.Quit();
380 | System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp);
381 | }
382 | int generation=GC.GetGeneration(xlApp);
383 | System.GC.Collect(generation);
384 | }
385 | //非托管资源的释放
386 | //KillExcel();
387 | }
388 | disposed=true;
389 | }
390 | catch (Exception e)
391 | {
392 | throw e;
393 | }
394 | }
395 |
396 | ///
397 | /// 会自动释放非托管的该类实例的相关资源
398 | ///
399 | public void Dispose()
400 | {
401 | try
402 | {
403 | Dispose(true);
404 | //告诉垃圾回收器,资源已经被回收
405 | GC.SuppressFinalize(this);
406 | }
407 | catch (Exception e)
408 | {
409 | throw e;
410 | }
411 | }
412 |
413 | ///
414 | /// 关闭
415 | ///
416 | public void Close()
417 | {
418 | try
419 | {
420 | this.Dispose();
421 | }
422 | catch (Exception e)
423 | {
424 | throw e;
425 | }
426 | }
427 |
428 | ///
429 | /// 析构函数
430 | ///
431 | ~ExcelIO()
432 | {
433 | try
434 | {
435 | Dispose(false);
436 | }
437 | catch (Exception e)
438 | {
439 | throw e;
440 | }
441 | }
442 |
443 | ///
444 | /// 关闭Execl进程(非托管资源使用)
445 | ///
446 | private void KillExcel()
447 | {
448 | try
449 | {
450 | Process[] ps=Process.GetProcesses();
451 | foreach (Process p in ps)
452 | {
453 | if (p.ProcessName.ToLower().Equals("excel"))
454 | {
455 | //if (p.Id == ExcelID)
456 | {
457 | p.Kill();
458 | }
459 | }
460 | }
461 | }
462 | catch (Exception ex)
463 | {
464 | //MessageBox.Show("ERROR " + ex.Message);
465 | }
466 | }
467 | #endregion
468 | #region Events
469 | #endregion
470 | #region IDisposable 成员
471 | #endregion
472 | }
473 | }
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/FrmKeyManage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace NFCGui
7 | {
8 | public partial class FrmKeyManage : Form
9 | {
10 | private static byte[] Acl=new byte[4];
11 | private static int tabType=0;
12 |
13 | private string[] Skey=new String[]
14 | {
15 | "1",
16 | "2",
17 | "3",
18 | "4",
19 | "5",
20 | "6",
21 | "7",
22 | "8",
23 | "9",
24 | "0",
25 | "A",
26 | "B",
27 | "C",
28 | "D",
29 | "E",
30 | "F"
31 | };
32 |
33 | private Common.AccessCondition accesscodition=new Common.AccessCondition();
34 | public FrmKeyManage()
35 | {
36 | this.InitializeComponent();
37 | }public String BlockPermString
38 |
39 |
40 | {
41 | get
42 | {
43 | return this.textBox1.Text;
44 | }
45 | set
46 | {
47 | this.textBox1.Text=value;
48 | this.accesscodition.AccessConditionString=this.textBox1.Text;
49 | Acl=this.accesscodition.AccessBits;
50 | checkBox2.Checked=accesscodition.StandardizedCards;
51 | checkBox1.Checked=accesscodition.MultiApplicationCard;
52 | }
53 | }
54 | private void CreateACL(Byte[] a)
55 | {
56 | this.accesscodition.AccessBits=Acl;
57 | this.textBox1.Text=this.accesscodition.AccessConditionString;
58 | //decodeACL(result);
59 | }private string checkStr(string str)
60 |
61 | {
62 | str=str.ToUpper().PadRight(8, '0');
63 | string Res="";
64 |
65 | for (int i=0; i < 8; i++)
66 | {
67 | if (this.Skey.Contains(str.Substring(i, 1)))
68 | {
69 | Res+=str.Substring(i, 1);
70 | }
71 | }
72 | Res=Res.PadRight(8, '0');
73 | return Res;
74 | }
75 |
76 | private void DrawTableA(int dtype, int selectid)
77 | {
78 | this.changeState(selectid);
79 | this.groupBox1.Text=dtype == 3 ? "Security Block" : string.Format("Data Block {0}", dtype.ToString()); this.groupBox1.Refresh();
80 |
81 | Graphics g=Graphics.FromHwnd(this.groupBox1.Handle);
82 |
83 | // g.Clear(Color.FromKnownColor(KnownColor.Control));
84 | int[] datasize=new int[]
85 | {
86 | 50,
87 | 50,
88 | 100,
89 | 100,
90 | 150
91 | };
92 | String[][] datablock=new string[][]
93 | {
94 | new string[]
95 | {
96 | "Key A|B",
97 | "Key A|B",
98 | "Key A|B",
99 | "Key A|B",
100 | "Transport Configuration"
101 | },
102 | new string[]
103 | {
104 | "Key A|B",
105 | "Never",
106 | "Never",
107 | "Never",
108 | "Read/Write Block"
109 | },
110 | new string[]
111 | {
112 | "Key A|B",
113 | "Key B",
114 | "Never",
115 | "Never",
116 | "Read/Write Block"
117 | },
118 | new string[]
119 | {
120 | "Key A|B",
121 | "Key B",
122 | "Key B",
123 | "Key A|B",
124 | "Value Block"
125 | },
126 | new string[]
127 | {
128 | "Key A|B",
129 | "Never",
130 | "Never",
131 | "Key A|B",
132 | "Value Block"
133 | },
134 | new string[]
135 | {
136 | "Key B",
137 | "Key B",
138 | "Never",
139 | "Never",
140 | "Read/Write Block"
141 | },
142 | new string[]
143 | {
144 | "Key B",
145 | "Never",
146 | "Never",
147 | "Never",
148 | "Read/Write Block"
149 | },
150 | new string[]
151 | {
152 | "Never",
153 | "Never",
154 | "Never",
155 | "Never",
156 | "Read/Write Block"
157 | },
158 | };
159 | int[] secsize=new int[]
160 | {
161 | 50,
162 | 50,
163 | 50,
164 | 50,
165 | 50,
166 | 50,
167 | 150
168 | };
169 | // string[] secblocktitle = new string[] { "R};
170 | String[][] secblock=new string[][]
171 | {
172 | new string[]
173 | {
174 | "Never",
175 | "Key A",
176 | "Key A",
177 | "Never",
178 | "Key A",
179 | "Key A",
180 | "Key B may be read"
181 | },
182 | new string[]
183 | {
184 | "Never",
185 | "Never",
186 | "Key A",
187 | "Never",
188 | "Key A",
189 | "Never",
190 | "Key B may be read"
191 | },
192 | new string[]
193 | {
194 | "Never",
195 | "Key B",
196 | "Key A|B",
197 | "Never",
198 | "Never",
199 | "Key B",
200 | ""
201 | },
202 | new string[]
203 | {
204 | "Never",
205 | "Never",
206 | "Key A|B",
207 | "Never",
208 | "Never",
209 | "Never",
210 | ""
211 | },
212 | new string[]
213 | {
214 | "Never",
215 | "Key A",
216 | "Key A",
217 | "Key A",
218 | "Key A",
219 | "Key A",
220 | "Transport Configuration"
221 | },
222 | new string[]
223 | {
224 | "Never",
225 | "Key B",
226 | "Key A|B",
227 | "Key B",
228 | "Never",
229 | "Key B",
230 | ""
231 | },
232 | new string[]
233 | {
234 | "Never",
235 | "Never",
236 | "Key A|B",
237 | "Key B",
238 | "Never",
239 | "Never",
240 | ""
241 | },
242 | new string[]
243 | {
244 | "Never",
245 | "Never",
246 | "Key A|B",
247 | "Never",
248 | "Never",
249 | "Never",
250 | ""
251 | }
252 | };
253 |
254 | Pen pen=new Pen(Color.Black, 1);
255 | Pen penS=new Pen(Color.Yellow, 2);
256 | StringFormat sf=new StringFormat();
257 | sf.Alignment=StringAlignment.Center;
258 | Font font=new System.Drawing.Font(FontFamily.GenericSansSerif, 9);
259 | Font fontB=new System.Drawing.Font(FontFamily.GenericSansSerif, 9, FontStyle.Bold);
260 | Brush brush=Brushes.Black;
261 | int x=40;
262 | int y=16;
263 | string[][] drw;
264 | int[] tsize; string[] title;
265 | if (dtype != 3)
266 | {
267 | drw=datablock;
268 | tsize=datasize;
269 | g.DrawRectangle(pen, x, y, 300, 22);
270 | g.DrawString("Access Condition For", fontB, brush, new Rectangle(x, y, 300, 22), sf);
271 | g.DrawRectangle(pen, x + 300, y, 150, 22);
272 | g.DrawString("Application", fontB, brush, new Rectangle(x + 300, y, 150, 22), sf);
273 | title=new string[]
274 | {
275 | "Read",
276 | "Write",
277 | "Increment",
278 | "Dec/Transfer/\r\nRestore",
279 | ""
280 | };
281 | y=38;
282 | for (int i=0; i < title.Length; i++)
283 | {
284 | if (i == 0)
285 | {
286 | x=40;
287 | }
288 | else
289 | {
290 | x=x + tsize[i - 1];
291 | }
292 | g.DrawRectangle(pen, x, y, tsize[i], 32);
293 | g.DrawString(title[i], fontB, brush, new Rectangle(x, y, tsize[i], 32), sf);
294 | }
295 | }
296 | else
297 | {
298 | drw=secblock;
299 | tsize=secsize;
300 |
301 | g.DrawRectangle(pen, x, y, 100, 22);
302 | g.DrawString("Key A", fontB, brush, new Rectangle(x, y, 100, 22), sf);
303 | x=x + 100;
304 | g.DrawRectangle(pen, x, y, 100, 22);
305 | g.DrawString("Access Bits", fontB, brush, new Rectangle(x, y, 100, 22), sf);
306 | x=x + 100;
307 | g.DrawRectangle(pen, x, y, 100, 22);
308 | g.DrawString("Key B", fontB, brush, new Rectangle(x, y, 100, 22), sf);
309 | x=x + 100;
310 | g.DrawRectangle(pen, x, y, 150, 22);
311 | g.DrawString("Remark", fontB, brush, new Rectangle(x, y, 150, 22), sf);
312 | title=new string[]
313 | {
314 | "Read",
315 | "Write",
316 | "Read",
317 | "Write",
318 | "Read",
319 | "Write",
320 | ""
321 | };
322 | y=38;
323 | for (int i=0; i < title.Length; i++)
324 | {
325 | if (i == 0)
326 | {
327 | x=40;
328 | }
329 | else
330 | {
331 | x=x + tsize[i - 1];
332 | }
333 | g.DrawRectangle(pen, x, y, tsize[i], 32);
334 | g.DrawString(title[i], fontB, brush, new Rectangle(x, y, tsize[i], 32), sf);
335 | }
336 | }
337 | y=70;
338 | for (int i=0; i < drw.Length; i++)
339 | {
340 | for (int j=0; j < drw[i].Length; j++)
341 | {
342 | if (j == 0)
343 | {
344 | x=40;
345 | }
346 | else
347 | {
348 | x=x + tsize[j - 1];
349 | }
350 | g.DrawRectangle(pen, x, y + i * 22, tsize[j], 22);
351 | g.DrawString(drw[i][j], font, brush, new Rectangle(x, y + i * 22, tsize[j], 22), sf);
352 | }
353 | }
354 |
355 | g.DrawRectangle(penS, 40, y + selectid * 22, 450, 22);
356 | // g.
357 | }private void button1_Click(object sender, EventArgs e)
358 |
359 | {
360 | tabType=0;
361 | this.DrawTableA(tabType, Acl[tabType]);
362 | }private void button2_Click(object sender, EventArgs e)
363 |
364 | {
365 | tabType=1;
366 | this.DrawTableA(tabType, Acl[tabType]);
367 | }private void radioButton8_CheckedChanged(object sender, EventArgs e)
368 |
369 | {
370 | }private void button3_Click(object sender, EventArgs e)
371 |
372 | {
373 | tabType=2;
374 | this.DrawTableA(tabType, Acl[tabType]);
375 | }private void button4_Click(object sender, EventArgs e)
376 |
377 | {
378 | tabType=3;
379 | this.DrawTableA(tabType, Acl[tabType]);
380 | }private void changeState(int select)
381 |
382 | {
383 | this.radioButton1.Checked=false;
384 | this.radioButton2.Checked=false;
385 | this.radioButton3.Checked=false;
386 | this.radioButton4.Checked=false;
387 | this.radioButton5.Checked=false;
388 | this.radioButton6.Checked=false;
389 | this.radioButton7.Checked=false;
390 | this.radioButton8.Checked=false;
391 | if (select == 0)
392 | {
393 | this.radioButton1.Checked=true;
394 | }
395 | if (select == 1)
396 | {
397 | this.radioButton2.Checked=true;
398 | }if (select == 2)
399 | {
400 | this.radioButton3.Checked=true;
401 | }if (select == 3)
402 | {
403 | this.radioButton4.Checked=true;
404 | }if (select == 4)
405 | {
406 | this.radioButton5.Checked=true;
407 | }if (select == 5)
408 | {
409 | this.radioButton6.Checked=true;
410 | }if (select == 6)
411 | {
412 | this.radioButton7.Checked=true;
413 | }if (select == 7)
414 | {
415 | this.radioButton8.Checked=true;
416 | }
417 | }private void radioButton8_Click(object sender, EventArgs e)
418 |
419 | {
420 | if (this.radioButton1.Checked)
421 | {
422 | Acl[tabType]=0; this.DrawTableA(tabType, Acl[tabType]);
423 | }
424 | if (this.radioButton2.Checked)
425 | {
426 | // DrawTableA(tabType, 1);
427 | Acl[tabType]=1; this.DrawTableA(tabType, Acl[tabType]);
428 | }
429 | if (this.radioButton3.Checked)
430 | {
431 | // DrawTableA(tabType, 2);
432 | Acl[tabType]=2; this.DrawTableA(tabType, Acl[tabType]);
433 | }
434 | if (this.radioButton4.Checked)
435 | {
436 | // DrawTableA(tabType, 3);
437 | Acl[tabType]=3; this.DrawTableA(tabType, Acl[tabType]);
438 | }
439 | if (this.radioButton5.Checked)
440 | {
441 | // DrawTableA(tabType, 4);
442 | Acl[tabType]=4; this.DrawTableA(tabType, Acl[tabType]);
443 | }
444 | if (this.radioButton6.Checked)
445 | {
446 | // DrawTableA(tabType, 5);
447 | Acl[tabType]=5; this.DrawTableA(tabType, Acl[tabType]);
448 | }
449 | if (this.radioButton7.Checked)
450 | {
451 | // DrawTableA(tabType, 6);
452 | Acl[tabType]=6; this.DrawTableA(tabType, Acl[tabType]);
453 | }
454 | if (this.radioButton8.Checked)
455 | {
456 | // DrawTableA(tabType, 7);
457 | Acl[tabType]=7; this.DrawTableA(tabType, Acl[tabType]);
458 | }
459 | this.CreateACL(Acl);
460 | }private void button7_Click(object sender, EventArgs e)
461 |
462 | {
463 | this.accesscodition.AccessConditionString=this.textBox2.Text;
464 | tabType=0;
465 | this.DrawTableA(tabType, Acl[tabType]);
466 | //textBox2.Text=textBox2.Text.Length != 32 ? "FFFFFFFFFFFFFF078069FFFFFFFFFFFFFF" : textBox2.Text;
467 | //MiFareHelper.AccessConditions access=MiFareHelper.AccessBits.GetAccessConditions(MiFareHelper.HexEncoding.GetBytes(textBox2.Text));
468 | //MessageBox.Show(access.ToString());
469 | }
470 |
471 | private void button6_Click(object sender, EventArgs e)
472 | {
473 | DialogResult=DialogResult.Cancel;
474 | this.Close();
475 | }
476 |
477 | private void button5_Click(object sender, EventArgs e)
478 | {
479 | DialogResult=System.Windows.Forms.DialogResult.OK;
480 | }
481 |
482 | private void FrmKeyManage_Load(object sender, EventArgs e)
483 | {
484 | comboBox1.Items.AddRange(Enum.GetNames(typeof(Common.MadVersionEnum)));
485 | comboBox1.SelectedIndex=comboBox1.Items.Count - 1;
486 | checkBox2.Checked=accesscodition.StandardizedCards;
487 | checkBox1.Checked=accesscodition.MultiApplicationCard;
488 | }
489 |
490 | private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
491 | {
492 | try
493 | {
494 | accesscodition.MadVersion=(Common.MadVersionEnum)Enum.Parse(typeof(Common.MadVersionEnum), comboBox1.Text) ;
495 | textBox1.Text=accesscodition.AccessConditionString;
496 | }
497 | catch (Exception ex)
498 | {
499 | Common.Log.WriteLog(ex.Message.ToString());
500 | }
501 | }
502 |
503 | private void checkBox1_CheckedChanged(object sender, EventArgs e)
504 | {
505 | accesscodition.MultiApplicationCard=checkBox1.Checked;
506 | textBox1.Text=accesscodition.AccessConditionString;
507 | checkBox1.Text=checkBox1.Checked ? "MultiApplicationCard" : "MonoApplicationCard";
508 | }
509 |
510 | private void checkBox2_CheckedChanged(object sender, EventArgs e)
511 | {
512 | accesscodition.StandardizedCards=checkBox2.Checked;
513 | textBox1.Text=accesscodition.AccessConditionString;
514 | }
515 | }
516 | }
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/FrmKeyManage.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace NFCGui
2 | {
3 | partial class FrmKeyManage
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmKeyManage));
32 | this.groupBox1 = new System.Windows.Forms.GroupBox();
33 | this.radioButton8 = new System.Windows.Forms.RadioButton();
34 | this.radioButton7 = new System.Windows.Forms.RadioButton();
35 | this.radioButton6 = new System.Windows.Forms.RadioButton();
36 | this.radioButton5 = new System.Windows.Forms.RadioButton();
37 | this.radioButton4 = new System.Windows.Forms.RadioButton();
38 | this.radioButton3 = new System.Windows.Forms.RadioButton();
39 | this.radioButton2 = new System.Windows.Forms.RadioButton();
40 | this.radioButton1 = new System.Windows.Forms.RadioButton();
41 | this.button1 = new System.Windows.Forms.Button();
42 | this.button2 = new System.Windows.Forms.Button();
43 | this.button3 = new System.Windows.Forms.Button();
44 | this.button4 = new System.Windows.Forms.Button();
45 | this.groupBox2 = new System.Windows.Forms.GroupBox();
46 | this.textBox1 = new System.Windows.Forms.TextBox();
47 | this.button5 = new System.Windows.Forms.Button();
48 | this.button6 = new System.Windows.Forms.Button();
49 | this.textBox2 = new System.Windows.Forms.TextBox();
50 | this.button7 = new System.Windows.Forms.Button();
51 | this.label1 = new System.Windows.Forms.Label();
52 | this.comboBox1 = new System.Windows.Forms.ComboBox();
53 | this.checkBox1 = new System.Windows.Forms.CheckBox();
54 | this.checkBox2 = new System.Windows.Forms.CheckBox();
55 | this.groupBox1.SuspendLayout();
56 | this.groupBox2.SuspendLayout();
57 | this.SuspendLayout();
58 | //
59 | // groupBox1
60 | //
61 | this.groupBox1.Controls.Add(this.radioButton8);
62 | this.groupBox1.Controls.Add(this.radioButton7);
63 | this.groupBox1.Controls.Add(this.radioButton6);
64 | this.groupBox1.Controls.Add(this.radioButton5);
65 | this.groupBox1.Controls.Add(this.radioButton4);
66 | this.groupBox1.Controls.Add(this.radioButton3);
67 | this.groupBox1.Controls.Add(this.radioButton2);
68 | this.groupBox1.Controls.Add(this.radioButton1);
69 | this.groupBox1.Location = new System.Drawing.Point(7, 56);
70 | this.groupBox1.Name = "groupBox1";
71 | this.groupBox1.Size = new System.Drawing.Size(514, 261);
72 | this.groupBox1.TabIndex = 0;
73 | this.groupBox1.TabStop = false;
74 | //
75 | // radioButton8
76 | //
77 | this.radioButton8.AutoSize = true;
78 | this.radioButton8.Location = new System.Drawing.Point(19, 227);
79 | this.radioButton8.Name = "radioButton8";
80 | this.radioButton8.Size = new System.Drawing.Size(14, 13);
81 | this.radioButton8.TabIndex = 0;
82 | this.radioButton8.UseVisualStyleBackColor = true;
83 | this.radioButton8.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
84 | this.radioButton8.Click += new System.EventHandler(this.radioButton8_Click);
85 | //
86 | // radioButton7
87 | //
88 | this.radioButton7.AutoSize = true;
89 | this.radioButton7.Location = new System.Drawing.Point(19, 205);
90 | this.radioButton7.Name = "radioButton7";
91 | this.radioButton7.Size = new System.Drawing.Size(14, 13);
92 | this.radioButton7.TabIndex = 0;
93 | this.radioButton7.UseVisualStyleBackColor = true;
94 | this.radioButton7.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
95 | this.radioButton7.Click += new System.EventHandler(this.radioButton8_Click);
96 | //
97 | // radioButton6
98 | //
99 | this.radioButton6.AutoSize = true;
100 | this.radioButton6.Location = new System.Drawing.Point(19, 183);
101 | this.radioButton6.Name = "radioButton6";
102 | this.radioButton6.Size = new System.Drawing.Size(14, 13);
103 | this.radioButton6.TabIndex = 0;
104 | this.radioButton6.UseVisualStyleBackColor = true;
105 | this.radioButton6.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
106 | this.radioButton6.Click += new System.EventHandler(this.radioButton8_Click);
107 | //
108 | // radioButton5
109 | //
110 | this.radioButton5.AutoSize = true;
111 | this.radioButton5.Location = new System.Drawing.Point(19, 161);
112 | this.radioButton5.Name = "radioButton5";
113 | this.radioButton5.Size = new System.Drawing.Size(14, 13);
114 | this.radioButton5.TabIndex = 0;
115 | this.radioButton5.UseVisualStyleBackColor = true;
116 | this.radioButton5.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
117 | this.radioButton5.Click += new System.EventHandler(this.radioButton8_Click);
118 | //
119 | // radioButton4
120 | //
121 | this.radioButton4.AutoSize = true;
122 | this.radioButton4.Location = new System.Drawing.Point(19, 139);
123 | this.radioButton4.Name = "radioButton4";
124 | this.radioButton4.Size = new System.Drawing.Size(14, 13);
125 | this.radioButton4.TabIndex = 0;
126 | this.radioButton4.UseVisualStyleBackColor = true;
127 | this.radioButton4.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
128 | this.radioButton4.Click += new System.EventHandler(this.radioButton8_Click);
129 | //
130 | // radioButton3
131 | //
132 | this.radioButton3.AutoSize = true;
133 | this.radioButton3.Location = new System.Drawing.Point(19, 117);
134 | this.radioButton3.Name = "radioButton3";
135 | this.radioButton3.Size = new System.Drawing.Size(14, 13);
136 | this.radioButton3.TabIndex = 0;
137 | this.radioButton3.UseVisualStyleBackColor = true;
138 | this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
139 | this.radioButton3.Click += new System.EventHandler(this.radioButton8_Click);
140 | //
141 | // radioButton2
142 | //
143 | this.radioButton2.AutoSize = true;
144 | this.radioButton2.Location = new System.Drawing.Point(19, 95);
145 | this.radioButton2.Name = "radioButton2";
146 | this.radioButton2.Size = new System.Drawing.Size(14, 13);
147 | this.radioButton2.TabIndex = 0;
148 | this.radioButton2.UseVisualStyleBackColor = true;
149 | this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
150 | this.radioButton2.Click += new System.EventHandler(this.radioButton8_Click);
151 | //
152 | // radioButton1
153 | //
154 | this.radioButton1.AutoSize = true;
155 | this.radioButton1.Checked = true;
156 | this.radioButton1.Location = new System.Drawing.Point(19, 73);
157 | this.radioButton1.Name = "radioButton1";
158 | this.radioButton1.Size = new System.Drawing.Size(14, 13);
159 | this.radioButton1.TabIndex = 0;
160 | this.radioButton1.TabStop = true;
161 | this.radioButton1.UseVisualStyleBackColor = true;
162 | this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
163 | this.radioButton1.Click += new System.EventHandler(this.radioButton8_Click);
164 | //
165 | // button1
166 | //
167 | this.button1.Location = new System.Drawing.Point(12, 25);
168 | this.button1.Name = "button1";
169 | this.button1.Size = new System.Drawing.Size(90, 23);
170 | this.button1.TabIndex = 1;
171 | this.button1.Text = "Data Block 0";
172 | this.button1.UseVisualStyleBackColor = true;
173 | this.button1.Click += new System.EventHandler(this.button1_Click);
174 | //
175 | // button2
176 | //
177 | this.button2.Location = new System.Drawing.Point(108, 25);
178 | this.button2.Name = "button2";
179 | this.button2.Size = new System.Drawing.Size(87, 23);
180 | this.button2.TabIndex = 2;
181 | this.button2.Text = "Data Block 1";
182 | this.button2.UseVisualStyleBackColor = true;
183 | this.button2.Click += new System.EventHandler(this.button2_Click);
184 | //
185 | // button3
186 | //
187 | this.button3.Location = new System.Drawing.Point(204, 25);
188 | this.button3.Name = "button3";
189 | this.button3.Size = new System.Drawing.Size(86, 23);
190 | this.button3.TabIndex = 3;
191 | this.button3.Text = "Data Block 2";
192 | this.button3.UseVisualStyleBackColor = true;
193 | this.button3.Click += new System.EventHandler(this.button3_Click);
194 | //
195 | // button4
196 | //
197 | this.button4.Location = new System.Drawing.Point(296, 25);
198 | this.button4.Name = "button4";
199 | this.button4.Size = new System.Drawing.Size(97, 23);
200 | this.button4.TabIndex = 4;
201 | this.button4.Text = "Security Block";
202 | this.button4.UseVisualStyleBackColor = true;
203 | this.button4.Click += new System.EventHandler(this.button4_Click);
204 | //
205 | // groupBox2
206 | //
207 | this.groupBox2.Controls.Add(this.textBox1);
208 | this.groupBox2.Location = new System.Drawing.Point(399, 5);
209 | this.groupBox2.Name = "groupBox2";
210 | this.groupBox2.Size = new System.Drawing.Size(122, 50);
211 | this.groupBox2.TabIndex = 5;
212 | this.groupBox2.TabStop = false;
213 | this.groupBox2.Text = "Option Bits";
214 | //
215 | // textBox1
216 | //
217 | this.textBox1.Location = new System.Drawing.Point(6, 20);
218 | this.textBox1.Name = "textBox1";
219 | this.textBox1.ReadOnly = true;
220 | this.textBox1.Size = new System.Drawing.Size(109, 21);
221 | this.textBox1.TabIndex = 0;
222 | //
223 | // button5
224 | //
225 | this.button5.DialogResult = System.Windows.Forms.DialogResult.OK;
226 | this.button5.Location = new System.Drawing.Point(365, 349);
227 | this.button5.Name = "button5";
228 | this.button5.Size = new System.Drawing.Size(75, 23);
229 | this.button5.TabIndex = 6;
230 | this.button5.Text = "保存关闭";
231 | this.button5.UseVisualStyleBackColor = true;
232 | this.button5.Click += new System.EventHandler(this.button5_Click);
233 | //
234 | // button6
235 | //
236 | this.button6.DialogResult = System.Windows.Forms.DialogResult.Cancel;
237 | this.button6.Location = new System.Drawing.Point(446, 349);
238 | this.button6.Name = "button6";
239 | this.button6.Size = new System.Drawing.Size(75, 23);
240 | this.button6.TabIndex = 7;
241 | this.button6.Text = "关闭";
242 | this.button6.UseVisualStyleBackColor = true;
243 | this.button6.Click += new System.EventHandler(this.button6_Click);
244 | //
245 | // textBox2
246 | //
247 | this.textBox2.Location = new System.Drawing.Point(9, 352);
248 | this.textBox2.Name = "textBox2";
249 | this.textBox2.Size = new System.Drawing.Size(100, 21);
250 | this.textBox2.TabIndex = 8;
251 | //
252 | // button7
253 | //
254 | this.button7.Location = new System.Drawing.Point(115, 349);
255 | this.button7.Name = "button7";
256 | this.button7.Size = new System.Drawing.Size(111, 23);
257 | this.button7.TabIndex = 9;
258 | this.button7.Text = "分析Option Bits";
259 | this.button7.UseVisualStyleBackColor = true;
260 | this.button7.Click += new System.EventHandler(this.button7_Click);
261 | //
262 | // label1
263 | //
264 | this.label1.AutoSize = true;
265 | this.label1.Location = new System.Drawing.Point(7, 329);
266 | this.label1.Name = "label1";
267 | this.label1.Size = new System.Drawing.Size(53, 12);
268 | this.label1.TabIndex = 10;
269 | this.label1.Text = "CardType";
270 | //
271 | // comboBox1
272 | //
273 | this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
274 | this.comboBox1.FormattingEnabled = true;
275 | this.comboBox1.Location = new System.Drawing.Point(59, 326);
276 | this.comboBox1.Name = "comboBox1";
277 | this.comboBox1.Size = new System.Drawing.Size(79, 20);
278 | this.comboBox1.TabIndex = 11;
279 | this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
280 | //
281 | // checkBox1
282 | //
283 | this.checkBox1.AutoSize = true;
284 | this.checkBox1.Location = new System.Drawing.Point(156, 327);
285 | this.checkBox1.Name = "checkBox1";
286 | this.checkBox1.Size = new System.Drawing.Size(138, 16);
287 | this.checkBox1.TabIndex = 12;
288 | this.checkBox1.Text = "MultApplicationCard";
289 | this.checkBox1.UseVisualStyleBackColor = true;
290 | this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
291 | //
292 | // checkBox2
293 | //
294 | this.checkBox2.AutoSize = true;
295 | this.checkBox2.Location = new System.Drawing.Point(315, 326);
296 | this.checkBox2.Name = "checkBox2";
297 | this.checkBox2.Size = new System.Drawing.Size(126, 16);
298 | this.checkBox2.TabIndex = 13;
299 | this.checkBox2.Text = "Standardized Card";
300 | this.checkBox2.UseVisualStyleBackColor = true;
301 | this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
302 | //
303 | // FrmKeyManage
304 | //
305 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
306 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
307 | this.ClientSize = new System.Drawing.Size(531, 384);
308 | this.Controls.Add(this.checkBox2);
309 | this.Controls.Add(this.checkBox1);
310 | this.Controls.Add(this.comboBox1);
311 | this.Controls.Add(this.label1);
312 | this.Controls.Add(this.button7);
313 | this.Controls.Add(this.textBox2);
314 | this.Controls.Add(this.button6);
315 | this.Controls.Add(this.button5);
316 | this.Controls.Add(this.groupBox2);
317 | this.Controls.Add(this.button4);
318 | this.Controls.Add(this.button3);
319 | this.Controls.Add(this.button2);
320 | this.Controls.Add(this.button1);
321 | this.Controls.Add(this.groupBox1);
322 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
323 | this.MaximizeBox = false;
324 | this.MaximumSize = new System.Drawing.Size(547, 422);
325 | this.MinimumSize = new System.Drawing.Size(547, 422);
326 | this.Name = "FrmKeyManage";
327 | this.Text = "权限设置";
328 | this.Load += new System.EventHandler(this.FrmKeyManage_Load);
329 | this.groupBox1.ResumeLayout(false);
330 | this.groupBox1.PerformLayout();
331 | this.groupBox2.ResumeLayout(false);
332 | this.groupBox2.PerformLayout();
333 | this.ResumeLayout(false);
334 | this.PerformLayout();
335 |
336 | }
337 |
338 | #endregion
339 |
340 | private System.Windows.Forms.GroupBox groupBox1;
341 | private System.Windows.Forms.RadioButton radioButton8;
342 | private System.Windows.Forms.RadioButton radioButton7;
343 | private System.Windows.Forms.RadioButton radioButton6;
344 | private System.Windows.Forms.RadioButton radioButton5;
345 | private System.Windows.Forms.RadioButton radioButton4;
346 | private System.Windows.Forms.RadioButton radioButton3;
347 | private System.Windows.Forms.RadioButton radioButton2;
348 | private System.Windows.Forms.RadioButton radioButton1;
349 | private System.Windows.Forms.Button button1;
350 | private System.Windows.Forms.Button button2;
351 | private System.Windows.Forms.Button button3;
352 | private System.Windows.Forms.Button button4;
353 | private System.Windows.Forms.GroupBox groupBox2;
354 | private System.Windows.Forms.TextBox textBox1;
355 | private System.Windows.Forms.Button button5;
356 | private System.Windows.Forms.Button button6;
357 | private System.Windows.Forms.TextBox textBox2;
358 | private System.Windows.Forms.Button button7;
359 | private System.Windows.Forms.Label label1;
360 | private System.Windows.Forms.ComboBox comboBox1;
361 | private System.Windows.Forms.CheckBox checkBox1;
362 | private System.Windows.Forms.CheckBox checkBox2;
363 | }
364 | }
--------------------------------------------------------------------------------
/NFCGUI-Pangu/NFCGUI/FrmMain.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using System.IO;
10 | using System.Reflection;
11 | using System.Threading;
12 | using System.Runtime.CompilerServices;
13 | using System.Text.RegularExpressions;
14 |
15 | namespace NFCGui
16 | {
17 | public partial class FrmMain : Form
18 | {
19 | private delegate void enablelogButtonDelegate(bool val);
20 |
21 | private delegate void enablesaveLogButtonDelegate(bool val);
22 |
23 | private delegate void enablestartStopButtonDelegate(bool val);
24 |
25 | private delegate void updateLogBoxDelegate(string val);
26 |
27 | private delegate void updatelogButtonLabelDelegate(string val);
28 |
29 | private delegate void updatestartStopButtonLabelDelegate(string val);
30 |
31 | private delegate void updateStatusLabelDelegate(string val);
32 |
33 | private delegate void updateTimeLabelDelegate(string val);
34 | private Thread T; private Thread Time;
35 | public FrmMain()
36 | {
37 | InitializeComponent();
38 | this.tbKeyFile.AllowDrop=true;
39 | this.tbDumpFile.AllowDrop=true;
40 |
41 | this.tbKeyFile.DragEnter+=new DragEventHandler(this.dropfileEnter);
42 | this.tbDumpFile.DragEnter+=new DragEventHandler(this.dropfileEnter);
43 | this.tbKeyFile.DragDrop+=new DragEventHandler(this.dropfileDrop);
44 | this.tbDumpFile.DragDrop+=new DragEventHandler(this.dropfileDrop);
45 | this.listViewKey.AllowDrop=true;
46 | this.listViewKey.DragEnter+=new DragEventHandler(this.dropfileEnter);
47 | this.listViewKey.DragDrop+=new DragEventHandler(this.dropfileListDrop);
48 | this.listBox1.AllowDrop=true;
49 | this.listBox1.DragEnter+=new DragEventHandler(this.dropfileEnter);
50 | this.listViewKey.DragDrop+=new DragEventHandler(this.dropfileKeyDrop);
51 | }
52 |
53 | private void dropfileKeyDrop(object sender, DragEventArgs e)
54 | {
55 | try
56 | {
57 | string[] data=(string[])e.Data.GetData(DataFormats.FileDrop);
58 | // (sender as TextBox).Text = data[0]; ShowDumpFile(data[0]);
59 | string filename=data[0];
60 | if (!File.Exists(filename))
61 | {
62 | MessageBox.Show("文件不存在!", "错误提示");
63 | return;
64 | }
65 | StreamReader sr=new StreamReader(filename);
66 | string str="";
67 | while ((str=sr.ReadLine().ToUpper()) != null)
68 | {
69 | String Res="";
70 | for (int i=0; i < 12; i++)
71 | {
72 | if (Skey.Contains(str.Substring(i, 1)))
73 | {
74 | Res+=str.Substring(i, 1);
75 | }
76 | }
77 | Res.PadRight(12, '0');
78 |
79 | if (!listBox1.Items.Contains(Res))
80 | {
81 | listBox1.Items.Add(Res);
82 | }
83 | }
84 | sr.Close();
85 | }
86 | catch (Exception ex)
87 | {
88 | Common.Log.WriteLog(ex.Message.ToString());
89 | }
90 | }
91 |
92 | private void dropfileEnter(object sender, DragEventArgs e)
93 | {
94 | if (e.Data.GetDataPresent(DataFormats.FileDrop))
95 | {
96 | e.Effect=DragDropEffects.Copy;
97 | }
98 | }
99 |
100 | private void SaveDumpFile(String FileName)
101 | {
102 | string str="";
103 | for (int i=0; i < listViewKey.Items.Count; i++)
104 | {
105 | for (int j=1; j < listViewKey.Items[i].SubItems.Count; j++)
106 | {
107 | str+=listViewKey.Items[i].SubItems[j].Text;
108 | }
109 | }
110 | byte[] bs=Common.Common.strToToHexByte(str);
111 | FileStream fs=new FileStream(FileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
112 | fs.Seek(0, SeekOrigin.Begin);
113 | fs.Write(bs, 0, bs.Length);
114 | fs.Close();
115 | MessageBox.Show("写入文件:" + FileName + " 完成!");
116 | }
117 |
118 | private void ShowDumpFile(string FileName)
119 | {
120 | listViewKey.Tag=FileName;
121 | listViewKey.Items.Clear();
122 | // listViewKey.FullRowSelect = false;
123 | if (!File.Exists(FileName))
124 | {
125 | MessageBox.Show("文件不存在!", "错误提示");
126 | return;
127 | }
128 | try
129 | {
130 | FileStream fs=new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
131 | bool f4k=fs.Length < 4096 ? false : true;
132 |
133 | byte[] bs=new byte[(f4k ? fs.Length : 4096)];
134 | fs.Read(bs, 0, (int)fs.Length);
135 | fs.Close();
136 |
137 | string strHex=Common.Common.byteToHexStr(bs);
138 | Common.AccessCondition access=new Common.AccessCondition();
139 | for (int i=0; i < (strHex.Length / 128); i++)
140 | {
141 | ListViewItem li=new ListViewItem(i.ToString());
142 | li.UseItemStyleForSubItems=true;
143 |
144 | for (int j=0; j < 4; j++)
145 | {
146 | if (j == 3)
147 | {
148 | li.SubItems.Add(strHex.Substring(i * 128 + j * 32, 12));
149 | access.AccessConditionString=strHex.Substring(i * 128 + j * 32 + 12, 8);
150 | li.SubItems.Add(access.AccessConditionString);
151 |
152 | li.SubItems.Add(strHex.Substring(i * 128 + j * 32 + 20, 12));
153 | }
154 | else
155 | {
156 | li.SubItems.Add(strHex.Substring(i * 128 + j * 32, 32));
157 | }
158 | }
159 |
160 | listViewKey.Items.Add(li);
161 | }
162 | listViewKey.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
163 |
164 | if (!f4k)
165 | {
166 | if (MessageBox.Show("是否保存为4K文件格式?", "非4K文件格式", MessageBoxButtons.YesNo) == DialogResult.Yes)
167 | {
168 | SaveDumpFile(FileName);
169 | }
170 | }
171 | }
172 | catch (Exception ex)
173 | {
174 | Common.Log.WriteLog(ex.Message.ToString());
175 | MessageBox.Show("读取文件错误!", "错误提示");
176 | }
177 | }
178 |
179 | private void dropfileListDrop(object sender, DragEventArgs e)
180 | {
181 | try
182 | {
183 | string[] data=(string[])e.Data.GetData(DataFormats.FileDrop);
184 | ShowDumpFile(data[0]);
185 | }
186 | catch (Exception ex)
187 | {
188 | Common.Log.WriteLog(ex.Message.ToString());
189 | }
190 | }
191 |
192 | private void dropfileDrop(object sender, DragEventArgs e)
193 | {
194 | try
195 | {
196 | string[] data=(string[])e.Data.GetData(DataFormats.FileDrop);
197 | (sender as TextBox).Text=data[0]; ShowDumpFile(data[0]);
198 | }
199 | catch (Exception ex)
200 | {
201 | Common.Log.WriteLog(ex.Message.ToString());
202 | }
203 | }
204 |
205 | public void updateLogBox(string val)
206 | {
207 | if (this.tbLog.InvokeRequired)
208 | {
209 | this.tbLog.Invoke(new updateLogBoxDelegate(this.updateLogBox), new object[] { val });
210 | }
211 | else
212 | {
213 | this.tbLog.AppendText(val);
214 | }
215 | }
216 |
217 | public void updateStatus(int status)
218 | {
219 | switch (status)
220 | {
221 | case 0:
222 | this.updateStatusLabel("Idle");
223 | this.updatestartStopButtonLabel("枚举密钥");
224 | this.enablestartStopButton(true);
225 | // this.enablelogButton(false);
226 | // this.updatelogButtonLabel("Log unavailible");
227 | // this.enablesaveLogButton(false);
228 | this.trackTime=false;
229 | this.enablestartStopButton(true);
230 | return;
231 |
232 | case 1:
233 | this.updateStatusLabel("Running");
234 | this.enablestartStopButton(false);
235 | // this.enablelogButton(false);
236 | // this.updatelogButtonLabel("Log unavailible");
237 | // this.enablesaveLogButton(false);
238 | this.trackTime=true;
239 | this.enablestartStopButton(false);
240 | return;
241 |
242 | case 2:
243 | this.updateStatusLabel("Done");
244 | this.updatestartStopButtonLabel("枚举密钥");
245 | this.enablestartStopButton(true);
246 | // this.enablelogButton(true);
247 | // this.updatelogButtonLabel("Show Log");
248 | // this.enablesaveLogButton(true);
249 | this.trackTime=false;
250 | this.enablestartStopButton(true);
251 | return;
252 | }
253 | }
254 |
255 | public void updatestartStopButtonLabel(string val)
256 | {
257 | if (this.button3.InvokeRequired)
258 | {
259 | this.button3.Invoke(new updatestartStopButtonLabelDelegate(this.updatestartStopButtonLabel), new object[] { val });
260 | }
261 | else
262 | {
263 | this.button3.Text=val;
264 | }
265 | }
266 |
267 | public void enablestartStopButton(bool val)
268 | {
269 | if (this.button3.InvokeRequired)
270 | {
271 | this.button3.Invoke(new enablelogButtonDelegate(this.enablestartStopButton), new object[] { val });
272 | }
273 | else
274 | {
275 | this.button3.Enabled=val;
276 | }
277 | }
278 |
279 | public void updateStatusLabel(string val)
280 | {
281 | //if (this.statusLabel.InvokeRequired)
282 | //{
283 | // this.statusLabel.Invoke(new updateStatusLabelDelegate(this.updateStatusLabel), new object[] { val });
284 | //}
285 | //else
286 | //{
287 | this.statusLabel.Text=val;
288 | //}
289 | }
290 |
291 | public void updateTimeLabel(string val)
292 | {
293 | //if (this.timeLabel.InvokeRequired)
294 | //{
295 | // this.timeLabel.Invoke(new updateTimeLabelDelegate(this.updateTimeLabel), new object[] { val });
296 | //}
297 | //else
298 | //{
299 | this.timeLabel.Text=val;
300 | //}
301 | }
302 |
303 | private void RunResourceStream(String streamName, params Object[] args)
304 | {
305 | //string[] aa = this.GetType().Assembly.GetManifestResourceNames();
306 | //Stream streamObj =this.GetType().Assembly. GetManifestResourceStream(streamName);
307 | //byte[] bs = new byte[streamObj.Length];
308 | //streamObj.Read(bs, 0, (int)streamObj.Length);
309 | byte[] bs=(byte[])Properties.Resources.ResourceManager.GetObject(streamName);
310 | Assembly asm=Assembly.Load(bs, bs);
311 | string s=asm.Location;
312 | MethodInfo info=asm.EntryPoint;
313 | ParameterInfo[] parameters=info.GetParameters();
314 |
315 | if ((parameters != null) && (parameters.Length > 0))
316 | {
317 | info.Invoke(null, args);
318 | }
319 | else
320 | {
321 | info.Invoke(null, null);
322 | }
323 | }
324 |
325 | private void button1_Click(object sender, EventArgs e)
326 | {
327 | //RunResourceStream("mfoc");
328 | string str=Common.NfcWorker.NfcCall("nfc-list.exe", "");
329 | tbLog.AppendText(str); tbLog.AppendText("\n");
330 | Regex regx=new Regex("UID \\(\\S*\\): ((\\S\\S\\s\\s){4})",RegexOptions.IgnoreCase);
331 | if (regx.IsMatch(str))
332 | {
333 | string result=regx.Match(str).Value.ToUpper().Replace(" ", "");
334 | tbUid.Text=result.Substring(result.Length - 8);
335 | tbNewUid.Text=tbUid.Text;
336 | }
337 | else
338 | {
339 | tbUid.Text="不能识别";
340 | }
341 | }
342 |
343 | private string ShowOpenFile()
344 | {
345 | OpenFileDialog opd=new OpenFileDialog();
346 | opd.Filter="Dump Files(*.dump)|*.dump|All Files(*.*)|*.*";
347 | opd.CheckPathExists=true;
348 | opd.CheckFileExists=false;
349 | opd.ShowDialog();
350 | return opd.FileName;
351 | }
352 |
353 | private void button4_Click(object sender, EventArgs e)
354 | {
355 | tbDumpFile.Text=ShowOpenFile();
356 | if (File.Exists(tbDumpFile.Text))
357 | {
358 | ShowDumpFile(tbDumpFile.Text);
359 | }
360 | }
361 |
362 | private void button5_Click(object sender, EventArgs e)
363 | {
364 | tbKeyFile.Text=ShowOpenFile(); if (File.Exists(tbKeyFile.Text))
365 | {
366 | ShowDumpFile(tbDumpFile.Text);
367 | }
368 | }
369 |
370 | private ListViewItem Slv;
371 | private int lvsid=0;
372 | private void listViewKey_MouseDoubleClick(object sender, MouseEventArgs e)
373 | {
374 | try
375 | {
376 | this.Slv=listViewKey.SelectedItems[0];
377 | for (int i=0; i < Slv.SubItems.Count; i++)
378 | {
379 | int lvx=Slv.SubItems[i].Bounds.Location.X;
380 | int lvxc=lvx + Slv.SubItems[i].Bounds.Width;
381 | if (e.X > lvx && lvxc > e.X)
382 | {
383 | if (i == 5)
384 | {
385 | FrmKeyManage f=new FrmKeyManage();
386 | f.BlockPermString=Slv.SubItems[i].Text;
387 | if (f.ShowDialog() == DialogResult.OK)
388 | {
389 | Slv.SubItems[i].Text=f.BlockPermString;
390 | }
391 | }
392 | else
393 | {
394 | tbEdit.Visible=true;
395 | lvsid=i;
396 | tbEdit.Left=listViewKey.Left + Slv.SubItems[i].Bounds.Left;
397 | tbEdit.Top=listViewKey.Top + Slv.SubItems[i].Bounds.Top;
398 | tbEdit.Width=Slv.SubItems[i].Bounds.Width;
399 | tbEdit.Height=Slv.SubItems[i].Bounds.Height;
400 | tbEdit.Text=Slv.SubItems[i].Text ;
401 | tbEdit.Focus();
402 | }
403 | }
404 | }
405 | }
406 | catch (Exception ex)
407 | {
408 | Common.Log.WriteLog(ex.Message.ToString());
409 | }
410 | }
411 |
412 | private void tbEdit_KeyPress(object sender, KeyPressEventArgs e)
413 | {
414 | }
415 |
416 | private void tbEdit_Leave(object sender, EventArgs e)
417 | {
418 | tbEdit.Visible=false;
419 | }
420 |
421 | private string[] Skey=new String[]
422 | {
423 | "1",
424 | "2",
425 | "3",
426 | "4",
427 | "5",
428 | "6",
429 | "7",
430 | "8",
431 | "9",
432 | "0",
433 | "A",
434 | "B",
435 | "C",
436 | "D",
437 | "E",
438 | "F"
439 | };
440 | private void tbEdit_KeyDown(object sender, KeyEventArgs e)
441 | {
442 | try
443 | {
444 | // string[] key = new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "A", "B", "C", "D", "E", "F"};
445 | if (e.KeyCode == Keys.Enter)
446 | {
447 | string str=tbEdit.Text.ToUpper().PadRight(32, '0');
448 | string Res="" ;
449 | int count=32;
450 | if (lvsid == 4 || lvsid == 6)
451 | {
452 | count=12;
453 | }
454 | if (lvsid == 5)
455 | {
456 | count=8;
457 | }
458 | for (int i=0; i < count; i++)
459 | {
460 | if (Skey.Contains(str.Substring(i, 1)))
461 | {
462 | Res+=str.Substring(i, 1);
463 | }
464 | }
465 | Res=Res.PadRight(count, '0');
466 |
467 | Slv.SubItems[lvsid].Text=Res;
468 | tbEdit.Visible=false;
469 | }
470 | }
471 | catch (Exception ex)
472 | {
473 | Common.Log.WriteLog(ex.Message.ToString());
474 | }
475 | }
476 |
477 | private void button10_Click(object sender, EventArgs e)
478 | {
479 | SaveDumpFile(ShowOpenFile());
480 | }
481 |
482 | private void button11_Click(object sender, EventArgs e)
483 | {
484 | string filename=ShowOpenFile();
485 | if (!File.Exists(filename))
486 | {
487 | MessageBox.Show("文件不存在!", "错误提示");
488 | return;
489 | }
490 | StreamReader sr=new StreamReader(filename);
491 | string str="";
492 | while ((str=sr.ReadLine().ToUpper()) != null)
493 | {
494 | String Res="";
495 | for (int i=0; i < 12; i++)
496 | {
497 | if (Skey.Contains(str.Substring(i, 1)))
498 | {
499 | Res+=str.Substring(i, 1);
500 | }
501 | }
502 | Res=Res.PadRight(12, '0');
503 |
504 | if (!listBox1.Items.Contains(Res))
505 | {
506 | listBox1.Items.Add(Res);
507 | }
508 | }
509 | sr.Close();
510 | }
511 |
512 | private void button12_Click(object sender, EventArgs e)
513 | {
514 | StreamWriter sw=new StreamWriter(ShowOpenFile());
515 | for (int i=0; i < listBox1.Items.Count; i++)
516 | {
517 | sw.WriteLine(listBox1.Items[i].ToString());
518 | }
519 | sw.Close();
520 | }
521 |
522 | private void doMfock()
523 | {
524 | string keys="";
525 | for (int i=0; i < listBox1.Items.Count; i++)
526 | {
527 | keys+=" -k " + listBox1.Items[i].ToString();
528 | }
529 | string dumpfile=tbDumpFile.Text.Length < 2 ? Application.StartupPath + "\\dumpfile.dump" : tbDumpFile.Text;
530 | Common.MfocWorker.mfoc(this, int.Parse(this.probesNumericUpDown.Value.ToString()), int.Parse(this.distanceNumericUpDown.Value.ToString()), this.tbDumpFile.Text, keys);
531 | }
532 |
533 | private void keepTime()
534 | {
535 | DateTime now=DateTime.Now;
536 | while (this.trackTime)
537 | {
538 | TimeSpan span=(DateTime.Now - now);
539 | if (span > TimeSpan.FromHours(1.0))
540 | {
541 | this.updateTimeLabel(span.Hours.ToString() + "小时" + span.Minutes.ToString() + "分" + span.Seconds.ToString() + "秒");
542 | }
543 | else if (span > TimeSpan.FromMinutes(1.0))
544 | {
545 | this.updateTimeLabel(span.Minutes.ToString() + "分" + span.Seconds.ToString() + "秒");
546 | }
547 | else
548 | {
549 | this.updateTimeLabel(span.Seconds.ToString() + "秒");
550 | }
551 | Thread.Sleep(20);
552 | }
553 | }
554 |
555 | private bool trackTime=false;
556 | private void button3_Click(object sender, EventArgs e)
557 | {
558 | if (this.button3.Text == "枚举密钥")
559 | {
560 | this.trackTime=true;
561 | this.T=new Thread(new ThreadStart(this.doMfock));
562 | this.Time=new Thread(new ThreadStart(this.keepTime));
563 | this.T.Start();
564 | this.Time.Start();
565 | this.updateStatus(1);
566 | }
567 | else if (this.button3.Text == "停止枚举")
568 | {
569 | this.T.Abort();
570 | this.Time.Abort();
571 | this.updateStatus(0);
572 | this.trackTime=true;
573 | }
574 | }
575 |
576 | private void tbNewUid_KeyPress(object sender, KeyPressEventArgs e)
577 | {
578 | string str=e.KeyChar.ToString().ToUpper();
579 | if (!Skey.Contains(str))
580 | {
581 | e.KeyChar='0';
582 | }
583 | //string str = tbNewUid.Text;
584 | //String Res = "";
585 | //for (int i = 0; i < 8; i++)
586 | //{
587 | // if (Skey.Contains(str.Substring(i, 1)))
588 | // {
589 | // Res += str.Substring(i, 1);
590 | // }
591 | //}
592 | //Res = Res.PadRight(8, '0');
593 | //tbNewUid.Text = Res;
594 | }
595 |
596 | private void tbNewUid_KeyDown(object sender, KeyEventArgs e)
597 | {
598 | }
599 |
600 | private void button2_Click(object sender, EventArgs e)
601 | {
602 | string str=tbNewUid.Text;
603 | String Res="";
604 | for (int i=0; i < 8; i++)
605 | {
606 | if (Skey.Contains(str.Substring(i, 1)))
607 | {
608 | Res+=str.Substring(i, 1);
609 | }
610 | }
611 | Res=Res.PadRight(8, '0');
612 | string result=Common.NfcWorker.NfcCall("nfc-mfsetuid.exe", "-f " + Res);
613 | tbLog.AppendText(result); tbLog.AppendText("\n");
614 | }
615 |
616 | private void button6_Click(object sender, EventArgs e)
617 | {
618 | ReadWrtieCard("r"); ShowDumpFile(tbDumpFile.Text);
619 | }
620 |
621 | private void button8_Click(object sender, EventArgs e)
622 | {
623 | ReadWrtieCard("w");
624 | }
625 |
626 | private void button7_Click(object sender, EventArgs e)
627 | {
628 | ReadWrtieCard("R");
629 | ShowDumpFile(tbDumpFile.Text);
630 | }
631 |
632 | private void ReadWrtieCard(string scmd)
633 | {
634 | string skey=radioButton1.Checked ? "a" : "b";
635 | // string scmd = "W";
636 | if (!File.Exists(tbDumpFile.Text))
637 | {
638 | MessageBox.Show("请选择Dump文件!");
639 | tbDumpFile.Focus();
640 | return;
641 | }
642 | string cmd="";
643 | // StringBuilder sb = new StringBuilder("");
644 | if (!File.Exists(tbKeyFile.Text))
645 | {
646 | // sb.AppendFormat(" %s %s \"%s\" ", scmd , skey , tbDumpFile.Text);
647 | cmd=string.Concat(new object[]
648 | {
649 | " ",
650 | scmd,
651 | " ",
652 | skey,
653 | " ",
654 | "\"",
655 | tbDumpFile.Text,
656 | "\""
657 | });
658 | }
659 | else
660 | {
661 | //sb.AppendFormat(" %s %s \"%s\" \"%s\" ", scmd , skey , tbDumpFile.Text,tbKeyFile.Text);
662 | cmd=string.Concat(new object[]
663 | {
664 | " ",
665 | scmd,
666 | " ",
667 | skey,
668 | " ",
669 | "\"",
670 | tbDumpFile.Text,
671 | "\"",
672 | " ",
673 | "\"",
674 | tbKeyFile.Text,
675 | "\""
676 | });
677 | }
678 | string result=Common.NfcWorker.NfcCall("nfc-mfclassic.exe", cmd);
679 | tbLog.AppendText(result);
680 | }
681 |
682 | private void button9_Click(object sender, EventArgs e)
683 | {
684 | ReadWrtieCard("W");
685 | }
686 |
687 | private void button13_Click(object sender, EventArgs e)
688 | {
689 | DataTable dt=new DataTable();
690 | dt.Columns.Add("id");
691 | dt.Columns.Add("block0");
692 | dt.Columns.Add("block1");
693 | dt.Columns.Add("block2");
694 | dt.Columns.Add("keya");
695 |
696 | dt.Columns.Add("control");
697 | dt.Columns.Add("keyb");
698 | for (int i=0; i < this.listViewKey.Items.Count; i++)
699 | {
700 | DataRow dr=dt.NewRow();
701 | for (int j=0; j < listViewKey.Items[i].SubItems.Count; j++)
702 | {
703 | dr[j]=listViewKey.Items[i].SubItems[j].Text ;
704 | }
705 | // dr["id"]=listViewKey.Items[i].SubItems[0];
706 | }
707 | Common.ExcelIO.GetInstance().DataTableToExecl(dt, ShowOpenFile(), null);
708 | }
709 |
710 | private void button15_Click(object sender, EventArgs e)
711 | {
712 | FrmKeyManage key=new FrmKeyManage();
713 | key.ShowDialog();
714 | }
715 |
716 | private void button16_Click(object sender, EventArgs e)
717 | {
718 | MessageBox.Show("什么是RadioWar?\r\n RadioWar估计是国内首个公开专注研究无线类安全方面的“组织”,之所谓需要使用双引号是因为我们这个组织并没有任何纪律,没有任何规则。彼此都在学习,彼此都在研究相关的技术。我们主要专注于研究2.4GHz无线网络安全、RFID安全、NFC安全以及移动终端等等。我们都是初级入门人士,不能够说在这个圈子有任何的技术领先之类的!希望大家可以跟我们技术研讨。\r\n RadioWar的成员:\r\n 团-长\r\n 磁力共振\r\n 物理呆呆熊\r\n IndigoSoul\r\n douniwan5788(忘记万恶的你!)\r\n super480(邪恶的人)\r\n Open(一个每天需要男人的MM)\r\n 鬼仔\r\n cooaoo\r\n h4k_b4n\r\n A.I.");
719 |
720 | }
721 | }
722 | }
--------------------------------------------------------------------------------