masscan

package
v0.0.0-...-6bdff43 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetBanner = regexp.MustCompile("Banner on port (\\d+)/tcp on ((\\d+\\.){3}\\d+): \\[([^\\]]+)\\] ([^\\ ]+)( ([^=]+)=((\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})|[^ ]+))*")
View Source
var GetIpPort = regexp.MustCompile("Discovered open port (\\d+)\\/tcp on ((\\d+\\.){3}\\d+)")

获取ip的正则表达式

Functions

func ScanTarget

func ScanTarget(ip string, args ...interface{})

在Windows上或从虚拟机上,它可以每秒执行30万个数据包。 在Linux上(没有虚拟化),它将每秒执行160万个数据包。这足以融化大多数网络。

默认情况下,masscan首先加载配置文件 /etc/masscan/masscan.conf 任何后续配置参数都会覆盖此默认配置文件中的内容

二进制:这是mascan内置格式。它产生的文件要小得多,所以当我扫描互联网时,我的磁盘不会填满。 不过,它们需要解析。命令行选项--readscan将读取二进制扫描文件。将--readscan与-oX选项一起使用将生成结果文件的XML版本。 masscan -c myscan.conf

# My Scan rate = 100000.00 output-format = xml output-status = all output-filename = scan.xml ports = 0-65535 range = 0.0.0.0-255.255.255.255 excludefile = exclude.txt

每个端口大约10小时内扫描整个互联网(减去排除值)(如果扫描所有端口,则扫描655,360小时) 与nmap兼容的“隐形”选项:-sS -Pn -n --randomize-hosts --send-eth

Types

type Address

type Address struct {
	Addr     string `xml:"addr,attr" json:"addr"`
	AddrType string `xml:"addrtype,attr" json:"addrType"`
}

地址

type Host

type Host struct {
	gorm.Model
	//StartTime       string
	//Endtime         string  `xml:"endtime,attr"`
	Ip      string  `json:"-"`
	Port    string  `json:"-"`
	Address Address `json:",inline" xml:"address" gorm:"foreignKey:Ip;references:Addr"`
	Ports   Ports   `json:"ports" xml:"ports>port" gorm:"foreignKey:Port;references:Portid"`
}

主机信息

foreignKey should name the model-local key field that joins to the foreign entity.
references should name the foreign entity's primary or unique key.

type Masscan

type Masscan struct {
	SystemPath string   // 系统目录
	Args       []string // 参数
	Ports      string   // 端口
	Target     string   // 目标
	Ranges     string   // 范围
	Rate       string   // 速率
	Exclude    string   // 排除,执行过的,加入排除列表
}

masscan 参数

func New

func New() *Masscan

func (*Masscan) ParseLine

func (m *Masscan) ParseLine(s string) ([]Host, error)

parse line

func (*Masscan) Run

func (m *Masscan) Run() error

masscan -p- --rate=2000 192.168.10.31

func (*Masscan) SetArgs

func (m *Masscan) SetArgs(arg ...string)

func (*Masscan) SetRate

func (m *Masscan) SetRate(rate string)

func (*Masscan) SetSystemPath

func (m *Masscan) SetSystemPath(systemPath string)

type Nmaprun

type Nmaprun struct {
	XMLName    xml.Name `xml:"nmaprun"`
	StartTime  string   `xml:"start,attr"`
	Scanner    string   `xml:"scanner,attr"`
	Version    string   `xml:"version,attr"`
	XmlVersion string   `xml:"xmloutputversion,attr"`
}

nmap 模式

type Ports

type Ports []struct {
	Protocol string  `xml:"protocol,attr" json:"protocol"`
	Portid   string  `xml:"portid,attr" json:"portid"`
	State1   string  `json:"-"`
	State    State   `json:",inline" xml:"state"  gorm:"foreignKey:State1;references:State"`
	Name     string  `json:"-"`
	Service  Service `json:",inline" xml:"service" gorm:"foreignKey:Name;references:Name"`
}

端口信息

type Service

type Service struct {
	Name   string `xml:"name,attr" json:"name"`
	Banner string `xml:"banner,attr" json:"banner"`
}

服务信息

type State

type State struct {
	State     string `xml:"state,attr" json:"state"`
	Reason    string `xml:"reason,attr" json:"reason"`
	ReasonTTL string `xml:"reason_ttl,attr" json:"reasonTTL"`
}

状态

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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