├── README.md └── main.go /README.md: -------------------------------------------------------------------------------- 1 | # Mapper - a tool to help the distributed scannning of hosts 2 | I found myself frequently having a lot of masscan outputs in the form of host:port, and I wanted to scan them line by line with nmap service scanning, mapper helps you do that. 3 | 4 | ### Installation 5 | 6 | If you have a properly configured GOPATH and $GOPATH/bin is in your PATH, then run this command for a one-liner install, thank you golang! 7 | ``` 8 | go get -u github.com/pry0cc/mapper 9 | ``` 10 | 11 | 12 | #### Cat a very large unsorted wordlist. 13 | 14 | #### port.txt 15 | ``` 16 | 8.8.8.8:53 17 | 8.8.8.8:80 18 | 8.8.8.8:443 19 | 1.1.1.1:53 20 | 1.1.1.1:80 21 | ``` 22 | 23 | ``` 24 | cat port.txt | mapper 25 | ``` 26 | This will start a separate nmap process for each line for example `§8.8.8.8:53` will translate to `nmap -T4 -sV -p53 8.8.8.8 -oX output/8.8.8.8_53.xml` 27 | This will create an output directory and place output in the format of `ip_port.xml` 28 | 29 | 30 | Enjoy :) 31 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "os" 7 | "os/exec" 8 | "runtime" 9 | "strings" 10 | "sync" 11 | ) 12 | 13 | var wg sync.WaitGroup 14 | 15 | func main() { 16 | runtime.GOMAXPROCS(30) 17 | os.Mkdir("output", 0755) 18 | 19 | sc := bufio.NewScanner(os.Stdin) 20 | for sc.Scan() { 21 | ipport := strings.ToLower(sc.Text()) 22 | wg.Add(1) 23 | go ScanLine(ipport, &wg) 24 | } 25 | 26 | wg.Wait() 27 | } 28 | 29 | // ScanLine takes input as ip:port and scans using nmap 30 | func ScanLine(ipport string, wg *sync.WaitGroup) (err error) { 31 | 32 | defer wg.Done() 33 | 34 | s := strings.Split(ipport, ":") 35 | 36 | ip := s[0] 37 | port := s[1] 38 | filename := fmt.Sprintf("output/%s_%s.xml", ip, port) 39 | 40 | fmt.Println("nmap -T4 -Pn -sV -oX ", filename, " -p", port, " ", ip) 41 | cmd := exec.Command("nmap", "-T4", "-sV", "-Pn", "-oX", filename, "-p", port, ip) 42 | 43 | cmd.Stdout = os.Stdout 44 | cmd.Stderr = os.Stderr 45 | err = cmd.Run() 46 | 47 | if err != nil { 48 | return 49 | } 50 | 51 | return nil 52 | } 53 | --------------------------------------------------------------------------------