projects
/
proxmark3-svn
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
another key..
[proxmark3-svn]
/
client
/
cmdhfmf.c
diff --git
a/client/cmdhfmf.c
b/client/cmdhfmf.c
index 72cbf8f76780e11403794c4a00aa1e3e5c2d6613..0cf5bd7f8bd18e33de63cfa954496580f52254a2 100644
(file)
--- a/
client/cmdhfmf.c
+++ b/
client/cmdhfmf.c
@@
-96,7
+96,8
@@
int CmdHF14AMfWrBl(const char *Cmd)
uint8_t blockNo = 0;
\r
uint8_t keyType = 0;
\r
uint8_t key[6] = {0, 0, 0, 0, 0, 0};
\r
uint8_t blockNo = 0;
\r
uint8_t keyType = 0;
\r
uint8_t key[6] = {0, 0, 0, 0, 0, 0};
\r
- uint8_t bldata[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
\r
+ uint8_t bldata[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
\r
+
\r
char cmdp = 0x00;
\r
\r
if (strlen(Cmd)<3) {
\r
char cmdp = 0x00;
\r
\r
if (strlen(Cmd)<3) {
\r
@@
-123,10
+124,10
@@
int CmdHF14AMfWrBl(const char *Cmd)
PrintAndLog("--block no:%d, key type:%c, key:%s", blockNo, keyType?'B':'A', sprint_hex(key, 6));
\r
PrintAndLog("--data: %s", sprint_hex(bldata, 16));
\r
\r
PrintAndLog("--block no:%d, key type:%c, key:%s", blockNo, keyType?'B':'A', sprint_hex(key, 6));
\r
PrintAndLog("--data: %s", sprint_hex(bldata, 16));
\r
\r
-
UsbCommand c = {CMD_MIFARE_WRITEBL, {blockNo, keyType, 0}};
\r
+ UsbCommand c = {CMD_MIFARE_WRITEBL, {blockNo, keyType, 0}};
\r
memcpy(c.d.asBytes, key, 6);
\r
memcpy(c.d.asBytes + 10, bldata, 16);
\r
memcpy(c.d.asBytes, key, 6);
\r
memcpy(c.d.asBytes + 10, bldata, 16);
\r
-
SendCommand(&c);
\r
+ SendCommand(&c);
\r
\r
UsbCommand resp;
\r
if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
\r
\r
UsbCommand resp;
\r
if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
\r
@@
-143,9
+144,11
@@
int CmdHF14AMfRdBl(const char *Cmd)
{
\r
uint8_t blockNo = 0;
\r
uint8_t keyType = 0;
\r
{
\r
uint8_t blockNo = 0;
\r
uint8_t keyType = 0;
\r
- uint8_t key[6] = {0, 0, 0, 0, 0, 0};
\r
+ uint8_t key[6] = {0, 0, 0, 0, 0, 0};
\r
+
\r
char cmdp = 0x00;
\r
\r
char cmdp = 0x00;
\r
\r
+
\r
if (strlen(Cmd)<3) {
\r
PrintAndLog("Usage: hf mf rdbl <block number> <key A/B> <key (12 hex symbols)>");
\r
PrintAndLog(" sample: hf mf rdbl 0 A FFFFFFFFFFFF ");
\r
if (strlen(Cmd)<3) {
\r
PrintAndLog("Usage: hf mf rdbl <block number> <key A/B> <key (12 hex symbols)>");
\r
PrintAndLog(" sample: hf mf rdbl 0 A FFFFFFFFFFFF ");
\r
@@
-165,9
+168,9
@@
int CmdHF14AMfRdBl(const char *Cmd)
}
\r
PrintAndLog("--block no:%d, key type:%c, key:%s ", blockNo, keyType?'B':'A', sprint_hex(key, 6));
\r
\r
}
\r
PrintAndLog("--block no:%d, key type:%c, key:%s ", blockNo, keyType?'B':'A', sprint_hex(key, 6));
\r
\r
-
UsbCommand c = {CMD_MIFARE_READBL, {blockNo, keyType, 0}};
\r
+ UsbCommand c = {CMD_MIFARE_READBL, {blockNo, keyType, 0}};
\r
memcpy(c.d.asBytes, key, 6);
\r
memcpy(c.d.asBytes, key, 6);
\r
-
SendCommand(&c);
\r
+ SendCommand(&c);
\r
\r
UsbCommand resp;
\r
if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
\r
\r
UsbCommand resp;
\r
if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
\r
@@
-429,13
+432,13
@@
int CmdHF14AMfDump(const char *Cmd)
\r
int CmdHF14AMfRestore(const char *Cmd)
\r
{
\r
\r
int CmdHF14AMfRestore(const char *Cmd)
\r
{
\r
- uint8_t sectorNo,blockNo
= 0
;
\r
+ uint8_t sectorNo,blockNo;
\r
uint8_t keyType = 0;
\r
uint8_t key[6] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
\r
uint8_t bldata[16] = {0x00};
\r
uint8_t keyA[40][6];
\r
uint8_t keyB[40][6];
\r
uint8_t keyType = 0;
\r
uint8_t key[6] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
\r
uint8_t bldata[16] = {0x00};
\r
uint8_t keyA[40][6];
\r
uint8_t keyB[40][6];
\r
- uint8_t numSectors
= 0
;
\r
+ uint8_t numSectors;
\r
\r
FILE *fdump;
\r
FILE *fkeys;
\r
\r
FILE *fdump;
\r
FILE *fkeys;
\r
@@
-547,10
+550,12
@@
int CmdHF14AMfNested(const char *Cmd)
uint8_t keyBlock[13*6];
\r
uint64_t key64 = 0;
\r
bool transferToEml = false;
\r
uint8_t keyBlock[13*6];
\r
uint64_t key64 = 0;
\r
bool transferToEml = false;
\r
+
\r
bool createDumpFile = false;
\r
FILE *fkeys;
\r
uint8_t standart[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
\r
uint8_t tempkey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
\r
bool createDumpFile = false;
\r
FILE *fkeys;
\r
uint8_t standart[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
\r
uint8_t tempkey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
\r
+
\r
char cmdp, ctmp;
\r
\r
if (strlen(Cmd)<3) {
\r
char cmdp, ctmp;
\r
\r
if (strlen(Cmd)<3) {
\r
@@
-681,6
+686,7
@@
int CmdHF14AMfNested(const char *Cmd)
}
\r
}
\r
}
\r
}
\r
}
\r
}
\r
+
\r
// nested sectors
\r
iterations = 0;
\r
PrintAndLog("nested...");
\r
// nested sectors
\r
iterations = 0;
\r
PrintAndLog("nested...");
\r
@@
-775,8
+781,8
@@
int CmdHF14AMfChk(const char *Cmd)
PrintAndLog("Usage: hf mf chk <block number>|<*card memory> <key type (A/B/?)> [t|d] [<key (12 hex symbols)>] [<dic (*.dic)>]");
\r
PrintAndLog(" * - all sectors");
\r
PrintAndLog("card memory - 0 - MINI(320 bytes), 1 - 1K, 2 - 2K, 4 - 4K, <other> - 1K");
\r
PrintAndLog("Usage: hf mf chk <block number>|<*card memory> <key type (A/B/?)> [t|d] [<key (12 hex symbols)>] [<dic (*.dic)>]");
\r
PrintAndLog(" * - all sectors");
\r
PrintAndLog("card memory - 0 - MINI(320 bytes), 1 - 1K, 2 - 2K, 4 - 4K, <other> - 1K");
\r
- PrintAndLog("d - write keys to binary file
\n
");
\r
- PrintAndLog("t - write keys to emulator memory");
\r
+ PrintAndLog("d - write keys to binary file");
\r
+ PrintAndLog("t - write keys to emulator memory
\n
");
\r
PrintAndLog(" sample: hf mf chk 0 A 1234567890ab keys.dic");
\r
PrintAndLog(" hf mf chk *1 ? t");
\r
PrintAndLog(" hf mf chk *1 ? d");
\r
PrintAndLog(" sample: hf mf chk 0 A 1234567890ab keys.dic");
\r
PrintAndLog(" hf mf chk *1 ? t");
\r
PrintAndLog(" hf mf chk *1 ? d");
\r
@@
-785,7
+791,7
@@
int CmdHF14AMfChk(const char *Cmd)
\r
FILE * f;
\r
char filename[FILE_PATH_SIZE]={0};
\r
\r
FILE * f;
\r
char filename[FILE_PATH_SIZE]={0};
\r
- char buf[13]
= {0x00}
;
\r
+ char buf[13];
\r
uint8_t *keyBlock = NULL, *p;
\r
uint8_t stKeyBlock = 20;
\r
\r
uint8_t *keyBlock = NULL, *p;
\r
uint8_t stKeyBlock = 20;
\r
\r
@@
-1017,7
+1023,6
@@
int CmdHF14AMf1kSim(const char *Cmd)
PrintAndLog(" x (Optional) Crack, performs the 'reader attack', nr/ar attack against a legitimate reader, fishes out the key(s)");
\r
PrintAndLog("");
\r
PrintAndLog(" sample: hf mf sim u 0a0a0a0a ");
\r
PrintAndLog(" x (Optional) Crack, performs the 'reader attack', nr/ar attack against a legitimate reader, fishes out the key(s)");
\r
PrintAndLog("");
\r
PrintAndLog(" sample: hf mf sim u 0a0a0a0a ");
\r
- PrintAndLog(" : hf mf sim u 0a0a0a0a i x");
\r
return 0;
\r
}
\r
uint8_t pnr = 0;
\r
return 0;
\r
}
\r
uint8_t pnr = 0;
\r
@@
-1133,9
+1138,11
@@
int CmdHF14AMfEClear(const char *Cmd)
\r
int CmdHF14AMfESet(const char *Cmd)
\r
{
\r
\r
int CmdHF14AMfESet(const char *Cmd)
\r
{
\r
- uint8_t memBlock[16]
= {0x00}
;
\r
+ uint8_t memBlock[16];
\r
uint8_t blockNo = 0;
\r
\r
uint8_t blockNo = 0;
\r
\r
+ memset(memBlock, 0x00, sizeof(memBlock));
\r
+
\r
if (strlen(Cmd) < 3 || param_getchar(Cmd, 0) == 'h') {
\r
PrintAndLog("Usage: hf mf eset <block number> <block data (32 hex symbols)>");
\r
PrintAndLog(" sample: hf mf eset 1 000102030405060708090a0b0c0d0e0f ");
\r
if (strlen(Cmd) < 3 || param_getchar(Cmd, 0) == 'h') {
\r
PrintAndLog("Usage: hf mf eset <block number> <block data (32 hex symbols)>");
\r
PrintAndLog(" sample: hf mf eset 1 000102030405060708090a0b0c0d0e0f ");
\r
@@
-1160,7
+1167,7
@@
int CmdHF14AMfESet(const char *Cmd)
int CmdHF14AMfELoad(const char *Cmd)
\r
{
\r
FILE * f;
\r
int CmdHF14AMfELoad(const char *Cmd)
\r
{
\r
FILE * f;
\r
- char filename[FILE_PATH_SIZE]
= {0x00}
;
\r
+ char filename[FILE_PATH_SIZE];
\r
char *fnameptr = filename;
\r
char buf[64] = {0x00};
\r
uint8_t buf8[64] = {0x00};
\r
char *fnameptr = filename;
\r
char buf[64] = {0x00};
\r
uint8_t buf8[64] = {0x00};
\r
@@
-1256,9
+1263,9
@@
int CmdHF14AMfELoad(const char *Cmd)
int CmdHF14AMfESave(const char *Cmd)
\r
{
\r
FILE * f;
\r
int CmdHF14AMfESave(const char *Cmd)
\r
{
\r
FILE * f;
\r
- char filename[FILE_PATH_SIZE]
= {0x00}
;
\r
+ char filename[FILE_PATH_SIZE];
\r
char * fnameptr = filename;
\r
char * fnameptr = filename;
\r
- uint8_t buf[64]
= {0x00}
;
\r
+ uint8_t buf[64];
\r
int i, j, len, numBlocks;
\r
int nameParamNo = 1;
\r
\r
int i, j, len, numBlocks;
\r
int nameParamNo = 1;
\r
\r
@@
-1380,8
+1387,8
@@
int CmdHF14AMfEKeyPrn(const char *Cmd)
{
\r
int i;
\r
uint8_t numSectors;
\r
{
\r
int i;
\r
uint8_t numSectors;
\r
- uint8_t data[16]
= {0x00}
;
\r
- uint64_t keyA, keyB
= 0
;
\r
+ uint8_t data[16];
\r
+ uint64_t keyA, keyB;
\r
\r
if (param_getchar(Cmd, 0) == 'h') {
\r
PrintAndLog("It prints the keys loaded in the emulator memory");
\r
\r
if (param_getchar(Cmd, 0) == 'h') {
\r
PrintAndLog("It prints the keys loaded in the emulator memory");
\r
@@
-1495,13
+1502,13
@@
int CmdHF14AMfCSetBlk(const char *Cmd)
uint8_t memBlock[16] = {0x00};
\r
uint8_t blockNo = 0;
\r
bool wipeCard = FALSE;
\r
uint8_t memBlock[16] = {0x00};
\r
uint8_t blockNo = 0;
\r
bool wipeCard = FALSE;
\r
- int res
= 0;
\r
+ int res
;
\r
\r
if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') {
\r
PrintAndLog("Usage: hf mf csetblk <block number> <block data (32 hex symbols)> [w]");
\r
PrintAndLog("sample: hf mf csetblk 1 01020304050607080910111213141516");
\r
PrintAndLog("Set block data for magic Chinese card (only works with such cards)");
\r
\r
if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') {
\r
PrintAndLog("Usage: hf mf csetblk <block number> <block data (32 hex symbols)> [w]");
\r
PrintAndLog("sample: hf mf csetblk 1 01020304050607080910111213141516");
\r
PrintAndLog("Set block data for magic Chinese card (only works with such cards)");
\r
- PrintAndLog("If you also want
to wipe the card then add 'w' at the end of the command line.
");
\r
+ PrintAndLog("If you also want
wipe the card then add 'w' at the end of the command line
");
\r
return 0;
\r
}
\r
\r
return 0;
\r
}
\r
\r
@@
-1514,14
+1521,13
@@
int CmdHF14AMfCSetBlk(const char *Cmd)
\r
char ctmp = param_getchar(Cmd, 2);
\r
wipeCard = (ctmp == 'w' || ctmp == 'W');
\r
\r
char ctmp = param_getchar(Cmd, 2);
\r
wipeCard = (ctmp == 'w' || ctmp == 'W');
\r
-
\r
PrintAndLog("--block number:%2d data:%s", blockNo, sprint_hex(memBlock, 16));
\r
\r
res = mfCSetBlock(blockNo, memBlock, NULL, wipeCard, CSETBLOCK_SINGLE_OPER);
\r
if (res) {
\r
PrintAndLog("Can't write block. error=%d", res);
\r
return 1;
\r
PrintAndLog("--block number:%2d data:%s", blockNo, sprint_hex(memBlock, 16));
\r
\r
res = mfCSetBlock(blockNo, memBlock, NULL, wipeCard, CSETBLOCK_SINGLE_OPER);
\r
if (res) {
\r
PrintAndLog("Can't write block. error=%d", res);
\r
return 1;
\r
- }
\r
+ }
\r
return 0;
\r
}
\r
\r
return 0;
\r
}
\r
\r
@@
-1624,9
+1630,10
@@
int CmdHF14AMfCLoad(const char *Cmd)
}
\r
\r
int CmdHF14AMfCGetBlk(const char *Cmd) {
\r
}
\r
\r
int CmdHF14AMfCGetBlk(const char *Cmd) {
\r
- uint8_t memBlock[16]
= {0x00}
;
\r
+ uint8_t memBlock[16];
\r
uint8_t blockNo = 0;
\r
int res;
\r
uint8_t blockNo = 0;
\r
int res;
\r
+ memset(memBlock, 0x00, sizeof(memBlock));
\r
\r
if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') {
\r
PrintAndLog("Usage: hf mf cgetblk <block number>");
\r
\r
if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') {
\r
PrintAndLog("Usage: hf mf cgetblk <block number>");
\r
@@
-1793,7
+1800,7
@@
int CmdHF14AMfSniff(const char *Cmd){
int blockLen = 0;
\r
int pckNum = 0;
\r
int num = 0;
\r
int blockLen = 0;
\r
int pckNum = 0;
\r
int num = 0;
\r
- uint8_t uid[7]
= {0x00}
;
\r
+ uint8_t uid[7];
\r
uint8_t uid_len;
\r
uint8_t atqa[2] = {0x00};
\r
uint8_t sak;
\r
uint8_t uid_len;
\r
uint8_t atqa[2] = {0x00};
\r
uint8_t sak;
\r
Impressum
,
Datenschutz