import os import numpy as np from atrcopy import SegmentData, KBootImage, add_xexboot_header, add_atr_header class TestKbootHeader(object): def setup(self): pass def check_size(self, data): xex_size = len(data) bytes = add_xexboot_header(data) # rawdata = SegmentData(bytes) # size = len(rawdata) # atr = KBootImage(rawdata) # newatr = atr.as_new_format("ATR") image_size = len(bytes) bytes = add_atr_header(bytes) rawdata = SegmentData(bytes) newatr = KBootImage(rawdata) image = newatr.bytes print image[0:16] paragraphs = image_size / 16 print newatr.header, paragraphs assert int(image[2:4].view(dtype='