scan

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 14 Imported by: 0

README

说明

本包自动识别是否可以使用tcp syn进行探测,如果使用管理员权限,则使用tcp syn进行探测,否则使用三次握手的方式

使用方法

	    import "github.com/firstmeet/scan"
	    
	    func Example(){
	    ipList := []string{"127.0.0.1", "192.168.1.1"}
            portList := []int{22, 23, 3306}
            rev := make(chan scan.Result, 100)
            s := scan.NewScan(ipList, portList, 100, 10*time.Second, rev)
            go func() {
            for result := range rev {
            fmt.Printf("[*] %s/%d is open\n", result.Ip, result.Port)
            }
            }()
            s.Start()
            s.Wait()
	    }
	    

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Ip   string
	Port int
}

type Scan

type Scan struct {
	IpList       []string
	PortList     []int
	ThreadNum    int
	Timeout      time.Duration
	ListenStatus bool

	Result chan Result

	ReturnNumber int

	Total int
	Lock  sync.Mutex
	// contains filtered or unexported fields
}

func NewScan

func NewScan(IpList []string, PortList []int, ThreadNum int, Timeout time.Duration, Result chan Result) *Scan

func (*Scan) Close

func (scan *Scan) Close()

func (*Scan) CloseListen

func (scan *Scan) CloseListen()

func (*Scan) Start

func (scan *Scan) Start()

func (*Scan) Wait

func (scan *Scan) Wait()

Directories

Path Synopsis
lib

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL