
Artículo · Pentesting
Determinando el panorama de amenazas con Theharvester
¿Qué es theHarvester?
TheHarvester es una herramienta muy simple y eficaz, diseñada para ser utilizada a principios de una prueba de penetración. Usado para la recopilación de inteligencia de código abierto y ayuda. para determinar el panorama de amenazas externas de una empresa en internet. La herramienta recoge correos electrónicos, nombres, subdominios, IP y URL que utilizan múltiples fuentes de datos públicas que incluyen:
Ataque pasivo:
- baidu: Baidu search engine
- bing: Microsoft search engine - www.bing.com
- bingapi: Microsoft search engine, through the API (Requires API key, see below.)
- censys: Censys.io search engine
- crtsh: Comodo Certificate search - www.crt.sh
- cymon: Cymon.io search engine
- dogpile: Dogpile search engine - www.dogpile.com
- duckduckgo: DuckDuckGo search engine - www.duckduckgo.com
- google: Google search engine (Optional Google dorking.) - www.google.com
- googleCSE: Google custom search engine
- google-certificates: Google Certificate Transparency report
- hunter: Hunter search engine (Requires API key, see below.) - www.hunter.io
- intelx: Intelx search engine (Requires API key, see below.) - www.intelx.io
- linkedin: Google search engine, specific search for Linkedin users
- netcraft: Netcraft Data Mining
- pgp: PGP key server - mit.edu
- securityTrails: Security Trails search engine, the world's largest repository
- of historical DNS data (Requires API key, see below.) - www.securitytrails.com
- shodan: Shodan search engine, will search for ports and banners from discovered
- hosts - www.shodanhq.com
- threatcrowd: Open source threat intelligence - www.threatcrowd.org
- trello: Search trello boards (Uses Google search.)
- twitter: Twitter accounts related to a specific domain (Uses Google search.)
- vhost: Bing virtual hosts search
- virustotal: Virustotal.com domain search
- yahoo: Yahoo search engine
- all: currently a subset of all the most effective plugins
módulos que requiren de API key:
Agrega tus llaves en el archivo api-keys.yaml
- googleCSE: API key and CSE ID
- intelx: API key
- hunter: API key
- securityTrails: API key
- shodan: API key
DEPENDENCIAS:
- Python 3.6
- python3 -m pip install -r requirements.txt
Instalación:
Primero que todo vamos a instalar python 3.7.2 está disponible para instalar la última versión estable de la serie 3.7. Este artículo le ayudará a instalar Python 3.7.2 en el sistema operativo Ubuntu. Puedes visitar aquí para leer más sobre los lanzamientos de Python.
PASO 1 - PREREQUiSitoS
Utilice el siguiente comando para instalar los requisitos previos de Python antes de instalarlo.
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
PASO 2 - DESCARGAR PYTHON 3.7
Descarga Python usando el siguiente comando del sitio oficial de python. También puede descargar la última versión en lugar de lo especificado a continuación.
cd / usr / src
sudo wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
Ahora extrae el paquete descargado.
sudo tar xzf Python-3.7.2.tgz
PASO 3 - COMPILAR EL FUENTE DE PYTHON
Utilice el siguiente conjunto de comandos para compilar el código fuente de Python en su sistema usando altinstall.
cd Python-3.7.2
sudo ./configure --enable-optimizations
sudo make altinstall
hacer altinstall se utiliza para evitar la sustitución del archivo binario de python predeterminado
/ usr / bin / python.
PASO 4 - REVISAR LA VERSIÓN DE PYTHON
Verifique la última versión instalada de python usando el siguiente comando
python3.7 -V
Python-3.7.2
Instalación theHarvester
Para ello vamos al repositorio en github y solo debemos hacer un git clone
git clone https://github.com/laramies/theHarvester.git
A continuación
python3 -m pip install -r requirements.txt
ConfiguraCIÓN Modulos THEHARVESTER
-
googleCSE: API key and CSE ID: Pendiente
-
intelx: API key
-
hunter
-
securityTrails: API key
-
shodan: API key
hunter:
Hunter le permite encontrar direcciones de correo electrónico en segundos y conectarse con las personas que son importantes para su negocio.
Para hunter solo debemos ingresar al sitio web https://hunter.io/search y obtener un plan, casi en todas las aplicaciones tienen versiones free, en donde podemos probar y validar conceptos.
Generando la API de Hunter
securityTrails:
SecurityTrails ofrece poder acceder a un tesoro de ciberseguridad y obténer la información que no puedes encontrar en ningún otro lugar, información de dominio y DNS más actual con una potente API.
Para ello accedemos al sitio y activamos nuestra API KEY https://securitytrails.com/app/account
Configuración securitytrails
shodan:
Shodan tiene servidores ubicados en todo el mundo que rastrean Internet 24/7 para proporcionar la información más reciente sobre Internet. ¿Quién compra televisores inteligentes? ¿Qué países están construyendo la mayoría de los parques eólicos? ¿Qué empresas se ven afectadas por Heartbleed? Shodan proporciona las herramientas para responder preguntas a escala de Internet.
Configuración de Shodan
Configuración de Shodan
Luego vamos a editar nuestro archivo y agregamos nuestros token ya configurados:
$ vim api-keys.yaml
Configuración de las apis
Configuración de las apis
Una vez configurado podemos hacer una prueba:
deploy@bta-scan:~/theHarvester$ python3.7 theHarvester.py -h
*******************************************************************
* _ _ _ *
* | |_| |__ ___ /\ /\__ _ _ ____ _____ ___| |_ ___ _ __ *
* | __| _ \ / _ \ / /_/ / _` | '__\ \ / / _ \/ __| __/ _ \ '__| *
* | |_| | | | __/ / __ / (_| | | \ V / __/\__ \ || __/ | *
* \__|_| |_|\___| \/ /_/ \__,_|_| \_/ \___||___/\__\___|_| *
* *
* theHarvester 3.0.6 v260 *
* Coded by Christian Martorella *
* Edge-Security Research *
* cmartorella@edge-security.com *
* *
*******************************************************************
usage: theHarvester.py [-h] -d DOMAIN [-l LIMIT] [-S START] [-g]
[-p PORT_SCAN] [-s] [-v VIRTUAL_HOST] [-e DNS_SERVER]
[-t DNS_TLD] [-n DNS_LOOKUP] [-c] [-f FILENAME]
[-b SOURCE]
theHarvester is a open source intelligence gathering tool(OSINT) that is used
for recon
optional arguments:
-h, --help show this help message and exit
-d DOMAIN, --domain DOMAIN
company name or domain to search
-l LIMIT, --limit LIMIT
limit the number of search results, default=500
-S START, --start START
start with result number X, default=0
-g, --google-dork use Google Dorks for google search
-p PORT_SCAN, --port-scan PORT_SCAN
scan the detected hosts and check for Takeovers
(21,22,80,443,8080) default=False, params=True
-s, --shodan use Shodan to query discovered hosts
-v VIRTUAL_HOST, --virtual-host VIRTUAL_HOST
verify host name via DNS resolution and search for
virtual hosts params=basic, default=False
-e DNS_SERVER, --dns-server DNS_SERVER
DNS server to use for lookup
-t DNS_TLD, --dns-tld DNS_TLD
perform a DNS TLD expansion discovery, default False
-n DNS_LOOKUP, --dns-lookup DNS_LOOKUP
enable DNS server lookup, default=False, params=True
-c, --dns-brute perform a DNS brute force on the domain
-f FILENAME, --filename FILENAME
save the results to an HTML and/or XML file
-b SOURCE, --source SOURCE
source: baidu, bing, bingapi, censys, crtsh, cymon,
dogpile, duckduckgo, google, googleCSE, google-
certificates, google-profiles, hunter, intelx,
linkedin, netcraft, pgp, securityTrails, threatcrowd,
trello, twitter, vhost, virustotal, yahoo, all
Para hacer una prueba y exportar nuestro resultado:
python3.7 theHarvester.py -d url -b all -s -f test.html
¿Quieres aprender estas técnicas en profundidad?
Continúa tu ruta con Penetration Testing Student.

Escrito por
Felipe BarriosCEO at Backtrack Academy
I'm Felipe Barrios CEO of Backtrack Academy ethical hacking community. entrepreneur and developer ruby on rails, Ror became my preferred language, the basis of all my projects, I consider myself a proactive person and passionate about what he does. Currently working as a software developer in scuit, computer security lover I like to work on projects related to digital enterprise.



