2020-02-21 23:09:36 +08:00
|
|
|
#!/usr/bin/env python3
|
2011-09-01 17:03:20 +08:00
|
|
|
|
|
|
|
'''
|
|
|
|
# Andrei Costin <zveriu@gmail.com>, 2011
|
|
|
|
# pm3_eml2mfd.py
|
|
|
|
# Converts PM3 Mifare Classic emulator EML text file to MFD binary dump file
|
|
|
|
'''
|
|
|
|
|
2020-02-21 23:09:36 +08:00
|
|
|
|
2011-09-01 17:03:20 +08:00
|
|
|
import sys
|
|
|
|
import binascii
|
|
|
|
|
|
|
|
def main(argv):
|
|
|
|
argc = len(argv)
|
|
|
|
if argc < 3:
|
2020-02-21 23:09:36 +08:00
|
|
|
print('Usage:', argv[0], 'input.eml output.mfd')
|
2011-09-01 17:03:20 +08:00
|
|
|
sys.exit(1)
|
2018-01-10 02:17:21 +08:00
|
|
|
|
2020-02-21 23:09:36 +08:00
|
|
|
with open(argv[1], "r") as file_inp, open(argv[2], "wb") as file_out:
|
2012-06-22 20:02:19 +08:00
|
|
|
for line in file_inp:
|
|
|
|
line = line.rstrip('\n').rstrip('\r')
|
2020-02-21 23:09:36 +08:00
|
|
|
print(line)
|
2011-09-01 17:03:20 +08:00
|
|
|
data = binascii.unhexlify(line)
|
|
|
|
file_out.write(data)
|
|
|
|
|
2012-06-22 19:09:36 +08:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main(sys.argv)
|