mirror of
https://github.com/nfc-tools/mfcuk.git
synced 2025-12-23 18:50:06 +00:00
- Revert the fix from r52 so that MFCUK will compile with libnfc 1.5.1
- Revert the improvements to configure.ac script - Added an improved PM3 trace log parser which tries to find possible multi-sector authentication transactions
This commit is contained in:
parent
eaa9ff8f1a
commit
880db4e1b9
@ -21,12 +21,19 @@ AC_SUBST([PKG_CONFIG_REQUIRES])
|
|||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_HEADER_STDBOOL
|
AC_HEADER_STDBOOL
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
|
AC_TYPE_UINT16_T
|
||||||
AC_TYPE_UINT32_T
|
AC_TYPE_UINT32_T
|
||||||
AC_TYPE_UINT64_T
|
AC_TYPE_UINT64_T
|
||||||
|
AC_TYPE_UINT8_T
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_MALLOC
|
AC_FUNC_MALLOC
|
||||||
AC_FUNC_REALLOC
|
AC_FUNC_REALLOC
|
||||||
|
AC_CHECK_FUNCS([memset strchr])
|
||||||
|
|
||||||
|
# Help us to write great code ;-)
|
||||||
|
CFLAGS="$CFLAGS -Wall -pedantic -Wextra -std=c99"
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
src/Makefile])
|
src/Makefile])
|
||||||
|
|||||||
@ -100,14 +100,12 @@ nfc_initiator_mifare_cmd (nfc_device_t * pnd, const mifare_cmd mc, const uint8_t
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Fire the mifare command
|
// 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) {
|
if (pnd->iLastError == EINVRXFRAM) {
|
||||||
// "Invalid received frame" AKA EINVRXFRAM, usual means we are
|
// "Invalid received frame" AKA EINVRXFRAM, usual means we are
|
||||||
// authenticated on a sector but the requested MIFARE cmd (read, write)
|
// authenticated on a sector but the requested MIFARE cmd (read, write)
|
||||||
// is not permitted by current acces bytes;
|
// is not permitted by current acces bytes;
|
||||||
// So there is nothing to do here.
|
// So there is nothing to do here.
|
||||||
} else if (pnd->iLastError == EMFAUTH) {
|
|
||||||
// In MFOC, we have to hide authentication errors :)
|
|
||||||
} else {
|
} else {
|
||||||
nfc_perror (pnd, "nfc_initiator_transceive_bytes");
|
nfc_perror (pnd, "nfc_initiator_transceive_bytes");
|
||||||
}
|
}
|
||||||
|
|||||||
84
src/pm3_mfc_parser.py
Normal file
84
src/pm3_mfc_parser.py
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
# Original source: proxmark3.org community forum
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import string
|
||||||
|
import commands
|
||||||
|
|
||||||
|
def line_tag(line):
|
||||||
|
if string.find(line, 'TAG') > 0:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
def line_rdr(line):
|
||||||
|
if string.find(line, 'TAG') < 1:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
def line_bytes(line):
|
||||||
|
bytes = line[20:len(line)-1]
|
||||||
|
bytes = bytes.replace('crc', '')
|
||||||
|
bytes = bytes.replace('!', '')
|
||||||
|
bytes = bytes.replace(' ', '')
|
||||||
|
|
||||||
|
return len(bytes)/2
|
||||||
|
|
||||||
|
try:
|
||||||
|
file= open(sys.argv[1])
|
||||||
|
except:
|
||||||
|
print
|
||||||
|
print '\tusage:', sys.argv[0], '<proxmark3_snoop.log>'
|
||||||
|
print
|
||||||
|
sys.exit(True)
|
||||||
|
|
||||||
|
lines = file.readlines()
|
||||||
|
uid = ''
|
||||||
|
find_multi_sector = False
|
||||||
|
|
||||||
|
for i in range(len(lines)):
|
||||||
|
if string.find(lines[i],': 93 20') > 0 and line_tag(lines[i + 1]) and line_bytes(lines[i + 1]) == 5:
|
||||||
|
find_multi_sector = False
|
||||||
|
key = ''
|
||||||
|
|
||||||
|
uid = lines[i + 1][20:34]
|
||||||
|
uid = uid.replace(' ', '')
|
||||||
|
print 'Found TAG UID:', uid
|
||||||
|
|
||||||
|
if uid and (string.find(lines[i],': 60') > 0 or string.find(lines[i],': 61') > 0) and line_tag(lines[i + 1]) and line_bytes(lines[i + 1]) == 4 and line_rdr(lines[i + 2]) and line_bytes(lines[i + 2]) == 8 and line_tag(lines[i + 3]) and line_bytes(lines[i + 3]) == 4:
|
||||||
|
tag_challenge = lines[i+1][20:34]
|
||||||
|
tag_challenge = tag_challenge.replace(' ', '')
|
||||||
|
tag_challenge = tag_challenge.replace('!', '')
|
||||||
|
print 'Nt:', tag_challenge
|
||||||
|
|
||||||
|
reader_challenge_response = lines[i+2][20:50]
|
||||||
|
reader_challenge_response = reader_challenge_response.replace(' ', '')
|
||||||
|
reader_challenge_response = reader_challenge_response.replace('!', '')
|
||||||
|
print 'Nt\':', reader_challenge_response
|
||||||
|
|
||||||
|
tag_response = lines[i+3][20:34]
|
||||||
|
tag_response = tag_response.replace(' ', '')
|
||||||
|
tag_response = tag_response.replace('!', '')
|
||||||
|
print 'Nr:', tag_response
|
||||||
|
|
||||||
|
find_multi_sector = True
|
||||||
|
|
||||||
|
# Usually, a multi-sector authentication if a sequence of R->T 4 bytes (encrypted 60 xx p1 p2 or 61 xx p1 p2) and T->R 4 bytes
|
||||||
|
if find_multi_sector and line_rdr(lines[i]) and line_bytes(lines[i]) == 4 and string.find(lines[i],': 60') < 1 and string.find(lines[i],': 61') < 1 and line_tag(lines[i + 1]) and line_bytes(lines[i + 1]) == 4:
|
||||||
|
encr_multi_sect_auth = lines[i][20:34]
|
||||||
|
encr_multi_sect_auth = encr_multi_sect_auth.replace(' ', '')
|
||||||
|
encr_multi_sect_auth = encr_multi_sect_auth.replace('!', '')
|
||||||
|
#print 'Multi-sector AUTH (candidates):', encr_multi_sect_auth
|
||||||
|
|
||||||
|
encr_multi_sect_Nt = lines[i + 1][20:34]
|
||||||
|
encr_multi_sect_Nt = encr_multi_sect_Nt.replace(' ', '')
|
||||||
|
encr_multi_sect_Nt = encr_multi_sect_Nt.replace('!', '')
|
||||||
|
#print 'Multi-sector encrypted Nt (candidates):', encr_multi_sect_Nt
|
||||||
|
|
||||||
|
mfcuk_P_params = './mfcuk -P ' + '0x' + uid + ':' + '0x' + tag_challenge + ':' + '0x' + reader_challenge_response[0:8] + ':' + '0x' + reader_challenge_response[8:16] + ':' + '0x' + tag_response + ':' + '0x' + encr_multi_sect_auth
|
||||||
|
|
||||||
|
print 'Executing ', mfcuk_P_params
|
||||||
|
#os.execv('./mfcuk',string.split(mfcuk_P_params))
|
||||||
51
src/trace1.txt
Normal file
51
src/trace1.txt
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
+ 561882: 1 : 26
|
||||||
|
+ 64: 2 : TAG 04 00
|
||||||
|
+ 10217: 2 : 93 20
|
||||||
|
+ 64: 5 : TAG 9c 59 9b 32 6c
|
||||||
|
+ 12313: 9 : 93 70 9c 59 9b 32 6c 6b 30
|
||||||
|
+ 64: 3 : TAG 08 b6 dd
|
||||||
|
+ 923318: 4 : 60 00 f5 7b
|
||||||
|
+ 112: 4 : TAG 82 a4 16 6c
|
||||||
|
+ 6985: 8 : a1 e4! 58 ce! 6e ea! 41 e0! !crc
|
||||||
|
+ 64: 4 : TAG 5c! ad f4 39!
|
||||||
|
+ 811513: 4 : 8e 0e! 5d! b9 !crc
|
||||||
|
+ 112: 4 : TAG 5a! 92 0d! 85!
|
||||||
|
+ 6946: 8 : 98! d7 6b! 77 d6 c6 e8 70 !crc
|
||||||
|
+ 64: 4 : TAG ca 7e! 0b! 63!
|
||||||
|
+ 670868: 4 : 3e! 70 9c! 8a !crc
|
||||||
|
+ 112: 4 : TAG 36! 41 24! 79
|
||||||
|
+ 9505: 8 : 1b! 8c 3a! 48! 83 5a 4a! 27 !crc
|
||||||
|
+ 64: 4 : TAG 40! 6a! 99! 4b
|
||||||
|
+ 905612: 4 : c9 7c 64! 13! !crc
|
||||||
|
+ 112: 4 : TAG b5! ab! 1d! 2b
|
||||||
|
+ 6936: 8 : 7e! d2 5c! ca! 4b! 50! 88! c4 !crc
|
||||||
|
+ 64: 4 : TAG bf dd 01 be!
|
||||||
|
+ 987853: 4 : 56 98 49 d6! !crc
|
||||||
|
+ 72: 18 : TAG 09 bf! f5! f6! fc! b9! 5e! 51! 07 ac f6 72 f8 73 3b! 1b 73! ad! !crc
|
||||||
|
+ 94864: 4 : 5c! 7b 24! 02 !crc
|
||||||
|
+ 72: 18 : TAG a0 1f! 0b! b7 0d! ba c9 e7! fa! 36! 47 d2 a0! 01! 40! 87 ff 95! !crc
|
||||||
|
+ 94827: 4 : c9 90 dc! a3 !crc
|
||||||
|
+ 72: 18 : TAG df b8! 7a bc! 17! 99 82! 5c 55 d5! 98! 68 8b f8 e7 89 dc 42! !crc
|
||||||
|
+ 99081: 4 : 9f! d5 0f! d8! !crc
|
||||||
|
+ 72: 18 : TAG ca! 40 fa! 34 82 cc 3e de 1f! 7f f7! f0 62! 18! 77! 34 30 07 !crc
|
||||||
|
+ 93995: 4 : ad 7f! 3e 0c! !crc
|
||||||
|
+ 72: 18 : TAG f4! 2b 17! 4c a2! 5a 0c! a0! d8 03! 05 cc cc 4c 1f 12! 0c! 78! !crc
|
||||||
|
+ 94857: 4 : f1! b4 f0 3b! !crc
|
||||||
|
+ 72: 18 : TAG 8f da ca 17! 42 8e 24 c9! 8e fb! 38! aa! 39 e2! dd dd! a8 a6 !crc
|
||||||
|
+ 94850: 4 : c4 03! 7b! 9a !crc
|
||||||
|
+ 72: 18 : TAG 9f! 42! 42 49! cd d1! 3d! fd 8e 8f d3 8d! d5! ca! ef! 15 84 c9! !crc
|
||||||
|
+ 93961: 4 : 33! 3b! ae 0a! !crc
|
||||||
|
+ 72: 18 : TAG 74 ed! 58 46! e7 cc 48 d1! 5a 4b b0! 3a! c1 79! 8a! bf! e7! 42 !crc
|
||||||
|
+ 93193: 4 : f6 ec! 36 91! !crc
|
||||||
|
+ 72: 18 : TAG 79! 63 89! 21! 24 1e 3e! 03! a8! c3! 9b 95! a1 ad! 6c! 34 52 94 !crc
|
||||||
|
+ 94866: 4 : ad! 5c! 47 c5! !crc
|
||||||
|
+ 72: 18 : TAG 68 d4 9d c2! 2b 18 46! f7 e8! 28 ea 03 a4 df d5! 9f 23 00! !crc
|
||||||
|
+ 93994: 4 : 41 4c! 40! 11 !crc
|
||||||
|
+ 72: 18 : TAG b1 95 17! 84! ac fc! 31 b8! 02 40 97! ec! 4c 19 6f e9 f0! 8c! !crc
|
||||||
|
+ 94818: 4 : b8! b5! 5c! 74! !crc
|
||||||
|
+ 72: 18 : TAG c6 03 b9 92! 7d! eb! 13 8a 56 b7 9c 7c 07 3d! 6a 95! 7e! 44 !crc
|
||||||
|
|
||||||
|
# http://www.proxmark.org/forum/post/550/#p550
|
||||||
|
# UID = 0x9c599b32
|
||||||
|
# KEY = 0xffffffffffff
|
||||||
|
# 0x9c599b32 0x82a4166c 0xa1e458ce 0x6eea41e0 0x5cadf439
|
||||||
Loading…
x
Reference in New Issue
Block a user