Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
416 changes: 363 additions & 53 deletions easyeasm/main.go

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module github.com/g0ldencybersec/EasyEASM
module github.com/sethlaw/EasyEASM

go 1.20

require gopkg.in/yaml.v3 v3.0.1

require github.com/mattn/go-sqlite3 v1.14.22 // indirect
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
6 changes: 3 additions & 3 deletions pkg/active/active.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package active

import (
"github.com/g0ldencybersec/EasyEASM/pkg/active/alterx"
"github.com/g0ldencybersec/EasyEASM/pkg/active/dnsx"
"github.com/g0ldencybersec/EasyEASM/pkg/active/httpx"
"github.com/sethlaw/EasyEASM/pkg/active/alterx"
"github.com/sethlaw/EasyEASM/pkg/active/dnsx"
"github.com/sethlaw/EasyEASM/pkg/active/httpx"
)

type ActiveRunner struct {
Expand Down
13 changes: 7 additions & 6 deletions pkg/active/alterx/alterx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import (
)

func RunAlterx(domains []string, threads int) []string {
fmt.Println("Starting permuatation scan!")
fmt.Println(" => Starting permuatation scan!")
var results []string
createDomainFile(domains)

cmd := exec.Command("alterx", "-l", "tempDomains.txt", "-silent", "-o", "alterxDomains.txt")
err := cmd.Run()

if err != nil {
panic(err)
fmt.Println(err)
}

cmd = exec.Command("dnsx", "-l", "alterxDomains.txt", "-silent", "-a", "-cname", "-aaaa", "-t", strconv.Itoa(threads))
Expand All @@ -29,16 +29,16 @@ func RunAlterx(domains []string, threads int) []string {
err = cmd.Run()

if err != nil {
panic(err)
fmt.Println(err)
}

for _, domain := range strings.Split(out.String(), "\n") {
if len(domain) != 0 {
results = append(results, domain)
}
}
fmt.Println("ALTERX RESULTS")
fmt.Println(results)
fmt.Println(" => alterx domains: ", len(results))
// fmt.Println(results)
os.Remove("tempDomains.txt")
os.Remove("alterxDomains.txt")

Expand All @@ -49,7 +49,8 @@ func createDomainFile(domains []string) {
file, err := os.OpenFile("tempDomains.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)

if err != nil {
panic(err)
fmt.Println(err)
return
}

datawriter := bufio.NewWriter(file)
Expand Down
8 changes: 4 additions & 4 deletions pkg/active/dnsx/dnsx.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func RunDnsx(seedDomains []string, wordlist string, threads int) []string {
fmt.Printf("Runing Bruteforce!")
fmt.Println(" => Running dnsx")
var results []string
for _, domain := range seedDomains {
if domain != "" {
Expand All @@ -22,7 +22,7 @@ func RunDnsx(seedDomains []string, wordlist string, threads int) []string {
err := cmd.Run()

if err != nil {
panic(err)
fmt.Println(err)
}

for _, domain := range strings.Split(out.String(), "\n") {
Expand All @@ -34,8 +34,8 @@ func RunDnsx(seedDomains []string, wordlist string, threads int) []string {

}

fmt.Println("ACTIVE RESULTS")
fmt.Println(results)
// fmt.Println(" => dnsx results: ", len(results))
// fmt.Println(results)
os.Remove("tempDomains.txt")
return results
}
18 changes: 9 additions & 9 deletions pkg/active/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ func RunHttpx(domains []string) {
cmd := exec.Command("httpx", "-l", "tempHttpx.txt", "-silent", "-td", "-csv", "-o", "temp.csv")
err := cmd.Run()
if err != nil {
panic(err)
fmt.Println(err)
}
fmt.Printf("Httpx run completed")
fmt.Println(" => httpx run completed")
processCSV()
os.Remove("tempHttpx.txt")
os.Remove("temp.csv")
Expand All @@ -25,7 +25,7 @@ func writeTempFile(list []string) {
file, err := os.OpenFile("tempHttpx.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)

if err != nil {
panic(err)
fmt.Println(err)
}

datawriter := bufio.NewWriter(file)
Expand All @@ -42,7 +42,7 @@ func processCSV() {
// Open the CSV file
inputFile, err := os.Open("temp.csv")
if err != nil {
panic(err)
fmt.Println(err)
}
defer inputFile.Close()

Expand All @@ -52,16 +52,16 @@ func processCSV() {
// Read the whole CSV into memory
records, err := reader.ReadAll()
if err != nil {
panic(err)
fmt.Println(err)
}

// Specify the indices of the columns to keep
columnsToKeep := []int{0,1,7,8,10,13,17,20,26,27,28,32,33,35,37} // Keeping only the first and third columns (0-indexed)
columnsToKeep := []int{0, 1, 7, 8, 10, 11, 12, 17, 20, 26, 27, 28, 32, 33, 35, 37} // Keeping only interesting columns (0-indexed)

// Open the output CSV file
outputFile, err := os.Create("EasyEASM.csv")
if err != nil {
panic(err)
fmt.Println(err)
}
defer outputFile.Close()

Expand All @@ -77,13 +77,13 @@ func processCSV() {
}
}
if err := writer.Write(filteredRecord); err != nil {
panic(err)
fmt.Println(err)
}
}

// Ensure everything is written to the output file
if err := writer.Error(); err != nil {
panic(err)
fmt.Println(err)
}

}
7 changes: 3 additions & 4 deletions pkg/passive/amass/amass.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,25 @@ import (

func RunAmass(seedDomain string, results chan string, wg *sync.WaitGroup) {
defer wg.Done()
fmt.Printf("Running Amass on %s\n", seedDomain)
fmt.Printf(" => Running amass on %s\n", seedDomain)
cmd := exec.Command("amass", "enum", "--passive", "-nocolor", "-d", seedDomain)
err := cmd.Run()

if err != nil {
panic(err)
fmt.Print(err)
}
cmd = exec.Command("oam_subs", "-names", "-d", seedDomain)
var out bytes.Buffer
cmd.Stdout = &out

err = cmd.Run()
if err != nil {
panic(err)
fmt.Print(err)
}

for _, domain := range strings.Split(out.String(), "\n") {
if strings.Contains(domain, seedDomain) && len(domain) != 0 {
results <- domain
}
}
fmt.Printf("Amass Run completed for %s\n", seedDomain)
}
20 changes: 11 additions & 9 deletions pkg/passive/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ func RunHttpx(domains []string) {
cmd := exec.Command("httpx", "-l", "tempHttpx.txt", "-silent", "-td", "-csv", "-o", "temp.csv")
err := cmd.Run()
if err != nil {
panic(err)
fmt.Println(err)
}
fmt.Printf("Httpx run completed")
fmt.Println(" => httpx run completed")
processCSV()
os.Remove("tempHttpx.txt")
os.Remove("temp.csv")
Expand All @@ -25,7 +25,7 @@ func writeTempFile(list []string) {
file, err := os.OpenFile("tempHttpx.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)

if err != nil {
panic(err)
fmt.Println(err)
}

datawriter := bufio.NewWriter(file)
Expand All @@ -42,7 +42,7 @@ func processCSV() {
// Open the CSV file
inputFile, err := os.Open("temp.csv")
if err != nil {
panic(err)
fmt.Println(err)
}
defer inputFile.Close()

Expand All @@ -52,16 +52,16 @@ func processCSV() {
// Read the whole CSV into memory
records, err := reader.ReadAll()
if err != nil {
panic(err)
fmt.Println(err)
}

// Specify the indices of the columns to keep
columnsToKeep := []int{0,1,7,8,10,13,17,20,26,27,28,32,33,35,37} // Keeping only the first and third columns (0-indexed)
columnsToKeep := []int{0, 1, 7, 8, 10, 11, 12, 17, 20, 26, 27, 28, 32, 33, 35, 37} // Keeping only the first and third columns (0-indexed)

// Open the output CSV file
outputFile, err := os.Create("EasyEASM.csv")
if err != nil {
panic(err)
fmt.Println(err)
}
defer outputFile.Close()

Expand All @@ -77,13 +77,15 @@ func processCSV() {
}
}
if err := writer.Write(filteredRecord); err != nil {
panic(err)
fmt.Println(err)
return
}
}

// Ensure everything is written to the output file
if err := writer.Error(); err != nil {
panic(err)
fmt.Println(err)
return
}

}
9 changes: 4 additions & 5 deletions pkg/passive/passive.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"sync"

"github.com/g0ldencybersec/EasyEASM/pkg/passive/amass"
"github.com/g0ldencybersec/EasyEASM/pkg/passive/httpx"
"github.com/g0ldencybersec/EasyEASM/pkg/passive/subfinder"
"github.com/sethlaw/EasyEASM/pkg/passive/amass"
"github.com/sethlaw/EasyEASM/pkg/passive/httpx"
"github.com/sethlaw/EasyEASM/pkg/passive/subfinder"
)

type PassiveRunner struct {
Expand All @@ -16,13 +16,12 @@ type PassiveRunner struct {
}

func (r *PassiveRunner) RunPassiveEnum() []string {
fmt.Println("Running Passive Sources")
fmt.Println(" => Running Passive Sources")
var wg sync.WaitGroup
sf_results := make(chan string)
amass_results := make(chan string)
for _, domain := range r.SeedDomains {
wg.Add(2)
fmt.Printf("Finding domains for %s\n", domain)
go subfinder.RunSubfinder(domain, sf_results, &wg)
go amass.RunAmass(domain, amass_results, &wg)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/passive/subfinder/subfinder.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import (

func RunSubfinder(seedDomain string, results chan string, wg *sync.WaitGroup) {
defer wg.Done()
fmt.Printf("Runing Subfinder on %s\n", seedDomain)
fmt.Printf(" => Running subfinder on %s\n", seedDomain)
cmd := exec.Command("subfinder", "-d", seedDomain, "-silent")

var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()

if err != nil {
panic(err)
fmt.Println(err)
}

for _, domain := range strings.Split(out.String(), "\n") {
if strings.Contains(domain, seedDomain) && len(domain) != 0 {
results <- domain
}
}
fmt.Printf("Subfinder run completed for %s\n", seedDomain)
// fmt.Printf(" => subfinder run completed for %s\n", seedDomain)
}
Loading