def _decode(self, data): try: unzipped = lzma.decompress(data) child = Layer() child.raw_data = unzipped child.parent = self.layer self.layer.add_extracted_layer(child) self.layer.headers = [{'length': len(unzipped)}] self.layer.lines = utils.to_hex_lines(unzipped) except: raise ValueError("[Phorcys] Failed to parse input. Not lzma")
def _complete_leaves(self): for leaf in self.top_layer.leaves: if leaf.parent is not None and leaf.parent.name == 'base64' and len(leaf.name) == 0: leaf.parent.name = 'text' leaf.parent.human_readable = True leaf.parent.raw_data = ''.join(leaf.parent.lines) leaf.parent.del_extracted_layer(leaf) continue if len(leaf.lines) == 0: try: leaf.lines = utils.to_hex_lines(bytes(leaf.raw_data)) leaf.name = 'raw' except Exception as e: pass