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
if state==999: data,state="".join(libx1.read_file_raw(dernier)),0 os.remove(dernier) if len(data.strip()) > 4: if state==0: dt=[] if len(data)>0: print "reception - " ,data.encode('hex') name_f=str(random.randint(0,1000000))+".x1" f=open(name_f,'append') f.write(data.strip()) f.close() n=16 while n<len(data.strip()): dt.append(libx1.find_data(data[n:][:16])) n=n+16 print (len(data.strip()),len("".join(dt)),'===') f=open(dirroot+name_f+".DTA",'append') dtmp="".join(dt) f.write(dtmp) f.close() eS=data[0:][:16] print ("ES:",eS.encode('hex')) print ("fichier: ",dirroot+name_f+".DTA") correct_es(dirroot+name_f+".DTA",eS) os.remove(name_f) print ("decompression terminee.") dernier = dirroot+name_f+".DTA" data,addr = UDPSock.recvfrom(16)