29 lines
556 B
Go
29 lines
556 B
Go
package cmd
|
|
|
|
import (
|
|
"git.treesir.pub/DevOps/devops-sing/nmap/scan"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
getIP int
|
|
cidr string
|
|
)
|
|
|
|
var nmapCmd = &cobra.Command{
|
|
Use: "nmap",
|
|
Short: "use nmap scan cidr",
|
|
Long: `use nmap scan cidr`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
scan.Pcidr(cidr, getIP)
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
nmapCmd.Flags().IntVarP(&getIP, "getIP", "g", 1, "get ip address")
|
|
nmapCmd.Flags().StringVarP(&cidr, "cidr", "c", "192.168.8.0/24", "cidr address")
|
|
nmapCmd.MarkFlagRequired("getIP")
|
|
nmapCmd.MarkFlagRequired("cidr")
|
|
|
|
}
|