Coder Social home page Coder Social logo

gomasscan's Introduction

gomasscan

gomasscan是一个纯go编写的masscan扫描库

前提

  • 只支持darwin/linux
  • 需要高权限
  • 需要安装libpcap

写在前面

  • 部署PF_RING DNA设备的情况下,理论发包量可以达到到1000万/秒
  • darwin上的理论发包量能够达到30万/秒,linux则能达到150万
  • darwin上实测,发包量可以达到14万/秒,linux暂未测试,为什么会存在这样的折扣,原因未知

使用

package main

import (
	"fmt"
	"github.com/lcvvvv/gomasscan"
	"time"
)

func main() {
	//创建扫描器对象
	client, err := gomasscan.NewScanner()
	if err != nil {
		panic(err)
	}
	defer client.Done()
	//开放端口处理函数
	client.HandlerOpen = func(ip string, port int) {
		//输出开放端口
		fmt.Println(ip, port)
	}
	//将IP地址加入筛选范围内
	var ip = "192.168.0.1"
	var startTime = time.Now()
	_ = client.Add(ip)
	//开始扫描
	go func() {
		for i := 0; i < 65536; i++ {
			client.SendSYN(ip, i, gomasscan.SYN)
		}
	}()
	for {
		time.Sleep(time.Second)
		elapsed := time.Since(startTime)
		seconds := elapsed.Seconds()
		fmt.Println("发包量", client.Count()/uint64(seconds), "/s")
	}

}

感谢

gomasscan's People

Contributors

lcvvvv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.