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
7 changes: 5 additions & 2 deletions pkg/passive/amass/amass.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ import (
"os/exec"
"strings"
"sync"

"github.com/g0ldencybersec/EasyEASM/pkg/utils"
)

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

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

Expand Down
7 changes: 5 additions & 2 deletions pkg/passive/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import (
"fmt"
"os"
"os/exec"

"github.com/g0ldencybersec/EasyEASM/pkg/utils"
)

func RunHttpx(domains []string) {
writeTempFile(domains)
cmd := exec.Command("httpx", "-l", "tempHttpx.txt", "-silent", "-td", "-csv", "-o", "temp.csv")
binPath := utils.GetGoEnvPathBin()
cmd := exec.Command(binPath+"/httpx", "-l", "tempHttpx.txt", "-silent", "-td", "-csv", "-o", "temp.csv")
err := cmd.Run()
if err != nil {
panic(err)
Expand Down Expand Up @@ -56,7 +59,7 @@ func processCSV() {
}

// 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, 13, 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")
Expand Down
6 changes: 4 additions & 2 deletions pkg/passive/subfinder/subfinder.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import (
"os/exec"
"strings"
"sync"

"github.com/g0ldencybersec/EasyEASM/pkg/utils"
)

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

binPath := utils.GetGoEnvPathBin()
cmd := exec.Command(binPath+"/subfinder", "-d", seedDomain, "-silent")
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
Expand Down
22 changes: 18 additions & 4 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"os"
"os/exec"
"path/filepath"
)

func RemoveDuplicates(slice []string) []string {
Expand Down Expand Up @@ -194,15 +195,19 @@ func InstallTools() {
"subfinder": "github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest",
} {
if !checkTool(name) {
installGoTool(name, path)
installGoTool(path)
}
}

fmt.Println("All needed tools installed!")
}

func checkTool(name string) bool {
_, err := exec.LookPath(name)
binPath := GetGoEnvPathBin()
// Construct the executable file path for the tool.
toolPath := filepath.Join(binPath, name)

_, err := os.Stat(toolPath)
if err != nil {
fmt.Printf("%s is not installed\n", name)
return false
Expand All @@ -211,10 +216,9 @@ func checkTool(name string) bool {
return true
}

func installGoTool(name string, path string) {
func installGoTool(path string) {
// Replace this with the package you want to install
packagePath := path

cmd := exec.Command("go", "install", packagePath)
cmdOutput, err := cmd.CombinedOutput()
if err != nil {
Expand All @@ -223,3 +227,13 @@ func installGoTool(name string, path string) {

log.Printf("Successfully installed the package: %s", packagePath)
}

func GetGoEnvPathBin() string {
// Get the path of the bin directory from the Go environment variables.
goPath := os.Getenv("GOPATH")
if goPath == "" {
goPath = filepath.Join(os.Getenv("HOME"), "go")
}
binPath := filepath.Join(goPath, "bin")
return binPath
}