示例#1
0
文件: libxdc.py 项目: LaGvidilo/HashX
def __organic__():
	SIGN,DT = [],[]
	xdc = libx1.find_files("*.xdc")
	p= Pool(5)
	if os.path.exists("xdc") == False: os.mkdir('xdc')
	xdc.append("///END")
	if xdc[0] == "*.xdc":
		print ("Erreur: Aucun fichier.")
	else:	
		Error_F=0
		n,e=0,len(xdc)
		while n<e:
			
			if Error_F==0:
				if xdc[n]=="///END":
					Error_F=1
					n=e
				else:
					print ("Lecture des signatures de '"+xdc[n]+"' en cours...")
					SIGN,DT = libx1.read_dico_hash_data(xdc[n])
					os.remove(xdc[n])
					tmp_z =p.map(f4, SIGN)
					n1=0
					while n1<len(SIGN):
						tmp="".join(tmp_z[n1])
						a,b,c,d,e,f,g,h,i = tmp[0:][:2].encode('hex'),tmp[2:][:2].encode('hex'),tmp[4:][:2].encode('hex'),tmp[6:][:2].encode('hex'),tmp[8:][:2].encode('hex'),tmp[10:][:2].encode('hex'),tmp[12:][:2].encode('hex'),tmp[14:][:2].encode('hex'),tmp[16:][:2].encode('hex')
						#a,b,c,d = str(ord(a[:1]))+"-"+str(ord(a[1:])),str(ord(b[:1]))+"-"+str(ord(b[1:])),str(ord(c[:1]))+"-"+str(ord(c[1:])),str(ord(d[:1]))+"-"+str(ord(d[1:]))
						#e,f,g,h = str(ord(e[:1]))+"-"+str(ord(e[1:])),str(ord(f[:1]))+"-"+str(ord(f[1:])),str(ord(g[:1]))+"-"+str(ord(g[1:])),str(ord(h[:1]))+"-"+str(ord(h[1:]))
						if os.path.exists("xdc/"+a)==False: os.mkdir("xdc/"+a)
						if os.path.exists("xdc/"+a+"/"+b)==False: os.mkdir("xdc/"+a+"/"+b)
						if os.path.exists("xdc/"+a+"/"+b+"/"+c)==False: os.mkdir("xdc/"+a+"/"+b+"/"+c)
						if os.path.exists("xdc/"+a+"/"+b+"/"+c+"/"+d)==False: os.mkdir("xdc/"+a+"/"+b+"/"+c+"/"+d)
						if os.path.exists("xdc/"+a+"/"+b+"/"+c+"/"+d+"/"+e)==False: os.mkdir("xdc/"+a+"/"+b+"/"+c+"/"+d+"/"+e)
						if os.path.exists("xdc/"+a+"/"+b+"/"+c+"/"+d+"/"+e+"/"+f)==False: os.mkdir("xdc/"+a+"/"+b+"/"+c+"/"+d+"/"+e+"/"+f)
						if os.path.exists("xdc/"+a+"/"+b+"/"+c+"/"+d+"/"+e+"/"+f+"/"+g)==False: os.mkdir("xdc/"+a+"/"+b+"/"+c+"/"+d+"/"+e+"/"+f+"/"+g)
						tmp1 = "xdc/"+a+"/"+b+"/"+c+"/"+d+"/"+e+"/"+f+"/"+g+".xdc"
						t_mp=""
						if os.path.exists(tmp1):
							t_mp=libx1.find_data(SIGN[n1])
						if t_mp=="":
							f=open(tmp1,'append')
							f.write(SIGN[n1]+DT[n1])
							f.close()
						else:
							print ("La signature existe deja!")
						print (tmp.encode('hex'),' - ',tmp1, "-", libx1.prcnt(n1,len(SIGN),5))
						n1=n1+1
					n=n+1
示例#2
0
文件: libxdc.py 项目: LaGvidilo/HashX
def __make_orga_dico__():
	SIGN,SIGN_VAL,DT = [],[],[]
	xdc = libx1.find_files("*.xdc")
	p= Pool(5)
	if xdc[0] == "*.xdc":
		print ("Erreur: Aucun fichier.")
	else:	
		n,e=0,len(xdc)
		while n<e:
			print ("Lecture des signatures de '"+xdc[n]+"' en cours...")
			SIGN,DT = libx1.read_dico_hash_data(xdc[n])
			SIGN_VAL = p.map(f2, SIGN)		
			SIGN_VAL,SIGN,DT=tri_insertion_val(SIGN_VAL,SIGN,DT)
			os.remove(xdc[n])
			libx1.write_file_dico(xdc[n],SIGN,DT)
			n=n+1
示例#3
0
				dta,dico="",""
				print (">>hash")
				libx1.write_file_hash(fichier+".x1",sign,eS)
				os.remove(fichier+".x1")
				sign,eS="",""
				print ("Compression terminée.")
			dta=[]
		if mode=="decompr":
			if fichier[len(fichier)-3:]==".gz":
				libx1._x1_decompress_gzip_(fichier)
			dico=fichier+".xdc"
			var.act=2
			tmp=[]

			sign = libx1.read_block_hash(fichier)
			sign_dico,dta_dico = libx1.read_dico_hash_data(dico)
			e=len(sign)
			n=0

			p = Pool(5)
			btmp=p.map(f2, dta_dico)
			print
			libx1.write_file_data(fichier[:len(fichier)-3],btmp,eS)
			var.act=0
			print ("\nDecompression terminée.")
		mode=var.mode
		eS=0
		dta=[]
		sign=[]
		dta_dico=[]
		sign_dico=[]