Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( MethodSYN = "syn" MethodConnect = "connect" )
Variables ¶
View Source
var ErrNoInterfaces = errors.New("no Interfaces")
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct { N *big.Int // host number will be generate IP chan net.IP // contains filtered or unexported fields }
Example ¶
testdata := [][]string{ {"192.168.1.1"}, {"192.168.1.1-192.168.1.1"}, {"192.168.1.1-192.168.1.3"}, {"192.168.1.1/31"}, {"fe80::1"}, {"fe80::1-fe80::1"}, {"fe80::1-fe80::2"}, {"::1-::2"}, } for _, targets := range testdata { generator, err := NewGenerator(targets) if err != nil { log.Fatalln(err) } fmt.Println("number:", generator.N) for ip := range generator.IP { fmt.Println(ip, len(ip)) } } // check number l := len(testdata) targets := make([]string, l) for i := 0; i < l; i++ { targets[i] = testdata[i][0] } generator, err := NewGenerator(targets) if err != nil { log.Fatalln(err) } generator.Close() fmt.Println("number:", generator.N)
Output: number: 1 192.168.1.1 4 number: 1 192.168.1.1 4 number: 3 192.168.1.1 4 192.168.1.2 4 192.168.1.3 4 number: 2 192.168.1.0 4 192.168.1.1 4 number: 1 fe80::1 16 number: 1 fe80::1 16 number: 2 fe80::1 16 fe80::2 16 number: 2 ::1 16 ::2 16 number: 13
func NewGenerator ¶
type Interface ¶
type Interface struct { Name string // windows: "Ethernet0" linux: "eth0" Device string // windows: "\Device\NPF_{GUID}" linux: "eth0" MAC net.HardwareAddr IPNets []*net.IPNet Gateways []net.IP }
func GetAllInterfaces ¶
func SelectInterface ¶
if name is "" select the first interface
type Options ¶
type Options struct { // "syn", "connect" Method string Device string Rate int Timeout time.Duration // "connect": connectScanner() goroutine number // "syn": synScanner() and synParser() goroutine number Workers int // packetSender number useless for "connect" Senders int // if true scanner will not handle duplicate result, // it will use less memory // default will handle duplicate result Raw bool }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.