Skip to content

Commit

Permalink
Updated with README
Browse files Browse the repository at this point in the history
  • Loading branch information
t94j0 committed Jul 26, 2017
1 parent ded6310 commit 6d6b224
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 231 deletions.
202 changes: 0 additions & 202 deletions LICENSE

This file was deleted.

33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# AIRMASTER
NSA toolkit for getting legit domains
(Thanks [NSA Name-O-Matic](https://divergentdave.github.io/nsa-o-matic/) for the name)

## How this project is different than [domain hunter](https://github.com/minisllc/domainhunter)

* Actively maintained
* Bypasses captcha for [bluecoat.com](https://sitereview.bluecoat.com/sitereview.jsp) by using OCR because their captcha is shit
* Plans for purchasing domain with Namecheap and GoDaddy

## Installation

### macOS

1. Install [homebrew](`https://brew.sh/`)
2. In your terminal, run `brew install tesseract`
3. Build Go project or download a release


## How to use

Right now, this only supports listing domains that a red team might want to purchase. Although, you can do it one of two ways:

1. With a domain list file

`AIRMASTER list --file ./path/to/file.txt`

2. With keywords

`AIRMASTER list --keyword max --keyword cool`

If multiple keywords are specified, they are combined by AND, so in the example above, you will get `maxiscool.com, max-is-kinda-cool.com, cool-memes-to-the-max.com`

The help should be very obvious, so if you are stuck, try using `AIRMASTER --help`
21 changes: 10 additions & 11 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ package cmd

import (
"fmt"
"os"

"github.com/t94j0/AIRMASTER/domain"

"github.com/spf13/cobra"
"github.com/spf13/viper"

namecheap "github.com/billputer/go-namecheap"
)

var purchase bool
Expand All @@ -23,21 +20,23 @@ var listCmd = &cobra.Command{
Long: `List domains and have the option to purchase the domains as well`,
Run: func(cmd *cobra.Command, args []string) {
// Configure Namecheap client
apiUser, apiToken, username := viper.GetString("apiUser"), viper.GetString("apiToken"), viper.GetString("username")
if apiUser == "" || apiToken == "" || username == "" {
fmt.Println("Please specify namecheap API tokens")
os.Exit(1)
}
/*
apiUser, apiToken, username := viper.GetString("apiUser"), viper.GetString("apiToken"), viper.GetString("username")
if apiUser == "" || apiToken == "" || username == "" {
fmt.Println("Please specify namecheap API tokens")
os.Exit(1)
}
ncClient := namecheap.NewClient(apiUser, apiToken, username)
ncClient := namecheap.NewClient(apiUser, apiToken, username)
*/

// Configure domain finding mechanism
if viper.GetString("file") != "" {
if err := domain.ParseFile(viper.GetString("file"), ncClient); err != nil {
if err := domain.ParseFile(viper.GetString("file")); err != nil {
fmt.Println(err)
}
} else if len(viper.GetStringSlice("keyword")) != 0 {
if err := domain.ParseKeywords(viper.GetStringSlice("keyword"), ncClient); err != nil {
if err := domain.ParseKeywords(viper.GetStringSlice("keyword")); err != nil {
fmt.Println(err)
}
} else {
Expand Down
15 changes: 8 additions & 7 deletions domain/check_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"strings"
"time"

namecheap "github.com/billputer/go-namecheap"
"github.com/spf13/viper"
)

Expand Down Expand Up @@ -41,8 +40,7 @@ type DomainCategorization struct {

// CheckDomain checks the categorization of a domain and returns a propmt when
// a domain is found that the user might want.
func CheckDomain(domain string, client *http.Client, ncClient *namecheap.Client, cooldown int64) error {
fmt.Println("Checking domain:", domain)
func CheckDomain(domain string, client *http.Client, cooldown int64) error {
// Make a request to query for the specified domain
cat, err := makeRequest(domain, "", client)
if err != nil {
Expand All @@ -53,20 +51,20 @@ func CheckDomain(domain string, client *http.Client, ncClient *namecheap.Client,
switch cat.ErrorType {
case "captcha":
solveCaptcha(domain, client)
return CheckDomain(domain, client, ncClient, 0)
return CheckDomain(domain, client, 0)
case "intrusion":
cooldown++
fmt.Fprintf(os.Stderr, "Waiting %d minuites to cool down\n", cooldown)
time.Sleep(time.Minute * time.Duration(cooldown))
return CheckDomain(domain, client, ncClient, cooldown)
return CheckDomain(domain, client, cooldown)
case "":
// Don't use Unrated domains
if !cat.Unrated {
categorization := getCategorization(cat.Categorization)
// Purchase domain if that option is specified
if viper.GetBool("purchase") {
newDomain := NewDomain(cat.URL, categorization)
newDomain.PromptPurchase(ncClient)
newDomain.PromptPurchase()
return nil
} else {
fmt.Println("Found:", cat.URL, "-", categorization)
Expand Down Expand Up @@ -157,10 +155,13 @@ func solveCaptcha(domain string, client *http.Client) {
output := strings.TrimSpace(strings.Trim(out.String(), " "))

// Make request to stop IP blacklist
if dmn, err := makeRequest(domain, output, client); err != nil {
dmn, err := makeRequest(domain, output, client)
if err != nil {
fmt.Println("Error making request:", err)
return
} else if dmn.ErrorType == "captcha" {
solveCaptcha(domain, client)
}

return
}
6 changes: 2 additions & 4 deletions domain/domains_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import (
"net/http/cookiejar"
"os"
"strings"

namecheap "github.com/billputer/go-namecheap"
)

func ParseFile(filePath string, ncClient *namecheap.Client) error {
func ParseFile(filePath string) error {
file, err := ioutil.ReadFile(filePath)
if err != nil {
return err
Expand All @@ -27,7 +25,7 @@ func ParseFile(filePath string, ncClient *namecheap.Client) error {
}

for _, url := range strings.Split(string(file), "\n") {
if err := CheckDomain(url, client, ncClient, 0); err != nil {
if err := CheckDomain(url, client, 0); err != nil {
fmt.Fprintln(os.Stderr, err)
}
}
Expand Down
Loading

0 comments on commit 6d6b224

Please sign in to comment.