Created
          March 19, 2018 01:45 
        
      - 
      
- 
        Save NWPlayer123/d998d256a565c81aff4acd5731a6852a to your computer and use it in GitHub Desktop. 
    For bruteforce decompressing files that have multiple zlib chunks
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #Very slow, loads whole file into memory to try decompression | |
| from zlib import decompress | |
| import sys | |
| size = 0 | |
| with open(sys.argv[1], "rb") as f: | |
| compressed = f.read() | |
| total_size = f.tell() | |
| output = "" | |
| for i in range(total_size): | |
| try: #if it decompresses, we hit a block | |
| test = decompress(compressed[i:]) | |
| size += len(test) | |
| output += test #add it to the output | |
| except: | |
| pass | |
| print(size) | |
| name = sys.argv[1].split(".") | |
| name = name[:-1] + ["d"] + [name[-1]] | |
| with open(".".join(name), "wb") as o: | |
| o.write(output) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment