Open GoogleCodeExporter opened 8 years ago
Need to fix that part of the code. Right now it only HTML works.
Original comment by laramies@gmail.com
on 12 Feb 2013 at 9:14
Need to fix that part of the code. Right now it only HTML works.
Original comment by laramies@gmail.com
on 12 Feb 2013 at 9:14
if filename!="":
try:
print "Saving file"
html = htmlExport.htmlExport(all_emails,full,vhost,dnsres,dnsrev,filename,word,shodanres,dnstldres)
save = html.writehtml()
filename = filename.split(".")[0]+".xml"
file = open(filename,'w')
file.write('<theHarvester>\n')
for x in all_emails:
file.write('<email>'+x+'</email>\n')
for x in all_hosts:
file.write('<host>'+x+'</host>\n')
for x in vhost:
file.write('<vhost>'+x+'</vhost>\n')
file.write('</theHarvester>\n')
file.close
sys.exit()
except Exception,e:
print e
print "Error creating the file"
Original comment by georgk...@gmail.com
on 25 Sep 2013 at 8:39
file.write('<?xml version="1.0" encoding="UTF-8"?>\n')
Original comment by georgk...@gmail.com
on 25 Sep 2013 at 8:43
Minor typo, but should file.close not be file.close() ?
Original comment by marcus.w...@loumiaconsulting.com
on 4 Jan 2014 at 11:40
The problem is that I can save the output in a HTML file if I search with
google but not with linkedin
ex:
theharvester -d target.com -f example.html -l 500 -b google --> IT WORKS!
theharvester -d target.com -f example2.html -l 200 -b linkedin --> DOESN'T WORKS
It doesn't generate any file and any output. (Last version.)
Thanks
Original comment by francesc...@gmail.com
on 29 May 2014 at 2:35
After the linkedin part runs its course it does a sys.exit() so it nevers makes
it to the xml formatting. I just commented that line out. I also made some
other adjustments to create the xml file. I created these variables underneath
the start function.
all_emails=[]
all_hosts=[]
people=[]
vhost=[]
then this is my code for the xml file creation.
if filename!="":
print "inside loop"
if "html" in filename:
try:
print "Saving HTML file"
html = htmlExport.htmlExport(all_emails,full,vhost,dnsres,dnsrev,filename,word,shodanres,dnstldres)
save = html.writehtml()
sys.exit()
except Exception,e:
print e
print "Error creating the file"
elif "xml" in filename:
print "SAVING XML FILE"
filename = filename.split(".")[0]+".xml"
file = open(filename,'w')
file.write('<?xml version="1.0" encoding="UTF-8"?>\n')
file.write('<theHarvester>')
#print people
if len(people) > 0:
for x in people:
file.write('<person>' + re.sub('[<>]','',x) + '</person>')
#print all_emails
if len(all_emails) > 0:
for x in all_emails:
file.write('<email>'+re.sub('[<>]','',x)+'</email>')
#print ip_and_hosts
if len(all_hosts) > 0:
for x in full_host.check():
host = x.split(':')
file.write('<hostname>'+re.sub('[<>]','',host[1]) + '<ip>'+host[0]+'</ip></hostname>')
if len(vhost) > 0:
for x in vhost:
file.write('<vhost>'+re.sub('[<>]','',x)+'</vhost>')
file.write('</theHarvester>')
file.close()
else:
print "File format not supported...Aborting Save"
I'm not a developer so there might be ways of doing this but it seemed to work
in all my tests. Good Luck!
Original comment by slimlar...@gmail.com
on 28 Aug 2014 at 11:11
Attachments:
Original issue reported on code.google.com by
saleem4u...@gmail.com
on 22 Feb 2012 at 4:26