service

package
v0.0.0-...-02ccd07 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNKNOWN_PORT = iota
	UNKNOWN_SVC
	MySQL
	MySQL_NOT_ALLOWED
	MySQL_BLOCKED
	SSH
	FTP
	FTP_NOT_ALLOWED_OR_NOT_AVAILABLE // {服务不可用或者拒绝访问}
	SMTP
	SMTP_NOT_ALLOWED_OR_NOT_AVAILABLE // {服务不可用或者拒绝访问}
	FTP_OR_SMTP
	FTP_OR_SMTP_SERVICE_NOT_AVAILABLE // 服务不可用
	VM_AUTH_DAEMON
	POP3     // port : 110
	POPPASSD // port : 110
	IMAP4
	VNC     // port : 5900
	RDP     // port : 3389
	SSL_TLS // port : 443
	MSSQL   // port : 1433
	ORACLE  // port : 1521
	REDIS   // port : 6379
	REDIS_AUTH
	REDIS_DENIED
	MEMCACHED    // port : 11211
	TELNET       // port : 23
	HTTPX        // port : 80
	PCANYWHERE   // port : 5631
	VPN_PPTP     // port : 1723
	RSYNC        // port : 873
	MSRPC        // port : 135
	NETBIOS_SSN  // port : 139
	MICROSOFT_DS // port : 445
	DECRPC
	POSTGRESQL // port : 5432
	IBMDB2
	MONGODB // port : 27017
	MONGODB_AUTH
	LDAP // port : 389
	DNS  // port : 53
	DNS_NOBANNER
	ROUTEROS // port : 8291
	RADMIN   // port : 4899
	JAVARMI
	JAVARMI_CRASHPLAN
	JABBER
	JDWP
	MMS    // port : 1755
	DTSPCD // port : 6112
	SVNSERVE
	WEBLOGIC // port : 7001
	SIP
	SVRLOC        // port : 427
	AJP13         // port : 8009
	NFS           // port : 2049
	ELASTICSEARCH // port : 9300
	RTSP          // port : 554
	LOTUSNOTES    // port : 1352
	ZOOKEEPER     // port : 2181
)
View Source
const (
	SOCKET_CONNECT_FAILED = iota + 10000001 // 连接失败
	SOCKET_READ_TIMEOUT                     // 读取超时错误
)
View Source
const (
	// HTTP defines the plain http scheme
	HTTP = "http"
	// HTTPS defines the secure http scheme
	HTTPS = "https"
	// HTTPorHTTPS defines the both http and https scheme
	HTTPorHTTPS = "http|https"
)

Variables

