github敏感資訊洩露
阿新 • • 發佈:2018-12-18
轉自https://www.waitalone.cn 下載李姐姐得兩個解碼包,李姐姐0.0
#獲取解壓包 ,還需要index檔案 #應該是編碼得問題,此檔案不支援中文,請把中文文字刪除 import os import zlib import re from lib.parser import parse result_dir = 'decoder'#jieguobaocunwenjian if not os.path.exists(result_dir): os.mkdir(result_dir) for entry in parse('index'): if "sha1" in entry.keys(): #read sha1 shal=entry["sha1"].strip() #read filename filename=entry["name"].strip() #jon savepath savename=os.path.join(result_dir,filename).replace('\\','/') #if savepath size >0 alse in else save if os.path.exists(savename) and os.path.getsize(savename)>0: print u'%s wenjiancunzaitiaoguo' % savename continue #Get folder collection #root yijimulu ,dirs erjimulu,files san ji wenjian jia # import os # # for root, dirs, files in os.walk('/opt/'): # print root # 當前遍歷到的目錄的根 # print dirs # 當前遍歷到的目錄的根下的所有目錄 # print files # 當前遍歷到的目錄的根下的所有檔案 # 這是目錄遍歷 for root,dirs,files in os.walk('./objects/'): for name in files: #for name in files: filepath=os.path.join(root,name).replace('\\','/') if shal[2:] in filepath: try: data=zlib.decompress(open(filepath).read()) data=re.sub('blob \d+\00','',data) except zlib.error: #print u'File %s decode error'%filename pass else: print u' file %sjiemachenggong zhengzai baocun!'% filename savepath=os.path.join(result_dir,os.path.dirname(filename)).replace('\\','/') if not os.path.exists(savepath): os.mkdirs(savepath) with open(savename,'wb') as sfile: sfile. write(data) sfile.flush(); sfile.close()