Git Product home page Git Product logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 26, 2024
Need to fix that part of the code. Right now it only HTML works.

Original comment by [email protected] on 12 Feb 2013 at 9:14

  • Changed state: Accepted

from theharvester.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 26, 2024
Need to fix that part of the code. Right now it only HTML works.

Original comment by [email protected] on 12 Feb 2013 at 9:14

from theharvester.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 26, 2024
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 [email protected] on 25 Sep 2013 at 8:39

from theharvester.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 26, 2024
file.write('<?xml version="1.0" encoding="UTF-8"?>\n')

Original comment by [email protected] on 25 Sep 2013 at 8:43

from theharvester.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 26, 2024
Minor typo, but should file.close not be file.close() ?

Original comment by [email protected] on 4 Jan 2014 at 11:40

from theharvester.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 26, 2024
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 [email protected] on 29 May 2014 at 2:35

from theharvester.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 26, 2024
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 [email protected] on 28 Aug 2014 at 11:11

Attachments:

from theharvester.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.