View Source
var IdentificationProtocol = []string{
	"Ghttp#474554202f20485454502f312e310d0a557365722d4167656e743a204d6f7a696c6c612f352e30202857696e646f7773204e5420362e313b20574f57363429204170706c655765624b69742f3533372e333620284b48544d4c2c206c696b65204765636b6f29204368726f6d652f35312e302e323730342e313036205361666172692f3533372e33360d0a4163636570743a202a2f2a0d0a486f73743a20",
	"rdp#030000130ee000000000000100080003000000",
	"ssl/tls(1)#16030100ae010000aa030355d1668dc7272d1242aaf6e9666fbbe21e5acc601d572b39e45a5f13609dec1600001c5a5ac02bc02fc02cc030cca9cca8c013c014009c009d002f0035000a010000656a6a0000ff010001000017000000230000000d00140012040308040401050308050501080606010201000500050100000000001200000010000e000c02683208687474702f312e3175500000000b00020100000a000a0008dada001d001700188a8a000100",
	"ssl/tls(2)#1603000069010000650303551ca7e472616e646f6d3172616e646f6d3272616e646f6d3372616e646f6d3400000c002f000a00130039000400ff01000030000d002c002a000100030002060106030602020102030202030103030302040104030402010101030102050105030502",
	"ssl/tls(3)#809e01030100750000002000006600006500006400006300006200003a00003900003800003500003400003300003200002f00001b00001a00001900001800001700001600001500001400001300001200001100000a0000090000080000060000050000040000030700c0060040040080030080020080010080000002000001e4693c2bf6d69bbbd3819fbf15c140a56f142c4d20c4c7e0b6b0b21ff929e898",
	"mssql#1201003400000000000015000601001b000102001c000c0300280004ff080001550000004d5353514c536572766572004e53464f",
	"dns#001E0006010000010000000000000776657273696F6E0462696E640000100003",
	"oracle#005a0000010000000136012c000008007fff7f08000000010020003a0000000000000000000000000000000034e600000001000000000000000028434f4e4e4543545f444154413d28434f4d4d414e443d76657273696f6e2929",
	"nfs#80000028106c8eb90000000000000002000186a3000000040000000000000000000000000000000000000000",
	"redis#2a310d0a24340d0a70696e670d0a696e666f0d0a717569740d0a",
	"weblogic#74332031322e312e320a41533a323034380a484c3a31390a0a",
	"vpn-pptp#009c00011a2b3c4d00010000010000000000000100000001ffff00016e6f6e650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004d6963726f736f667400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
	"rsync#405253594e43443a2032392e0a0a",
	"memcached#73746174730d0a717569740d0a",
	"msrpc/netbios-ssn/microsoft-ds/postgresql#000000a4ff534d4272000000000801400000000000000000000000000000400600000100008100025043204e4554574f524b2050524f4752414d20312e3000024d4943524f534f4654204e4554574f524b5320312e303300024d4943524f534f4654204e4554574f524b5320332e3000024c414e4d414e312e3000024c4d312e3258303032000253616d626100024e54204c414e4d414e20312e3000024e54204c4d20302e313200",
	"ibm-db2#00000000444232444153202020202020010400000010397a000100000000000000000000010c0000000000000c0000000c00000004",
	"mongodb#410000004d095000ffffffffd407000000000000746573742e24636d640000000000ffffffff1b0000000173657276657253746174757300000000000000f03f00",
	"ldap#300c020101600702010204008000",
	"mikrotik#12026c6973740000000000000000000100000000",
	"ajp13#123400010a",
	"wms#01000000cefa0bb0a00000004d4d5320140000000000000000000000000000001200000001000300f0f0f0f00b0004001c0003004e00530050006c0061007900650072002f00310030002e0030002e0030002e0033003600340036003b0020007b00330033003000300041004400350030002d0032004300330039002d0034003600630030002d0041004500300041002d004200410033004500450030004300380031003300360045007d0000000000",
	"dtspcd#3030303030303032303430303064303030312020342000726f6f74000031300000",
	"jabber#3c3f786d6c2076657273696f6e3d27312e30273f3e3c73747265616d3a73747265616d20786d6c6e733a73747265616d3d27687474703a2f2f6574686572782e6a61626265722e6f72672f73747265616d732720786d6c6e733d276a61626265723a636c69656e742720786d6c3a6c616e673d2772752d52552720746f3d272e272076657273696f6e3d27312e30273e",
	"jdwp#4a4457502d48616e647368616b65",
	"sip#4f5054494f4e53207369703a6e6d205349502f322e300d0a5669613a205349502f322e302f544350206e6d3b6272616e63683d666f6f0d0a46726f6d3a203c7369703a6e6d406e6d3e3b7461673d726f6f740d0a546f3a203c7369703a6e6d32406e6d323e0d0a43616c6c2d49443a2035303030300d0a435365713a203432204f5054494f4e530d0a4d61782d466f7277617264733a2037300d0a436f6e74656e742d4c656e6774683a20300d0a436f6e746163743a203c7369703a6e6d406e6d3e0d0a4163636570743a206170706c69636174696f6e2f7364700d0a0d0a",
	"svrloc#0201000036200000000000010002656e00000015736572766963653a736572766963652d6167656e74000764656661756c7400000000",
	"pcanywhere#00000000",
	"radmin#01000000010000000808",
	"postgresql#00000042000300007573657200706f73746772657300646174616261736500706f737467726573006170706c69636174696f6e5f6e616d65004e6176696361740000",
	"rtsp/sip#4f5054494f4e53207369703a6e6d205349502f322e300d0a5669613a205349502f322e302f544350206e6d3b6272616e63683d666f6f0d0a46726f6d3a203c7369703a6e6d406e6d3e3b7461673d726f6f740d0a546f3a203c7369703a6e6d32406e6d323e0d0a43616c6c2d49443a2035303030300d0a435365713a203432204f5054494f4e530d0a4d61782d466f7277617264733a2037300d0a436f6e74656e742d4c656e6774683a20300d0a436f6e746163743a203c7369703a6e6d406e6d3e0d0a4163636570743a206170706c69636174696f6e2f7364700d0a0d0a",
	"lotusnotes#3a0000002f00000002000040020f0001003d050000000000000000000000002f000000000000000000401f0000000000000000000000000000000000",
	"onvif(1)#3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d227574662d38223f3e3c456e76656c6f706520786d6c6e733a646e3d22687474703a2f2f7777772e6f6e7669662e6f72672f76657231302f6e6574776f726b2f7773646c2220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030332f30352f736f61702d656e76656c6f7065223e3c4865616465723e3c7773613a4d657373616765494420786d6c6e733a7773613d22687474703a2f2f736368656d61732e786d6c736f61702e6f72672f77732f323030342f30382f61646472657373696e67223e757569643a37653266353530352d393765352d343934312d613732362d3938376137656265616136303c2f7773613a4d65737361676549443e3c7773613a546f20786d6c6e733a7773613d22687474703a2f2f736368656d61732e786d6c736f61702e6f72672f77732f323030342f30382f61646472657373696e67223e75726e3a736368656d61732d786d6c736f61702d6f72673a77733a323030353a30343a646973636f766572793c2f7773613a546f3e3c7773613a416374696f6e20786d6c6e733a7773613d22687474703a2f2f736368656d61732e786d6c736f61702e6f72672f77732f323030342f30382f61646472657373696e67223e687474703a2f2f736368656d61732e786d6c736f61702e6f72672f77732f323030352f30342f646973636f766572792f50726f62653c2f7773613a416374696f6e3e3c2f4865616465723e3c426f64793e3c50726f626520786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e63652220786d6c6e733a7873643d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612220786d6c6e733d22687474703a2f2f736368656d61732e786d6c736f61702e6f72672f77732f323030352f30342f646973636f76657279223e3c54797065733e646e3a4e6574776f726b566964656f5472616e736d69747465723c2f54797065733e3c53636f706573202f3e3c2f50726f62653e3c2f426f64793e3c2f456e76656c6f70653e",
	"onvif(2)#3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d227574662d38223f3e3c456e76656c6f706520786d6c6e733a7464733d22687474703a2f2f7777772e6f6e7669662e6f72672f76657231302f6465766963652f7773646c2220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030332f30352f736f61702d656e76656c6f7065223e3c4865616465723e3c7773613a4d657373616765494420786d6c6e733a7773613d22687474703a2f2f736368656d61732e786d6c736f61702e6f72672f77732f323030342f30382f61646472657373696e67223e757569643a31613737653736312d396361302d343939612d613835332d3463346236633935323864643c2f7773613a4d65737361676549443e3c7773613a546f20786d6c6e733a7773613d22687474703a2f2f736368656d61732e786d6c736f61702e6f72672f77732f323030342f30382f61646472657373696e67223e75726e3a736368656d61732d786d6c736f61702d6f72673a77733a323030353a30343a646973636f766572793c2f7773613a546f3e3c7773613a416374696f6e20786d6c6e733a7773613d22687474703a2f2f736368656d61732e786d6c736f61702e6f72672f77732f323030342f30382f61646472657373696e67223e687474703a2f2f736368656d61732e786d6c736f61702e6f72672f77732f323030352f30342f646973636f766572792f50726f62653c3b2f7773613a416374696f6e3e3c2f4865616465723e3c426f64793e3c50726f626520786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e63652220786d6c6e733a7873643d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612220786d6c6e733d22687474703a2f2f736368656d61732e786d6c736f61702e6f72672f77732f323030352f30342f646973636f76657279223e3c54797065733e7464733a4465766963653c2f54797065733e3c53636f706573202f3e3c2f50726f62653e3c2f426f64793e3c2f456e76656c6f70653e",
	"zookeeper#73746174730d0a717569740d0a",
}

