From cd9201d7f8fbca78c840e35881e205488eb3eae7 Mon Sep 17 00:00:00 2001 From: Nzix Date: Thu, 18 Apr 2019 18:45:50 +0800 Subject: [PATCH] fit png format cover & empty meta data #14 --- ncmdump.py | 89 ++++++++++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 47 deletions(-) diff --git a/ncmdump.py b/ncmdump.py index 56662eb..923e4ed 100644 --- a/ncmdump.py +++ b/ncmdump.py @@ -5,18 +5,19 @@ Created on Sun Jul 15 01:05:58 2018 @author: Nzix """ -import binascii -import struct -import base64 -import json -import os +import binascii, struct +import base64, json +import os, traceback + from Crypto.Cipher import AES from Crypto.Util.strxor import strxor as XOR from mutagen import mp3, flac, id3 def dump(input_path, output_path = None, skip = True): - output_path = (lambda path, meta : os.path.splitext(path)[0] + '.' + meta['format']) if not output_path else output_path + output_path = (lambda path, meta: os.path.splitext(path)[0] + '.' + meta['format']) if not output_path else output_path + output_path = (lambda path, meta: path) if not callable(output_path) else output_path + core_key = binascii.a2b_hex('687A4852416D736F356B496E62617857') meta_key = binascii.a2b_hex('2331346C6A6B5F215C5D2630553C2728') unpad = lambda s : s[0:-(s[-1] if type(s[-1]) == int else ord(s[-1]))] @@ -52,13 +53,16 @@ def dump(input_path, output_path = None, skip = True): meta_length = f.read(4) meta_length = struct.unpack(' 1024 ** 2 * 16 else 'mp3'} # crc32 crc32 = f.read(4) @@ -68,7 +72,7 @@ def dump(input_path, output_path = None, skip = True): f.seek(5, 1) image_size = f.read(4) image_size = struct.unpack('