Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libnfc
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Debian
libnfc
Commits
20e51e97
Commit
20e51e97
authored
Mar 12, 2013
by
Philippe Teuwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nfc-mfclassic: add option to allow using keyfile from another card
parent
16161e1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
utils/nfc-mfclassic.c
utils/nfc-mfclassic.c
+10
-5
No files found.
utils/nfc-mfclassic.c
View file @
20e51e97
...
...
@@ -65,6 +65,7 @@ static mifare_classic_tag mtKeys;
static
mifare_classic_tag
mtDump
;
static
bool
bUseKeyA
;
static
bool
bUseKeyFile
;
static
bool
bForceKeyFile
;
static
bool
bTolerateFailures
;
static
uint8_t
uiBlocks
;
static
uint8_t
keys
[]
=
{
...
...
@@ -445,7 +446,7 @@ static void
print_usage
(
const
char
*
pcProgramName
)
{
printf
(
"Usage: "
);
printf
(
"%s r|R|w|W a|b <dump.mfd> [<keys.mfd>]
\n
"
,
pcProgramName
);
printf
(
"%s r|R|w|W a|b <dump.mfd> [<keys.mfd>
[f]
]
\n
"
,
pcProgramName
);
printf
(
" r|R|w|W - Perform read from (r) or unlocked read from (R) or write to (w) or unlocked write to (W) card
\n
"
);
printf
(
" *** note that unlocked write will attempt to overwrite block 0 including UID
\n
"
);
printf
(
" *** unlocked read does not require authentication and will reveal A and B keys
\n
"
);
...
...
@@ -453,6 +454,7 @@ print_usage(const char *pcProgramName)
printf
(
" a|A|b|B - Use A or B keys for action; Halt on errors (a|b) or tolerate errors (A|B)
\n
"
);
printf
(
" <dump.mfd> - MiFare Dump (MFD) used to write (card to MFD) or (MFD to card)
\n
"
);
printf
(
" <keys.mfd> - MiFare Dump (MFD) that contain the keys (optional)
\n
"
);
printf
(
" f - Force using the keyfile even if UID does not match (optional)
\n
"
);
}
int
...
...
@@ -490,6 +492,7 @@ main(int argc, const char *argv[])
bUseKeyA
=
tolower
((
int
)((
unsigned
char
)
*
(
argv
[
2
])))
==
'a'
;
bTolerateFailures
=
tolower
((
int
)((
unsigned
char
)
*
(
argv
[
2
])))
!=
(
int
)((
unsigned
char
)
*
(
argv
[
2
]));
bUseKeyFile
=
(
argc
>
4
);
bForceKeyFile
=
((
argc
>
5
)
&&
(
strcmp
((
char
*
)
argv
[
5
],
"f"
)
==
0
));
}
if
(
atAction
==
ACTION_USAGE
)
{
...
...
@@ -567,10 +570,12 @@ main(int argc, const char *argv[])
fileUid
[
0
],
fileUid
[
1
],
fileUid
[
2
],
fileUid
[
3
]);
printf
(
"Got card with UID starting as: %02x%02x%02x%02x
\n
"
,
pbtUID
[
0
],
pbtUID
[
1
],
pbtUID
[
2
],
pbtUID
[
3
]);
printf
(
"Aborting!
\n
"
);
nfc_close
(
pnd
);
nfc_exit
(
context
);
exit
(
EXIT_FAILURE
);
if
(
!
bForceKeyFile
)
{
printf
(
"Aborting!
\n
"
);
nfc_close
(
pnd
);
nfc_exit
(
context
);
exit
(
EXIT_FAILURE
);
}
}
}
printf
(
"Found MIFARE Classic card:
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment