diff options
author | V3n3RiX <venerix@rogentos.ro> | 2016-08-11 00:33:31 +0100 |
---|---|---|
committer | V3n3RiX <venerix@rogentos.ro> | 2016-08-11 00:33:31 +0100 |
commit | ff5dd7b3704b9e8f9f606d4929f95694ec84ddf3 (patch) | |
tree | 393b3bd8a65eb3ec464babab42da8d9ec88851c3 /net-wireless/mfoc | |
parent | 4c05e04608db666140daaa94499f5f90521a2cc4 (diff) |
cleanup
Diffstat (limited to 'net-wireless/mfoc')
-rw-r--r-- | net-wireless/mfoc/Manifest | 3 | ||||
-rw-r--r-- | net-wireless/mfoc/files/mfoc-libnfc-1.5.1.patch | 217 | ||||
-rw-r--r-- | net-wireless/mfoc/mfoc-0.10.2.ebuild | 28 |
3 files changed, 0 insertions, 248 deletions
diff --git a/net-wireless/mfoc/Manifest b/net-wireless/mfoc/Manifest deleted file mode 100644 index 8b38b00f..00000000 --- a/net-wireless/mfoc/Manifest +++ /dev/null @@ -1,3 +0,0 @@ -AUX mfoc-libnfc-1.5.1.patch 8908 RMD160 8d94b6c35fc786263afa6edff01adec42a7a094e SHA1 a85959cfe99fc5c82ec0f3ec2b4d091f444cb430 SHA256 dd6334ffa5939f11260d6bc7f5b4960162260348812ff4cc65478e51302be436 -DIST mfoc-0.10.2.tar.gz 112864 RMD160 a74ccdc22f4ead364872bac0beee0564c53f2be2 SHA1 cce1662300eeab303d375f746dd52e515e2f0e99 SHA256 fc38b990bf37b6416949d0a7c6481bdd8a67698cbb4dcae00c0576fd10845cb0 -EBUILD mfoc-0.10.2.ebuild 550 RMD160 8261f1420540deb08b1fa471bd785cda0d8d4dd8 SHA1 2a4d69343b95a759d5b683a43c48029088204e67 SHA256 81af43a5574b1c0cceba3d2b7dc8cf7af59ffb396c1f51d8723c12b56bf22fe9 diff --git a/net-wireless/mfoc/files/mfoc-libnfc-1.5.1.patch b/net-wireless/mfoc/files/mfoc-libnfc-1.5.1.patch deleted file mode 100644 index c19a554a..00000000 --- a/net-wireless/mfoc/files/mfoc-libnfc-1.5.1.patch +++ /dev/null @@ -1,217 +0,0 @@ -diff -Nru mfoc-0.10.2/src//mfoc.c mfoc/src//mfoc.c ---- mfoc-0.10.2/src//mfoc.c 2011-05-18 11:18:29.000000000 +0200 -+++ mfoc/src//mfoc.c 2012-02-11 02:02:27.028185737 +0100 -@@ -70,11 +70,11 @@ - bool skip = false; - - // Next default key specified as option (-k) -- byte_t * defKey = NULL; -+ byte_t * defKeys = NULL, *p; -+ size_t defKeys_len = 0; - - // Array with default Mifare Classic keys - byte_t defaultKeys[][6] = { -- {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, // User defined key slot - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, // Default key (first key used by program if no user defined key) - {0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5}, // NFCForum MAD key - {0xd3, 0xf7, 0xd3, 0xf7, 0xd3, 0xf7}, // NFCForum content key -@@ -128,16 +128,17 @@ - // fprintf(stdout, "Tolerance number: %d\n", probes); - break; - case 'k': -- // Add this key to the default keys list -- if ((defKey = calloc(6, sizeof(byte_t))) == NULL) { -- ERR ("Cannot allocate memory for defKey"); -+ // Add this key to the default keys -+ p = realloc(defKeys, defKeys_len + 6); -+ if (!p) { -+ ERR ("Cannot allocate memory for defKeys"); - exit (EXIT_FAILURE); -- } else { -- bzero(defKey, 6); -- num_to_bytes(strtoll(optarg, NULL, 16), 6, defKey); -- memcpy(defaultKeys[0], defKey, 6); - } -- fprintf(stdout, "The custom key 0x%012llx has been added to the default keys\n", bytes_to_num(defKey, 6)); -+ defKeys = p; -+ memset(defKeys+defKeys_len, 0, 6); -+ num_to_bytes(strtoll(optarg, NULL, 16), 6, defKeys+defKeys_len); -+ fprintf(stdout, "The custom key 0x%012llx has been added to the default keys\n", bytes_to_num(defKeys+defKeys_len, 6)); -+ defKeys_len = defKeys_len + 6; - - break; - case 'O': -@@ -252,9 +253,16 @@ - memcpy(mp.mpa.abtUid, t.nt.nti.nai.abtUid, sizeof(mp.mpa.abtUid)); - // Iterate over all keys (n = number of keys) - n = sizeof(defaultKeys)/sizeof(defaultKeys[0]); -- for (key = 0; key < n; key++) { -- if (key == 0 && defKey == NULL) ++key; // Custom key not provided, try another key -- memcpy(mp.mpa.abtKey, defaultKeys[key], sizeof(mp.mpa.abtKey)); -+ size_t defKey_bytes_todo = defKeys_len; -+ key = 0; -+ while (key < n) { -+ if (defKey_bytes_todo > 0) { -+ memcpy(mp.mpa.abtKey, defKeys + defKeys_len - defKey_bytes_todo, sizeof(mp.mpa.abtKey)); -+ defKey_bytes_todo -= sizeof(mp.mpa.abtKey); -+ } else { -+ memcpy(mp.mpa.abtKey, defaultKeys[key], sizeof(mp.mpa.abtKey)); -+ key++; -+ } - fprintf(stdout, "[Key: %012llx] -> ", bytes_to_num(mp.mpa.abtKey, 6)); - fprintf(stdout, "["); - i = 0; // Sector counter -@@ -511,22 +519,24 @@ - } - - void usage(FILE * stream, int errno) { -- fprintf(stream, "mfoc %s\n\n", PACKAGE_VERSION); -- fprintf(stream, "usage: mfoc [-h] [-P probnum] [-T tolerance] [-k custom_key] [-O output]\n\n"); -- fprintf(stream, "example: mfoc -O card_dump\n"); -- fprintf(stream, "example: mfoc -k ffffeeeedddd -O card_dump\n"); -- fprintf(stream, "example: mfoc -P 50 -O card_dump\n"); -- fprintf(stream, "\n"); -- fprintf(stream, " h : print this help\n"); --// fprintf(stream, " B : instead of 'A' dump 'B' keys\n"); -- fprintf(stream, " k : use a specified key instead of looking for defaults ones\n"); --// fprintf(stream, " D : number of distance probes, default is 20\n"); --// fprintf(stream, " S : number of sets with keystreams, default is 5\n"); -- fprintf(stream, " P : number of probes for a key recovery for one sector, default is 20\n"); -- fprintf(stream, " T : range for a possible distance tolerance, default is 20 (40 in both direction)\n"); --// fprintf(stream, " s : specify the list of sectors to crack, for example -s 0,1,3,5\n"); -- fprintf(stream, " O : dump file where the revealed keys should be stored\n"); -+ fprintf(stream, "Usage: mfoc [-h] [-k key]... [-P probnum] [-T tolerance] [-O output]\n"); -+ fprintf(stream, "\n"); -+ fprintf(stream, " h print this help and exit\n"); -+// fprintf(stream, " B instead of 'A' dump 'B' keys\n"); -+ fprintf(stream, " k try the specified key in addition to the default keys\n"); -+// fprintf(stream, " D number of distance probes, default is 20\n"); -+// fprintf(stream, " S number of sets with keystreams, default is 5\n"); -+ fprintf(stream, " P number of probes per sector, instead of default of 20\n"); -+ fprintf(stream, " T nonce tolerance half-range, instead of default of 20\n (i.e., 40 for the total range, in both directions)\n"); -+// fprintf(stream, " s specify the list of sectors to crack, for example -s 0,1,3,5\n"); -+ fprintf(stream, " O file in which the card contents will be written (REQUIRED)\n"); -+ fprintf(stream, "\n"); -+ fprintf(stream, "Example: mfoc -O mycard.mfd\n"); -+ fprintf(stream, "Example: mfoc -k ffffeeeedddd -O mycard.mfd\n"); -+ fprintf(stream, "Example: mfoc -P 50 -T 30 -O mycard.mfd\n"); - fprintf(stream, "\n"); -+ fprintf(stream, "This is mfoc version %s.\n", PACKAGE_VERSION); -+ fprintf(stream, "For more information, run: 'man mfoc'.\n"); - exit(errno); - } - -@@ -534,7 +544,7 @@ - // Connect to the first NFC device - r->pdi = nfc_connect(NULL); - if (!r->pdi) { -- ERR ("Unable to connect to NFC device\n"); -+ printf ("No NFC device found.\n"); - exit (EXIT_FAILURE); - } - } -@@ -671,7 +681,7 @@ - exit (EXIT_FAILURE); - } - -- if (!nfc_initiator_transceive_bytes(r.pdi, Auth, 4, Rx, &RxLen)) { -+ if (!nfc_initiator_transceive_bytes(r.pdi, Auth, 4, Rx, &RxLen, NULL)) { - fprintf(stdout, "Error while requesting plain tag-nonce\n"); - exit(EXIT_FAILURE); - } -diff -Nru mfoc-0.10.2/src//mifare.c mfoc/src//mifare.c ---- mfoc-0.10.2/src//mifare.c 2011-04-04 12:38:30.000000000 +0200 -+++ mfoc/src//mifare.c 2012-02-11 02:02:27.028185737 +0100 -@@ -100,7 +100,7 @@ - return false; - } - // Fire the mifare command -- if (!nfc_initiator_transceive_bytes (pnd, abtCmd, 2 + szParamLen, abtRx, &szRx)) { -+ if (!nfc_initiator_transceive_bytes (pnd, abtCmd, 2 + szParamLen, abtRx, &szRx, NULL)) { - if (pnd->iLastError == EINVRXFRAM) { - // "Invalid received frame" AKA EINVRXFRAM, usual means we are - // authenticated on a sector but the requested MIFARE cmd (read, write) -diff -Nru mfoc-0.10.2/src//nfc-utils.c mfoc/src//nfc-utils.c ---- mfoc-0.10.2/src//nfc-utils.c 2011-04-04 12:01:33.000000000 +0200 -+++ mfoc/src//nfc-utils.c 2012-02-11 02:02:27.028185737 +0100 -@@ -608,6 +608,51 @@ - } - - void -+print_nfc_iso14443bi_info (const nfc_iso14443bi_info_t nii, bool verbose) -+{ -+ printf (" DIV: "); -+ print_hex (nii.abtDIV, 4); -+ if (verbose) { -+ int version = (nii.btVerLog & 0x1e)>>1; -+ printf (" Software Version: "); -+ if (version == 15) { -+ printf ("Undefined\n"); -+ } else { -+ printf ("%i\n", version); -+ } -+ -+ if ((nii.btVerLog & 0x80) && (nii.btConfig & 0x80)){ -+ printf (" Wait Enable: yes"); -+ } -+ } -+ if ((nii.btVerLog & 0x80) && (nii.btConfig & 0x40)) { -+ printf (" ATS: "); -+ print_hex (nii.abtAtr, nii.szAtrLen); -+ } -+} -+ -+void -+print_nfc_iso14443b2sr_info (const nfc_iso14443b2sr_info_t nsi, bool verbose) -+{ -+ (void) verbose; -+ printf (" UID: "); -+ print_hex (nsi.abtUID, 8); -+} -+ -+void -+print_nfc_iso14443b2ct_info (const nfc_iso14443b2ct_info_t nci, bool verbose) -+{ -+ (void) verbose; -+ uint32_t uid; -+ uid = (nci.abtUID[3] << 24) + (nci.abtUID[2] << 16) + (nci.abtUID[1] << 8) + nci.abtUID[0]; -+ printf (" UID: "); -+ print_hex (nci.abtUID, sizeof(nci.abtUID)); -+ printf (" UID (decimal): %010u\n", uid); -+ printf (" Product Code: %02X\n", nci.btProdCode); -+ printf (" Fab Code: %02X\n", nci.btFabCode); -+} -+ -+void - print_nfc_dep_info (const nfc_dep_info_t ndi, bool verbose) - { - (void) verbose; -@@ -651,8 +696,7 @@ - strcpy (pndd->pcDriver, strtok (buffer, ":")); - - // Port. -- pndd->pcPort = (char *) malloc (256); -- strcpy (pndd->pcPort, strtok (NULL, ":")); -+ strcpy (pndd->acPort, strtok (NULL, ":")); - - // Speed. - sscanf (strtok (NULL, ":"), "%u", &pndd->uiSpeed); -@@ -712,6 +756,18 @@ - printf ("ISO/IEC 14443-4B (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr)); - print_nfc_iso14443b_info (nt.nti.nbi, verbose); - break; -+ case NMT_ISO14443BI: -+ printf ("ISO/IEC 14443-4B' (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr)); -+ print_nfc_iso14443bi_info (nt.nti.nii, verbose); -+ break; -+ case NMT_ISO14443B2SR: -+ printf ("ISO/IEC 14443-2B ST SRx (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr)); -+ print_nfc_iso14443b2sr_info (nt.nti.nsi, verbose); -+ break; -+ case NMT_ISO14443B2CT: -+ printf ("ISO/IEC 14443-2B ASK CTx (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr)); -+ print_nfc_iso14443b2ct_info (nt.nti.nci, verbose); -+ break; - case NMT_DEP: - printf ("D.E.P. (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr)); - print_nfc_dep_info (nt.nti.ndi, verbose); diff --git a/net-wireless/mfoc/mfoc-0.10.2.ebuild b/net-wireless/mfoc/mfoc-0.10.2.ebuild deleted file mode 100644 index e5cfe04e..00000000 --- a/net-wireless/mfoc/mfoc-0.10.2.ebuild +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 1999-2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -EAPI=3 - -inherit eutils autotools - -DESCRIPTION="Mifare Classic Offline Cracker" -HOMEPAGE="https://code.google.com/p/nfc-tools/wiki/mfoc" -SRC_URI="https://nfc-tools.googlecode.com/files/mfoc-0.10.2.tar.gz" - -LICENSE="GPL-3" -SLOT="0" -KEYWORDS="~amd64" -IUSE="" - -DEPEND="" -RDEPEND="${DEPEND}" - -src_prepare() { - epatch "${FILESDIR}"/${PN}-libnfc-1.5.1.patch || die - eautoreconf -} - -src_install() { - DESTDIR="${D}" emake install || die -} |