IdentificationProtocol 用于服务识别时发送的报文

View Source
var St_Identification_Port = []Identification_Port{
	{"rdp", 3389, 1},
	{"mssql", 1433, 5},
	{"dns", 53, 6},
	{"oracle", 1521, 7},
	{"nfs", 2049, 8},
	{"redis", 6379, 9},
	{"weblogic", 7001, 10},
	{"weblogic", 7002, 10},
	{"vpn", 1723, 11},
	{"rsync", 873, 12},
	{"memcached", 11211, 13},
	{"msrcp", 135, 14},
	{"netbios-ssn", 139, 14},
	{"microsoft-ds", 445, 14},
	{"mongodb", 27017, 16},
	{"ldap", 389, 17},
	{"mikrotik", 8291, 18},
	{"ajp13", 8009, 19},
	{"wms", 1755, 20},
	{"dtspcd", 6112, 21},
	{"svrloc", 427, 25},
	{"pcanywhere", 5631, 26},
	{"pcanywhere", 5632, 26},
	{"radmin", 4899, 27},
	{"postgresql", 5432, 28},
	{"postgresql", 5432, 14},
	{"rtsp", 554, 29},
	{"sip", 5060, 29},
	{"lotusnotes", 1352, 30},
	{"onvif", 3702, 31},
	{"onvif", 3702, 32},
	{"zookeeper", 2181, 33},
}
View Source
var Top1000Ports = []string{}/* 616 elements not displayed */

