def extract_password(fhandle): fpos = 8568 fhandle.seek(fpos) chunk = fhandle.read(sys.getsizeof(fhandle)) # Decompress chunk result, window = lzs.LZSDecompress(chunk) print_status('Decompressed chunk: {0}'.format(result)) # Extract plaintext password res = re.findall(b'([\040-\176]{5,})', result) return res[0]
def extract_password(fhandle): fpos = 8568 fend = 8788 chunk = "*" amount = 221 fhandle.seek(fpos) while fpos < fend: if fend - fpos < amount: amount = fend - fpos chunk = fhandle.read(amount) fpos += len(chunk) # Decompress chunk result, window = lzs.LZSDecompress(chunk) print_status('Decompressed chunk: {0}'.format(result)) # Extract plaintext password res = re.findall(b'([\040-\176]{5,})', result) return res[0]