Giter Club home page Giter Club logo

haktrails's Introduction

haktrails

haktrails is a Golang client for querying SecurityTrails API data, sponsored by SecurityTrails.

Tool Features

  • stdin input for easy tool chaining
  • subdomain discovery
  • associated root domain discovery
  • associated IP discovery
  • historical DNS data
  • historical whois data
  • DSL queries (currently a prototype)
  • company discovery (discover the owner of a domain)
  • whois (returns json whois data for a given domain)
  • ping (check that your current SecurityTrails configuration/key is working)
  • usage (check your current SecurityTrails usage)
  • "json" or "list" output options for easy tool chaining
  • "ZSH & Bash autocompletion"

Installation

You will need a SecurityTrails API key to use this tool. If you're using it for bug bounties, I'd recommend checking out the bug bounty hunter's toolkit if you're a bug bounty hunter. It provides access to the majority of data that you will need for a good price. See the details below.

Once you have an API key, install golang, then:

#Go version > 1.17
go install -v github.com/hakluke/haktrails@latest
~/go/bin/haktrails

# Go version < 1.17
# https://golang.org/doc/go-get-install-deprecation

go get github.com/hakluke/haktrails
~/go/bin/haktrails

I'd recommend adding ~/go/bin/ to your $PATH if you haven't already, then you can just run haktrails.

Autocompletion (optional)

ZSH and Bash autocompletion is available Just add this to your ~/.zshrc or ~/.bashrc

source ~/go/src/github.com/hakluke/haktrails/haktrails-completion.zsh
or
source ~/go/src/github.com/hakluke/haktrails/haktrails-completion.bash

NOTE: If you are using a custom GOPATH location, use it instead of the default one (which is ~/go)

Usage

Note

Note: In these examples, domains.txt is a list of root domains that you wish to gather data on. For example:

hakluke.com
bugcrowd.com
tesla.com
yahoo.com

Flags

  • The output type can be specified with -o json or -o list. List is the default. List is only compatiable with subdomains, associated domains and associated ips. All the other endpoints will return json regardless.
  • The number of threads can be set using -t <number>. This will determine how many domains can be processed at the same time. It's worth noting that the API has rate-limiting, so setting a really high thread count here will actually slow you down.
  • The config file location can be set with -c <file path>. The default location is ~/.config/haktools/haktrails-config.yml. A sample config file can be seen below.
  • The lookup type for historical DNS lookups can be set with -type <type>, available options are a,aaaa,mx,txt,ns,soa.
  • The DSL query can be set with -query <query>. See here for more details.

Config file

You will need to set up a configuration file with your SecurityTrails key to use this tool. By default, the tool will look for the file in ~/.config/haktools/haktrails-config.yml. If you wish to put the config file somewhere else, the location must be specified with the -c flag.

The format of the file is very simple, just copy paste this, and replace <yourkey> with your SecurityTrails API key:

securitytrails:
  key: <yourkey>

Warning

Warning: With this tool, it's very easy to burn through a lot of API credits. For example, if you have 10,000 domains in domains.txt, running cat domains.txt | haktrails subdomains will use all 10,000 credits. It's also worth noting that some functions (such as associated domains) will use multiple API requests, for example, echo "yahoo.com" | haktrails associateddomains would use about 20 API requests, because the data is paginated and yahoo.com has a lot of associated domains.

Gather subdomains

This will gather all subdomains of all the domains listed within domains.txt.

cat domains.txt | haktrails subdomains

Of course, a single domain can also be specified like this:

echo "yahoo.com" | haktrails subdomains

Gather associated domains

"Associated domains" is a loose term, but it is generally just domains that are owned by the same company. This will gather all associated domains for every domain in domains.txt

cat domains.txt | haktrails associateddomains

Gather associated IPs

Again, associated IPs is a loose term, but it generally refers to IP addresses that are owned by the same organisation.

cat domains.txt | haktrails associatedips

Get historical DNS data

Returns historical DNS data for a domain.

