X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/42a6a3f87b425911d3fceb3b0056a5b867d20a12..8ac5d5cba1dc632acca0d580cb5a2123a8e153b3:/tools/mfkey/mfkey32.c diff --git a/tools/mfkey/mfkey32.c b/tools/mfkey/mfkey32.c index 4ab4bad4..eb2f24c1 100755 --- a/tools/mfkey/mfkey32.c +++ b/tools/mfkey/mfkey32.c @@ -3,13 +3,14 @@ #include #include #include "crapto1/crapto1.h" -#include "mfkey.h" -#include "util.h" +#include "mifare/mfkey.h" +#include "util_posix.h" + // 32 bit recover key from 2 nonces int main (int argc, char *argv[]) { - nonces_t data; + nonces_t data = {0}; uint32_t ks2; // keystream used to encrypt reader response uint64_t key; // recovered key @@ -24,18 +25,18 @@ int main (int argc, char *argv[]) { bool moebius_attack = (argc == 8); - sscanf(argv[1],"%x",&data.cuid); - sscanf(argv[2],"%x",&data.nonce); + sscanf(argv[1],"%" SCNx32, &data.cuid); + sscanf(argv[2],"%" SCNx32, &data.nonce); data.nonce2 = data.nonce; - sscanf(argv[3],"%x",&data.nr); - sscanf(argv[4],"%x",&data.ar); + sscanf(argv[3],"%" SCNx32, &data.nr); + sscanf(argv[4],"%" SCNx32, &data.ar); if (moebius_attack) { - sscanf(argv[5],"%x",&data.nonce2); - sscanf(argv[6],"%x",&data.nr2); - sscanf(argv[7],"%x",&data.ar2); + sscanf(argv[5],"%" SCNx32, &data.nonce2); + sscanf(argv[6],"%" SCNx32, &data.nr2); + sscanf(argv[7],"%" SCNx32, &data.ar2); } else { - sscanf(argv[5],"%x",&data.nr2); - sscanf(argv[6],"%x",&data.ar2); + sscanf(argv[5],"%" SCNx32, &data.nr2); + sscanf(argv[6],"%" SCNx32, &data.ar2); } printf("Recovering key for:\n");