Merge pull request #77 from Proxmark/usb_check
[legacy-proxmark3.git] / client / pm3_mfd2eml.py
blob44d60e7d6ba6b4777ecbda8199fe29367829bbbb
1 #!/usr/bin/python
3 '''
4 # Andrei Costin <zveriu@gmail.com>, 2011
5 # pm3_eml2mfd.py
6 # Converts PM3 Mifare Classic MFD binary dump file to emulator EML text file
7 '''
9 from __future__ import with_statement
10 import sys
11 import binascii
13 READ_BLOCKSIZE = 16
15 def main(argv):
16 argc = len(argv)
17 if argc < 3:
18 print 'Usage:', argv[0], 'input.mfd output.eml'
19 sys.exit(1)
21 with file(argv[1], "rb") as file_inp, file(argv[2], "w") as file_out:
22 while True:
23 byte_s = file_inp.read(READ_BLOCKSIZE)
24 if not byte_s:
25 break
26 hex_char_repr = binascii.hexlify(byte_s)
27 file_out.write(hex_char_repr)
28 file_out.write("\n")
30 if __name__ == '__main__':
31 main(sys.argv)