diff -ru metagoofil/metagoofil.py metagoofil.new/metagoofil.py --- metagoofil/metagoofil.py 2010-08-15 20:38:09.000000000 +0200 +++ metagoofil.new/metagoofil.py 2010-08-15 20:23:17.000000000 +0200 @@ -48,7 +48,7 @@ #Mac address extractor# def get_mac(file,dir): - filename=dir+"/"+file + filename=str(dir)+"/"+str(file) line=open(filename,'r') res="" for l in line: @@ -66,7 +66,7 @@ def get_pdf_meta(file,dir): from pyPdf import PdfFileReader - filename=dir+"/"+file + filename=str(dir)+"/"+str(file) a='' try: input1 = pyPdf.PdfFileReader(file(filename, "rb")) @@ -76,12 +76,12 @@ return a,a def get_info_pdf(file,dir): - filename=dir+"/"+file + filename=str(dir)+"/"+str(file) line=open(filename,'r') res="" for l in line: res+=l - arex=re.compile('xap:Author=.* ') + arex=re.compile('xap:Author=.* ') getter=arex.findall(res) if getter==[]: aut3='' @@ -92,7 +92,7 @@ aut3=aut3.replace("'","") pat="" return aut3,pat - rex=re.compile('xmpmeta') + rex=re.compile('xmpmeta') getter=rex.findall(res) if getter==[]: meta='' @@ -147,7 +147,7 @@ def howmany(w): h = httplib.HTTP('www.google.com') - h.putrequest('GET',"/search?num=100&start=0+hl=en&btnG=B%C3%BAsqueda+en+Google&meta=&q=site%3A"+w+"+filetype%3A"+file) + h.putrequest('GET',"/search?num=100&start=0+hl=en&btnG=B%C3%BAsqueda+en+Google&meta=&q=site%3A"+str(w)+"+filetype%3A"+str(file)) h.putheader('Host', 'www.google.com') h.putheader('User-agent', 'Internet Explorer 6.0 ') h.endheaders() @@ -176,7 +176,7 @@ def run(w,i): res = [] h = httplib.HTTP('www.google.com') - h.putrequest('GET',"/search?num=20&start="+str(i)+"&hl=en&btnG=B%C3%BAsqueda+en+Google&meta=&q=site%3A"+w+"+filetype%3A"+file) + h.putrequest('GET',"/search?num=20&start="+str(i)+"&hl=en&btnG=B%C3%BAsqueda+en+Google&meta=&q=site%3A"+str(w)+"+filetype%3A"+str(file)) h.putheader('Host', 'www.google.com') h.putheader('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6') h.endheaders() @@ -230,8 +230,8 @@ date= time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) fil.write("<style type=\"text\/css\"><!--BODY{font-family:sans-serif;}--></style>") fil.write("<center><b>Meta<font color=\"#0000cc\">G</font><font color=\"#ff0000\">o</font><font color=\"#ffff00\">o</font>fil</b> results page for:</center>") - fil.write("<center><b>"+word+"</b></center>") - fil.write("<center>"+date+"</center>") + fil.write("<center><b>"+str(word)+"</b></center>") + fil.write("<center>"+str(date)+"</center>") fil.write("<center><a href=\"http://www.edge-security.com\">By Edge-Security</a></center>") fil.write("<hr>") fil.write('<a href="#users">Results: Go directly to resuls.</a>') @@ -239,7 +239,7 @@ pathos=[] for fi in all: file = fi - print "[+] Searching in " + word + " for: " + file + print "[+] Searching in " + str(word) + " for: " + str(file) total = int(howmany(word)) print "[+] Total results in google: "+ str(total) if total == 0: @@ -247,7 +247,7 @@ else: cant = 0 fil.write("<hr>") - fil.write("<strong><u>Searching in " + word + " for: " + file+" files.</u></strong><br><br>") + fil.write("<strong><u>Searching in " + str(word) + " for: " + str(file) +" files.</u></strong><br><br>") if total < limit: limit=total print "[+] Limit: ",int(limit) @@ -265,14 +265,14 @@ fil.write("<strong>Total available files: "+str(total)+" </strong><br>") t=0 if os.path.exists(dir): - print "[+] Directory "+ dir + " already exist, reusing it" + print "[+] Directory "+ str(dir) + " already exist, reusing it" else: os.mkdir(dir) cantidad_todo=len(result) contador=0 for x in result: contador+=1 - fil.write(x+"<br>") + fil.write(str(x)+"<br>") try: if down == "a" : np = 0 @@ -282,7 +282,7 @@ filename=res[leng-1] try: print "\t[ "+str(contador)+"/"+str(cantidad_todo)+" ] "+ x - if os.path.exists(dir+'/'+filename): + if os.path.exists(str(dir)+'/'+str(filename)): pass else: urllib.urlretrieve(x,str(dir)+"/"+str(filename)) @@ -290,9 +290,9 @@ print "Can't download" np = 1 if np == 0: - fil.write("<br>Local copy " + "<a href=\""+dir+"/"+filename+'\">Open</a>') + fil.write("<br>Local copy " + "<a href=\""+str(dir)+"/"+str(filename)+'\">Open</a>') fil.write("<br><br>Important metadata:") - command = extcommand +' '+ dir +'/'+'"'+filename+'"' + command = extcommand +' '+ str(dir) +'/'+'"'+str(filename)+'"' try: stdin,stderr = os.popen4(command) except: @@ -378,7 +378,7 @@ fil.write('</pre>') fil.write('<hr>') else: - print "Can't Download "+ x + print "Can't Download "+ str(x) fil.write("<br>Local copy, failed download :(\n") fil.write('<hr>') else: @@ -387,7 +387,7 @@ print "Process Interrupted by user\n" sys.exit() t+=1 - fil.write("<strong>Total results for "+fi+": "+ str(t)+ "</strong><br>") + fil.write("<strong>Total results for "+str(fi)+": "+ str(t)+ "</strong><br>") fil.write('<hr>') fil.write('<a name="users">') fil.write('<br>') @@ -417,7 +417,7 @@ if x.count('.'): pass else: - temp=temp+x+"\\" + temp=str(temp)+str(x)+"\\" if paty.count(temp): pass else: