<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Wangolo Joel</title>
    <description>The latest articles on DEV Community by Wangolo Joel (@wangoloj).</description>
    <link>https://dev.to/wangoloj</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F306600%2Fcd68e64d-d843-4145-981a-268d409bbc3b.jpeg</url>
      <title>DEV Community: Wangolo Joel</title>
      <link>https://dev.to/wangoloj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wangoloj"/>
    <language>en</language>
    <item>
      <title>Using theharvester OSINT tool in python scripts</title>
      <dc:creator>Wangolo Joel</dc:creator>
      <pubDate>Thu, 02 Jan 2020 18:06:31 +0000</pubDate>
      <link>https://dev.to/wangoloj/using-theharvester-osint-tool-in-python-scripts-181k</link>
      <guid>https://dev.to/wangoloj/using-theharvester-osint-tool-in-python-scripts-181k</guid>
      <description>&lt;h1&gt;
  
  
  theHarvester
&lt;/h1&gt;

&lt;p&gt;is a very simple, yet effective tool designed to be used in the early stages of a penetration test. It can be used for open source intelligence gathering and helping to determine a company's external threat landscape on the internet.&lt;/p&gt;

&lt;p&gt;With this tool you can scrounge the following information from the internet&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.nmmapper.com/kalitools/theharvester/email-harvester-tool/online/"&gt;E-mails&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.nmmapper.com/sys/tools/subdomainfinder/"&gt;Subdomains&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Social names&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.nmmapper.com/st/networkmapper/nmap/online-port-scanning/"&gt;Portscanner&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installing theHarvester
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;pip3 &lt;span class="nb"&gt;install &lt;/span&gt;theHarvester
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;or you can perform the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;python3-pip
&lt;span class="nb"&gt;sudo &lt;/span&gt;pip3 &lt;span class="nb"&gt;install &lt;/span&gt;virtualenv 

&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# Create virtualenv&lt;/span&gt;

virtualenv venv 

&lt;span class="c"&gt;# Or create a python version specific virtualenv&lt;/span&gt;

virtualenv &lt;span class="nt"&gt;-p&lt;/span&gt; python3 myenv
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# Now clone the git repo&lt;/span&gt;
git clone https://github.com/laramies/theHarvester.git
&lt;span class="c"&gt;#&lt;/span&gt;
pip3 &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# Wait until the installation is done.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Using it in your python scripts
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;theHarvester&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;theHarvester.discovery&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;bingsearch&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;theHarvester.discovery&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;googlesearch&lt;/span&gt;

&lt;span class="c1"&gt;#....and more....
# or
# from theHarvester.discovery import *
&lt;/span&gt;
&lt;span class="n"&gt;baidu&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;baidusearch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SearchBaidu&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"nmmapper.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;baidu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;do_search&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Each discovery engine has it's own method
# not all have get_emails
&lt;/span&gt;
&lt;span class="n"&gt;emails&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;baidu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_emails&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;hostnames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;baidu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_hostnames&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;# That's how you can use theHarvester in any other python3 module
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This tool is very powerful. And among it's most powerful public sources includes googlesearch, though google blocks the IP making the request if the request is made several times. Currently they are working on a solution to google blocking.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/laramies/theHarvester"&gt;https://github.com/laramies/theHarvester&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.nmmapper.com/kalitools/theharvester/email-harvester-tool/online/"&gt;https://www.nmmapper.com/kalitools/theharvester/email-harvester-tool/online/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
