Skip to content

Commit

Permalink
add theHarvester
Browse files Browse the repository at this point in the history
  • Loading branch information
Naboot42 committed Aug 4, 2023
1 parent 88af75d commit 3191d43
Showing 1 changed file with 42 additions and 30 deletions.
72 changes: 42 additions & 30 deletions secator/tasks/theHarvester.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
import os
import json
import os

import validators

from secator.decorators import task
from secator.definitions import (DELAY, PROXY, RATE_LIMIT, RETRIES, THREADS, TIMEOUT, PROXY, LIMIT, SCREENSHOT, OPT_NOT_SUPPORTED, TEMP_FOLDER)
from secator.definitions import (DELAY, LIMIT, OPT_NOT_SUPPORTED, PROXY,
RATE_LIMIT, RETRIES, SCREENSHOT, TEMP_FOLDER,
THREADS, TIMEOUT)
from secator.output_types import Ip, Subdomain, Url, UserAccount
from secator.tasks._categories import ReconUser
from secator.utils import get_file_timestamp
from secator.output_types import UserAccount


@task()
class theHarvester(ReconUser):
"""theHarvester is a simple to use, yet powerful tool designed to be used during the reconnaissance stage of a red
team assessment or penetration test."""
cmd = 'theHarvester '
"""theHarvester is a tool designed to be used during the reconnaissance stage."""
cmd = 'theHarvester'
file_flag = None
input_flag = '--domain'
json_flag = '--filename'
opt_prefix = '--'

opts = {
'source': {'type': str, 'short': 'b', 'help': 'bevigil, censys, fullhunt, securityTrails'},
}
}

opt_key_map = {
PROXY: 'proxies',
LIMIT: 'limit',
Expand All @@ -31,7 +35,7 @@ class theHarvester(ReconUser):
RETRIES: OPT_NOT_SUPPORTED,
TIMEOUT: OPT_NOT_SUPPORTED
}

@staticmethod
def on_start(self):
output_path = self.get_opt_value('output_path')
Expand All @@ -41,8 +45,8 @@ def on_start(self):
self.output_path = output_path
self.cmd = self.cmd.replace('--filename', f'--filename {self.output_path}')

def yielder(self):
prev = self.print_item_count
def yielder(self):
#prev = self.print_item_count
self.print_item_count = False
list(super().yielder())
if self.return_code != 0:
Expand All @@ -54,25 +58,33 @@ def yielder(self):
if self.print_orig: # original h8mail output
yield data
return
targets = data['hosts']
for target in targets:
email = target['target']
target_data = target['data']
if not len(target_data) > 0:
hosts = data.get('hosts', [])
#asns = data.get('asns', [])
interesting_urls = data.get('interesting_urls', [])
ips = data.get('ips', [])
emails = data.get('emails', [])
target = self.targets[0]

for ip in ips:
yield Ip(ip=ip, host=target)
for host in hosts:
parts = host.split(':')
if len(parts) == 1:
continue
entries = target_data[0]
for entry in entries:
source, site_name = tuple(entry.split(':'))
yield UserAccount(**{
"site_name": site_name,
"username": email.split('@')[0],
"email": email,
"extra_data": {
'source': source
},
})
if len(parts) > 2:
host = parts[0]
ip = ':'.join(parts[1:-1])
else:
host, ip = tuple(parts)
if validators.ip_address.ipv4(ip) or validators.ip_address.ipv6(ip):
yield Ip(ip=ip, host=host)
yield Subdomain(host=host, domain=target)
for interesting_url in interesting_urls:
yield Url(url=interesting_url)
for email in emails:
yield UserAccount(email=emails)


install_cmd = ('git clone https://github.com/laramies/theHarvester || True &&'
install_cmd = ('git clone https://github.com/laramies/theHarvester || True &&'
'cd theHarvester || python3 -m pip install -r requirements/base.txt')
socks5_proxy = True
socks5_proxy = True

0 comments on commit 3191d43

Please sign in to comment.