#!/usr/bin/env python3#GrimHacker# Iterate through the given directory and attempt to decrompress every file.# Useful when you have downloaded a git repository left accessible on a webserver.importzlibimportosimportargparsedefmain():parser=argparse.ArgumentParser()parser.add_argument("-f","--folder",help="folder with git objects",required=True)args=parser.parse_args()count=0forsubdir,dirs,filesinos.walk(args.folder):forfile_infiles:count+=1filename=os.path.join(subdir,file_)print("Decompressing '{}'".format(filename))withopen(filename,"rb")asf:withopen("{}.decompressed".format(filename),"wb")ash:try:content=f.read()decompressed=zlib.decompress(content)#print(decompressed)print("Writing '{}'".format(filename))h.write(decompressed)exceptExceptionase:print("[!] Error working on '{}'. {}".format(filename,e))ifcount==0:print("Didn't find any files...")if__name__=="__main__":main()
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.