cat domains.txt | haktrails historicaldns

Get historical whois data

Returns historical whois data for a domain.

cat domains.txt | haktrails historicalwhois

Run a DSL query

Runs a custom SecurityTrails DSL query. See here for more details.

haktrails dsl -query <query>

Get company details

Returns the company that is associated with the provided domain(s).

cat domains.txt | haktrails company

Get domain details

Returns all details of a domain including DNS records, alexa ranking and last seen time.

cat domains.txt | haktrails details

Get whois data

Returns whois data in JSON format.

cat domains.txt | haktrails whois

Get domain tags

Returns "tags" of a specific domain.

cat domains.txt | haktrails tags

Usage

Returns data about API usage on your SecurityTrails account.

haktrails usage

Ping

Pings SecurityTrails to check if your API key is working properly.

haktrails ping

Banner

Shows a nice ascii-art banner :)

haktrails banner

Not Yet Supported

Currently, some of the features of the SecurityTrails API are not yet supported. Pull requests are welcome!

  • Scroll
  • Domains Search
  • Domains Statistics
  • SSL Certificates (Stream)
  • SSL Certificates (Pages)
  • IP Neighbours
  • IP Statistics
  • IP Whois
  • IP Useragents
  • Domains feed
  • Domains DMARC feed
  • Domains subdomains feed
  • Certificate transparency firehose

SecurityTrails API Reference

The full API reference is here.

haktrails's People

Contributors

albonycal avatar cow-watch-hour avatar hakluke avatar incogbyte avatar iustin24 avatar jordanpotti avatar redraskal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

haktrails's Issues

Getting error while scanning with haktrails

cat domaine.txt
hakluke.com
bugcrowd.com
tesla.com
yahoo.com

While I running following command it throws the error which I attached with the screenshot.
cat domaine.txt | haktrails subdomains

I am not sure it's from my end or from hacktrails end.

Associated domain lookup doesn't work?

Hi, I can successfully use the tool to find subdomains, however, the option to find associated domains doesn't work, and the output is completely empty.
Any fix for that?

Access key not found

the file to configure the key is not in the default directory, how to fix it?

~/.config/haktools/haktrails-config.yml

multiple keys

multiple keys
key:
key:
if you are not in shape
Should be used like xxxx, xxxx

Same requested results

Hi,

First of all thanks for your amazing work & contribution. :)

I've set of subdomains from different tools subfinder,amass etc

The usual usage is;
subfinder-amass-subdomains.txt|wc -l --> 1000 subdomains
cat subfinder-amass-subdomains.txt | haktrails subdomains --> 2000 subdomains

Now the issue is, If I did use 2nd command above again with 2000 subdomains I'll get the same 1000 subdomains from the haktrails and then the newer subdomains, this makes to reach the API quota quicker, so due to haktrails first retrieves the same data back the user might reach the API limit before getting the newer/recent subdomains.

Solution:
This sounds tricky or not possible from haktrails end. Haktrails should not get the subdomains.txt data back with API usage this will fix the duplicate requested result. This will get newer subdomains which wasn't requested from API and the subdomains which not in the file.

Thanks

Problems

Hi hakluke !! how are you, my friend? am having trouble installing need something?

image

Subdomains output is corrupted

using the command echo "domain.com" | haktrails subdomains as an example would output the following results
ftp dns2 support www dns1
without outputting the domain for the subdomain
as ftp.domain.com
dns.domain.com
etc..

Having trouble using

I cant seem to get haktrails to work

──(jared㉿kali)-[~]
└─$ go install -v github.com/hakluke/haktrails@latest
golang.org/x/sys/internal/unsafeheader
gopkg.in/yaml.v2
golang.org/x/sys/unix
github.com/mattn/go-isatty
github.com/mattn/go-colorable
github.com/fatih/color
github.com/hakluke/haktrails

┌──(jared㉿kali)-[~]
└─$ cd ~/go/bin/haktrails
cd: no such file or directory: /home/jared/go/bin/haktrails

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.