logo

eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Unnamed repository; edit this file 'description' to name the repository.
commit: e7b0fe83ce6f56f0c4838c7ed3c8d5d091170666
parent 0bddfbe890b7f1bde6491c276bf66c9db26ab498
Author: LinuxMercedes <LinuxMercedes@gmail.com>
Date:   Tue, 11 Dec 2018 14:46:28 -0600

Merge pull request #473 from hfutxqd/eeeeeeeeeeeeeeeeeeeeeeee

 add python scripts to convert any files to eE files and convert back.

Diffstat:

A2E.py27+++++++++++++++++++++++++++
AE2.py30++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/2E.py b/2E.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3.7 + +import sys + + +if len(sys.argv) is not 3: + print('usage : 2E.py [input file] [output file]') + exit(-1) + +inFile = open(sys.argv[1], mode='rb') +outFile = open(sys.argv[2], mode='w') + +for buffer in iter(lambda: inFile.read(1), b''): + binStr = bin(int(buffer.hex(), base=16))[2:].zfill(8) + for c in binStr: + if c == '1': + outFile.write('E') + elif c == '0': + outFile.write('e') + else: + print('error!') + exit(-1) + + +inFile.close() +outFile.close()+ \ No newline at end of file diff --git a/E2.py b/E2.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3.7 + +import sys +import struct +from array import * + +if len(sys.argv) is not 3: + print('usage : E2.py [input file] [output file]') + exit(-1) + +inFile = open(sys.argv[1], mode='rb') +outFile = open(sys.argv[2], mode='wb') + +for buffer in iter(lambda: inFile.read(8), b''): + bin_array = array('B') + bin_str = '' + for c in buffer: + if c == ord('E'): + bin_str += '1' + elif c == ord('e'): + bin_str += '0' + else: + print('error!') + exit(-1) + bin_array.append(int(bin_str, base=2)) + bin_array.tofile(outFile) + +inFile.close() +outFile.close()+ \ No newline at end of file