Golang client for querying SecurityTrails API data

Related tags

Network haktrails
Overview

haktrails

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

SecurityTrails $50 Bug Bounty Hunter Plan Sale

Until April 15th, SecurityTrails are running a promotion just for Bug Bounty hunters. Click here to take a look!

It will include the following:

  • Security data API acc:ess
  • 2500 queries/month
  • Associated domains
  • Subdomain enumeration
  • DSL v1 access
  • DNS and WHOIS historical data
  • Code samples for JS, Python, Go, and more
  • Chance to win access to SurfaceBrowser™

Tool Features

  • stdin input for easy tool chaining
  • subdomain discovery
  • associated root domain discovery
  • associated IP discovery
  • historical DNS data
  • historical whois data
  • 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

Installation

Install golang, then:

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.

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.

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

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

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 DSL Search
  • 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.

Comments
  • color output & zsh+bash autocompletion

    color output & zsh+bash autocompletion

    some basic colors added by default.. no flag required.. these colors will not affect the output by the securitytrails api.. colors are only added on the haktrails usage & haktrails (examples) Thank You :p bounty pls (this is necessary)

    opened by Albonycal 5
  • Getting error while scanning with haktrails

    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.

    opened by bishal0x01 3
  • Fixed Panic and added support for printing errors - AssociatedIPs

    Fixed Panic and added support for printing errors - AssociatedIPs

    When running the associated IP's command, if your SecurityTrails subscription didn't support that feature, this tool crashed. I pulled a fix from commit #79fcb965aec519c6e4dba0b9d630eab189cfa913 and place it in associatedips.go.

    I also added support in utilities.go to grab the response code to be used for validating that the request was valid (response 200).

    I also added a defer to close the http request once we are done with it.

    opened by jordanpotti 2
  • haktrails usage page outputs json directly

    haktrails usage page outputs json directly

    haktrails usage page outputs json directly.. something like gron could help.. @hakluke if you don't have time, I can do it & create a PR.. Thank You :)

    opened by Albonycal 2
  • fix home path on windows

    fix home path on windows

    The "HOME" env variable is not present on Windows.

    I replaced the variable with Go's method in the os package for retrieving the correct home dir for different operating systems.

    opened by redraskal 1
  • Update readme

    Update readme

    After golang 1.17 go get will trigger a error

    
    go get github.com/hakluke/haktrails
    go: downloading github.com/hakluke/haktrails v0.0.0-20211005051347-97ddc71b0a69
    go get: installing executables with 'go get' in module mode is deprecated.
    	Use 'go install pkg@version' instead.
    	For more information, see https://golang.org/doc/go-get-install-deprecation
    	or run 'go help get' or 'go help install'
    

    Solution:

    go install -v github.com/hakluke/haktrails@latest
    
    opened by incogbyte 1
  • Same requested results

    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

    opened by moashxer 0
  • Having trouble using

    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

    opened by jareddarkweb 4
Owner
Luke Stephens (hakluke)
Internet Ninja.
Luke Stephens (hakluke)
Kick dropper is a very simple and leightweight demonstration of SQL querying, and injection by parsing URl's

__ __ __ __ _____ ______ | |/ |__|.----.| |--.______| \.----.| |.-----.-----.-----.----.

RE43P3R 2 Feb 6, 2022
Godaddy-domains-client-go - Godaddy domains api Client golang - Write automaticly from swagger codegen

Go API client for swagger Overview This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you c

Mickael Stanislas 0 Jan 9, 2022
Go client library for accessing the Football Data API

football-data-sdk football-data-sdk is a Go client library for accessing the Football Data API. Successful queries return native Go structs. Services

Matheus Tex 12 Oct 13, 2022
iceportal-api is a Golang client implementation to interact with the REST API of iceportal.de when connected to the WiFi-Network offered in German ICE Trains.

iceportal-api is a Golang client implementation to interact with the REST API of iceportal.de when connected to the WiFi-Network offered in German ICE Trains.

Fabian Siegel 42 Aug 20, 2022
Tailscale-client-go - A client implementation for the Tailscale HTTP API

tailscale-client-go A client implementation for the Tailscale HTTP API Example p

David Bond 0 Sep 8, 2022
An API Client package for Studyplus for School SYNC API

Studyplus for School SYNC API Client This project is currently alpha, possibility having breaking changes. studyplus_for_school_sync_go is a API clien

atomiyama 4 Aug 2, 2021
Go API Client for Metasploit RPC API

go-msf-rpc Golang based RPC client to communicate with Metasploit. Based on code initially developed by Wyatt Dahlenburg repo. Extended to include oth

Fagamous Prime 17 Nov 18, 2022
Data Connector is a Google Sheets Add-on that lets you import (and export) data to/from Google Sheets

Data Connector Data Connector is a Google Sheets Add-on that lets you import (and export) data to/from Google Sheets. Our roadmap: Connect to JSON/XML

Brent Adamson 114 Jul 30, 2022
Simple, yet powerful Adcell go client to import data feeds into you projects.

adcell-go Simple, yet powerful Adcell go client to import data feeds into you projects. Explore the docs » View Demo · Report Bug · Request Feature Ta

Matthias Bruns 0 Oct 31, 2021
A minimal analytics package to start collecting traffic data without client dependencies.

go-web-analytics A minimal analytics package to start collecting traffic data without client dependencies. Logging incoming requests import "github.co

Jake Kalstad 0 Nov 23, 2021
Collect Data Service (Client & Server)

Collect Data Service (Client & Server)

Nguyen Lam 0 Dec 30, 2021
Go/Golang client library to interact with the Stein API

go-stein This Go / Golang client helps you interact with the Stein API. Stein is a suite of programs to help you turn any Google Sheet to a database.

Nasrul Faizin 4 Aug 23, 2022
Autify's web API client for Golang

autify-go This is a Go wrapper for working with Autify's Web API. This project tries to connect the Web API Endpoint easily by using this library. Ins

Teruo Kunihiro 8 Nov 9, 2021
Client library with golang for accessing Harbor API.

go-client Client library with golang for accessing Harbor API. Client Types There are 3 swagger files in this repo. api/ v2.0/ legacy_swag

Harbor 17 Nov 13, 2022
Prisma Client Go is an auto-generated and fully type-safe database client

Prisma Client Go Typesafe database access for Go Quickstart • Website • Docs • API reference • Blog • Slack • Twitter Prisma Client Go is an auto-gene

Prisma 1.4k Jan 9, 2023
The Dual-Stack Dynamic DNS client, the world's first dynamic DNS client built for IPv6.

dsddns DsDDNS is the Dual-Stack Dynamic DNS client. A dynamic DNS client keeps your DNS records in sync with the IP addresses associated with your hom

Ryan Young 15 Sep 27, 2022
Go Substrate RPC Client (GSRPC)Go Substrate RPC Client (GSRPC)

Go Substrate RPC Client (GSRPC) Substrate RPC client in Go. It provides APIs and types around Polkadot and any Substrate-based chain RPC calls. This c

Chino Chang 1 Nov 11, 2021
Server and client implementation of the grpc go libraries to perform unary, client streaming, server streaming and full duplex RPCs from gRPC go introduction

Description This is an implementation of a gRPC client and server that provides route guidance from gRPC Basics: Go tutorial. It demonstrates how to u

Joram Wambugu 0 Nov 24, 2021
Comunicación de envios de archivos entres cliente-servidor, client-client.

Client - Server - Client Estes es un proyecto simple de comunicacion de envios de archivos del cliente al servidor y viceversamente, y de cliente a cl

Melvin RB 1 Jul 16, 2022