diff --git a/Plugins/portscan.go b/Plugins/portscan.go index f84f41c..36637d6 100644 --- a/Plugins/portscan.go +++ b/Plugins/portscan.go @@ -19,17 +19,20 @@ func PortScan(hostslist []string, ports string, timeout int64) []string { probePorts := common.ParsePort(ports) noPorts := common.ParsePort(common.NoPorts) if len(noPorts) > 0 { - tmp := make(map[int]struct{}) var tmpPorts []int for _, port := range probePorts { + var flag bool + nport: for _, noport := range noPorts { - if port != noport { - if _, ok := tmp[port]; !ok { - tmp[port] = struct{}{} - tmpPorts = append(tmpPorts, port) - } + if port == noport { + flag = true + break nport } } + if flag { + continue + } + tmpPorts = append(tmpPorts, port) } probePorts = tmpPorts } @@ -73,7 +76,7 @@ func PortConnect(addr Addr, respondingHosts chan<- string, adjustedTimeout int64 host, port := addr.ip, addr.port conn, err := net.DialTimeout("tcp4", fmt.Sprintf("%s:%v", host, port), time.Duration(adjustedTimeout)*time.Second) defer func() { - if conn != nil{ + if conn != nil { conn.Close() } }() diff --git a/common/Parse.go b/common/Parse.go index 6e56fac..b57a0e7 100644 --- a/common/Parse.go +++ b/common/Parse.go @@ -136,6 +136,8 @@ func ParseScantype(Info *HostInfo) { Info.Ports = "445" case "cve20200796": Info.Ports = "445" + case "portscan": + Info.Ports = DefaultPorts case "main": Info.Ports = DefaultPorts default: diff --git a/common/config.go b/common/config.go index ac2d9c9..ef62973 100644 --- a/common/config.go +++ b/common/config.go @@ -37,7 +37,7 @@ var PORTList = map[string]int{ var Outputfile = getpath() + "result.txt" var IsSave = true -var Webport = "80,81,82,83,84,85,86,87,88,89,90,91,92,98,99,443,800,801,808,880,888,889,1000,1010,1080,1081,1082,1118,1888,2008,2020,2100,2375,3000,3008,3128,3505,5555,6080,6648,6868,7000,7001,7002,7003,7004,7005,7007,7008,7070,7071,7074,7078,7080,7088,7200,7680,7687,7688,7777,7890,8000,8001,8002,8003,8004,8006,8008,8009,8010,8011,8012,8016,8018,8020,8028,8030,8038,8042,8044,8046,8048,8053,8060,8069,8070,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097,8098,8099,8100,8101,8108,8118,8161,8172,8180,8181,8200,8222,8244,8258,8280,8288,8300,8360,8443,8448,8484,8800,8834,8838,8848,8858,8868,8879,8880,8881,8888,8899,8983,8989,9000,9001,9002,9008,9010,9043,9060,9080,9081,9082,9083,9084,9085,9086,9087,9088,9089,9090,9091,9092,9093,9094,9095,9096,9097,9098,9099,9100,9200,9443,9448,9800,9981,9986,9988,9998,9999,10000,10001,10002,10004,10008,10010,12018,12443,14000,16080,18000,18001,18002,18004,18008,18080,18082,18088,18090,18098,19001,20000,20720,21000,21501,21502,28018" +var Webport = "80,81,82,83,84,85,86,87,88,89,90,91,92,98,99,443,800,801,808,880,888,889,1000,1010,1080,1081,1082,1118,1888,2008,2020,2100,2375,2379,3000,3008,3128,3505,5555,6080,6648,6868,7000,7001,7002,7003,7004,7005,7007,7008,7070,7071,7074,7078,7080,7088,7200,7680,7687,7688,7777,7890,8000,8001,8002,8003,8004,8006,8008,8009,8010,8011,8012,8016,8018,8020,8028,8030,8038,8042,8044,8046,8048,8053,8060,8069,8070,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097,8098,8099,8100,8101,8108,8118,8161,8172,8180,8181,8200,8222,8244,8258,8280,8288,8300,8360,8443,8448,8484,8800,8834,8838,8848,8858,8868,8879,8880,8881,8888,8899,8983,8989,9000,9001,9002,9008,9010,9043,9060,9080,9081,9082,9083,9084,9085,9086,9087,9088,9089,9090,9091,9092,9093,9094,9095,9096,9097,9098,9099,9100,9200,9443,9448,9800,9981,9986,9988,9998,9999,10000,10001,10002,10004,10008,10010,12018,12443,14000,16080,18000,18001,18002,18004,18008,18080,18082,18088,18090,18098,19001,20000,20720,21000,21501,21502,28018,20880" var DefaultPorts = "21,22,80,81,135,139,443,445,1433,3306,5432,6379,7001,8000,8080,8089,9000,9200,11211,27017" type HostInfo struct {