Top 1000常见端口

View Source
var Top100Ports = []string{
	"21-23", "25", "53", "69", "79", "80-89", "110-111", "135", "139", "143", "161", "322", "389", "443", "445", "465", "512-515", "524", "587", "873", "993", "995", "999",
	"1080", "1158", "1352", "1433", "1521", "1863", "2049", "2100", "2181", "2222", "2323", "3128", "3306", "3389", "4848", "4899", "5000", "5061", "5432", "5631-5632", "5800", "5900", "6379", "7001", "7080", "7090", "8000", "8008",
	"8009", "8069", "8080-8090", "8141", "8161", "8291", "8443", "8888", "8899", "8880", "9001", "9080", "9090", "9200", "9300", "9443", "9898", "9900",
	"17001-17003", "11211", "20080", "27017",
}

Top 100常见端口

View Source
var Waf_Title = []string{
	"Web应用防火墙",
	"CloudWAF",
	"未找到",
	"万网虚机IP",
	"不能直接使用IP访问网站",
}
View Source
var Waf_WebServer = []string{
	"cloudflare",
}

Functions

func CertInfo

func CertInfo(host net.IP, port uint16, timeout time.Duration) (commonName string, dnsNames []string, err error)

func ComparePackets

func ComparePackets(rcv []byte, rcvSize int, szBan *string, szSvcName *string) int

返回的是一个端口号

func DecodeData

func DecodeData(data []byte, headers http.Header) ([]byte, error)

ExtractTitle from a response

func Decodegbk

func Decodegbk(s []byte) ([]byte, error)

Decodegbk converts GBK to UTF-8

func ExtractTitle

func ExtractTitle(data []byte, raw string) (title string)

func GetCert

func GetCert(domain net.IP, port uint16) (string, error)

func IntToBytes

func IntToBytes(n int, b byte) ([]byte, error)

整形向字符切片转换

func PortIdentify

func PortIdentify(ip net.IP, dst uint16, timeout time.Duration) (port.OpenIpPort, error)

优先级识别

func SendIdentificationPacketFunction

func SendIdentificationPacketFunction(data []byte, ip net.IP, ports uint16, timeout time.Duration) (httpInfo port.OpenIpPort, dwSvcs int, err error)

发送识别报文

func ToString

func ToString(data interface{}) string

ToString converts an interface to string in a quick way

Types

type Identification_Packet

type Identification_Packet struct {
	Desc   string // 描述
	Packet []byte // 发送的报文
}

type Identification_Port

type Identification_Port struct {
	SzSvcName             string // 服务名
	Port                  uint16 // 端口
	Identification_RuleId int    // 针对规则条目序号
}

type Result

type Result struct {
	URL           string `json:"url"`
	Title         string `json:"title"`
	WebServer     string `json:"webserver"`
	ContentType   string `json:"content-type,omitempty"`
	ContentLength int    `json:"content-length"`
	StatusCode    int    `json:"status-code"`
	Finger        string `json:"finger"`
	Favicon       string `json:favicon`
	// contains filtered or unexported fields
}

Result of a scan

func Analyze

func Analyze(protocol string, domain net.IP, port uint16, method string, scanopts *ScanOptions) Result

func GetHttpTitle

func GetHttpTitle(target net.IP, proc string, port uint16) Result

func (*Result) JSON

func (r *Result) JSON() string

JSON the result

func (*Result) ToString

func (r *Result) ToString() string

type ScanOptions

type ScanOptions struct {
	Methods                []string
	StoreResponseDirectory string
	RequestURI             string
	RequestBody            string
	VHost                  bool
	OutputTitle            bool
	OutputStatusCode       bool
	OutputLocation         bool
	OutputContentLength    bool
	StoreResponse          bool
	OutputServerHeader     bool
	OutputWebSocket        bool
	OutputWithNoColor      bool
	OutputMethod           bool
	ResponseInStdout       bool
	TLSProbe               bool
	CSPProbe               bool
	OutputContentType      bool
	Unsafe                 bool
	Pipeline               bool
	HTTP2Probe             bool
	OutputIP               bool
	OutputCName            bool
	OutputCDN              bool
	OutputResponseTime     bool
	PreferHTTPS            bool
	NoFallback             bool
}

Jump to

Keyboard shortcuts

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