]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/python | |
2 | ||
3 | ''' | |
4 | # Andrei Costin <zveriu@gmail.com>, 2011 | |
5 | # pm3_eml2mfd.py | |
6 | # Converts PM3 Mifare Classic emulator EML text file to MFD binary dump file | |
7 | ''' | |
8 | ||
9 | import sys | |
10 | import binascii | |
11 | ||
12 | def main(argv): | |
13 | argc = len(argv) | |
14 | if argc < 3: | |
15 | print 'Usage:', argv[0], 'input.eml output.mfd' | |
16 | sys.exit(1) | |
17 | ||
18 | try: | |
19 | file_inp = open(argv[1], "r") | |
20 | file_out = open(argv[2], "wb") | |
21 | line = file_inp.readline() | |
22 | while line: | |
23 | line = line.rstrip('\n') | |
24 | line = line.rstrip('\r') | |
25 | print line | |
26 | data = binascii.unhexlify(line) | |
27 | file_out.write(data) | |
28 | line = file_inp.readline() | |
29 | ||
30 | finally: | |
31 | file_inp.close() | |
32 | file_out.close() | |
33 | ||
34 | main(sys.argv) |