Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/usr/bin/python
  2. # Original source: proxmark3.org community forum
  3. import sys
  4. import os
  5. import string
  6. import commands
  7. def line_tag(line):
  8. if string.find(line, 'TAG') > 0:
  9. return True
  10. return False
  11. def line_rdr(line):
  12. if string.find(line, 'TAG') < 1:
  13. return True
  14. return False
  15. def line_bytes(line):
  16. bytes = line[20:len(line)-1]
  17. bytes = bytes.replace('crc', '')
  18. bytes = bytes.replace('!', '')
  19. bytes = bytes.replace(' ', '')
  20. return len(bytes)/2
  21. try:
  22. file= open(sys.argv[1])
  23. except:
  24. print
  25. print '\tusage:', sys.argv[0], '<proxmark3_snoop.log>'
  26. print
  27. sys.exit(True)
  28. lines = file.readlines()
  29. uid = ''
  30. find_multi_sector = False
  31. for i in range(len(lines)):
  32. if string.find(lines[i],': 93 20') > 0 and line_tag(lines[i + 1]) and line_bytes(lines[i + 1]) == 5:
  33. find_multi_sector = False
  34. key = ''
  35. uid = lines[i + 1][20:34]
  36. uid = uid.replace(' ', '')
  37. print 'Found TAG UID:', uid
  38. 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:
  39. tag_challenge = lines[i+1][20:34]
  40. tag_challenge = tag_challenge.replace(' ', '')
  41. tag_challenge = tag_challenge.replace('!', '')
  42. print 'Nt:', tag_challenge
  43. reader_challenge_response = lines[i+2][20:50]
  44. reader_challenge_response = reader_challenge_response.replace(' ', '')
  45. reader_challenge_response = reader_challenge_response.replace('!', '')
  46. print 'Nt\':', reader_challenge_response
  47. tag_response = lines[i+3][20:34]
  48. tag_response = tag_response.replace(' ', '')
  49. tag_response = tag_response.replace('!', '')
  50. print 'Nr:', tag_response
  51. find_multi_sector = True
  52. # 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
  53. 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:
  54. encr_multi_sect_auth = lines[i][20:34]
  55. encr_multi_sect_auth = encr_multi_sect_auth.replace(' ', '')
  56. encr_multi_sect_auth = encr_multi_sect_auth.replace('!', '')
  57. #print 'Multi-sector AUTH (candidates):', encr_multi_sect_auth
  58. encr_multi_sect_Nt = lines[i + 1][20:34]
  59. encr_multi_sect_Nt = encr_multi_sect_Nt.replace(' ', '')
  60. encr_multi_sect_Nt = encr_multi_sect_Nt.replace('!', '')
  61. #print 'Multi-sector encrypted Nt (candidates):', encr_multi_sect_Nt
  62. 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
  63. print 'Executing ', mfcuk_P_params
  64. #os.execv('./mfcuk',string.split(mfcuk_P_params))