From 5ae9032996bb4c7d79874b31dee807084d980e84 Mon Sep 17 00:00:00 2001 From: L Date: Mon, 12 Sep 2022 22:07:13 +0800 Subject: [PATCH] update portgroup & fix -fuzz bug --- mx1014.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/mx1014.go b/mx1014.go index 5552a6e..2ec2236 100644 --- a/mx1014.go +++ b/mx1014.go @@ -168,7 +168,7 @@ func AddFuzzPort(ports []string) ([]string) { return fuzzPorts } -func ParsePortRange(portList string) ([]string) { +func ParsePortRange(portList string, ignoreFuzz bool) ([]string) { var ports []string portList2 := strings.Split(portList, ",") @@ -205,7 +205,7 @@ func ParsePortRange(portList string) ([]string) { ports = append(ports, strconv.Itoa(singlePort)) } } - if fuzzPort { + if !ignoreFuzz && fuzzPort { ports = AddFuzzPort(ports) } ports = RemoveRepeatedElement(ports) @@ -220,7 +220,7 @@ func ParseTarget(target string, defaultPorts []string) (error) { if strings.ContainsAny(target, ":") { items := strings.Split(target, ":") target = items[0] - ports = ParsePortRange(items[1]) + ports = ParsePortRange(items[1], false) portsLen = len(ports) } else { ports = defaultPorts @@ -432,7 +432,7 @@ func PortScan() { } if headPortRanges != "" { - for _, port := range ParsePortRange(headPortRanges) { + for _, port := range ParsePortRange(headPortRanges, true) { rawTargets := portMap[port] for _, rawTarget := range rawTargets { for _, host := range hostMap[rawTarget] { @@ -541,12 +541,12 @@ var ( hostMap = make(map[string][]string) // rawtarget: hosts targetFilterCount = make(map[string]int) portGroup = map[string][]int { - "in": []int{ 21,22,23,25,80,81,82,83,84,85,86,87,88,89,90,109,110,111,115,135,137,138,139,143,161,210,264,389,443,444,445,465,502,512,513,514,515,554,587,593,623,636,800,801,873,880,888,993,995,1000,1001,1024,1026,1028,1080,1090,1098,1099,1100,1101,1111,1158,1352,1433,1434,1521,2000,2001,2049,2100,2121,2181,2222,2375,2376,2377,2525,2888,3000,3001,3128,3260,3268,3269,3299,3306,3307,3308,3339,3389,3632,3690,3888,4369,4430,4433,4443,4444,4445,4446,4447,4712,4786,4848,4990,5000,5001,5003,5005,5432,5480,5555,5556,5601,5632,5672,5800,5858,5900,5901,5985,5986,6000,6001,6002,6003,6080,6379,6443,6588,6666,6868,7000,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7070,7071,7080,7088,7443,7777,7788,8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8040,8041,8042,8060,8066,8069,8070,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111,8161,8180,8181,8182,8200,8282,8363,8383,8443,8453,8480,8485,8500,8554,8761,8787,8800,8848,8866,8873,8880,8881,8882,8883,8884,8885,8886,8887,8888,8889,8890,8899,8900,8983,8989,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008,9009,9010,9043,9080,9081,9082,9083,9090,9092,9200,9229,9300,9443,9875,9876,9999,10000,10001,10080,10443,10800,10909,10911,10912,10999,11099,11211,12580,15672,18080,18090,19001,19888,20880,27017,28017,41414,45000,45001,45566,47001,50010,50020,50070,50075,50090,50470,50475,55555,63790 }, - "rce": []int{ 139,445,502,512,513,514,515,623,1000,1001,1028,1090,1098,1099,1100,1101,2049,2100,2375,2376,2377,3128,3632,4369,4444,4445,4446,4447,4712,4786,4848,4990,5000,5001,5005,5480,5555,5556,5800,5858,5900,5901,6379,8000,8009,8069,8080,8081,8083,8161,8383,8453,8500,8983,9000,9092,9200,9229,9300,9875,9876,9999,10001,10909,10911,10912,10999,11099,19001,20880,45000,45001,47001,63790 }, + "in": []int{ 21,22,23,25,80,81,82,83,84,85,86,87,88,89,90,109,110,111,115,135,137,138,139,143,161,210,264,389,443,444,445,465,502,512,513,514,515,554,587,593,623,636,800,801,873,880,888,993,995,1000,1001,1024,1026,1028,1080,1090,1098,1099,1100,1101,1111,1158,1352,1433,1434,1443,1521,2000,2001,2049,2100,2121,2181,2222,2375,2376,2377,2525,2888,3000,3001,3128,3260,3268,3269,3299,3306,3307,3308,3339,3389,3632,3690,3888,4243,4369,4430,4433,4443,4444,4445,4446,4447,4712,4786,4848,4990,5000,5001,5003,5005,5432,5480,5555,5556,5601,5632,5672,5800,5858,5900,5901,5985,5986,6000,6001,6002,6003,6080,6379,6443,6588,6666,6868,6888,7000,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7070,7071,7080,7088,7443,7777,7788,8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8040,8041,8042,8060,8066,8069,8070,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111,8161,8180,8181,8182,8200,8282,8363,8383,8443,8453,8480,8485,8500,8554,8761,8787,8800,8848,8866,8873,8880,8881,8882,8883,8884,8885,8886,8887,8888,8889,8890,8899,8900,8983,8989,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008,9009,9010,9043,9080,9081,9082,9083,9090,9092,9200,9229,9300,9443,9875,9876,9999,10000,10001,10080,10443,10800,10909,10911,10912,10999,11099,11211,12580,15672,18080,18090,19001,19888,20880,27017,28017,41414,45000,45001,45566,47001,50010,50020,50070,50075,50090,50470,50475,55555,63790 }, + "rce": []int{ 139,445,502,512,513,514,515,623,1000,1001,1028,1090,1098,1099,1100,1101,2049,2100,2375,2376,2377,3128,3632,4243,4369,4444,4445,4446,4447,4712,4786,4848,4990,5000,5001,5005,5480,5555,5556,5800,5858,5900,5901,6379,8000,8009,8069,8080,8081,8083,8161,8383,8453,8500,8983,9000,9092,9200,9229,9300,9875,9876,9999,10001,10909,10911,10912,10999,11099,19001,20880,45000,45001,47001,63790 }, "info": []int{ 21,22,23,25,109,110,111,115,135,137,138,139,143,161,264,465,554,587,593,873,993,995,1026,1352,2121,2181,2222,2525,2888,3000,3260,3299,3690,3888,5601,5632,5672,8020,8040,8041,8042,8480,8485,8554,9000,9083,19888,41414,50010,50020,50070,50075,50090,50470,50475 }, "brute": []int{ 21,22,23,25,88,109,110,115,139,143,210,389,445,465,554,587,636,873,993,995,1080,1158,1433,1434,1521,2121,2222,2525,3268,3269,3306,3307,3308,3389,5432,5800,5900,5901,5985,5986,6379,8554,11211,27017,28017,63790 }, "web1": []int{ 80,443,8080 }, - "web2": []int{ 80,81,82,83,84,85,86,87,88,89,90,443,444,800,801,880,888,1024,1080,1111,2000,2001,3000,3001,3128,3339,4430,4433,4443,4444,4445,5000,5001,5003,5555,5601,5800,6000,6001,6002,6003,6080,6443,6588,6666,6868,7000,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7070,7071,7080,7088,7443,7777,7788,8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8040,8060,8066,8069,8070,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111,8161,8180,8181,8182,8200,8282,8363,8443,8761,8787,8800,8848,8866,8873,8880,8881,8882,8883,8884,8885,8886,8887,8888,8889,8890,8899,8900,8983,8989,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008,9009,9010,9043,9080,9081,9082,9083,9090,9200,9300,9443,9999,10000,10001,10080,10443,10800,12580,15672,18080,18090,45566,47001,55555 }, + "web2": []int{ 80,81,82,83,84,85,86,87,88,89,90,443,444,800,801,880,888,1024,1080,1111,1443,2000,2001,3000,3001,3128,3339,4430,4433,4443,4444,4445,5000,5001,5003,5555,5601,5800,6000,6001,6002,6003,6080,6443,6588,6666,6868,6888,7000,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7070,7071,7080,7088,7443,7777,7788,8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8040,8060,8066,8069,8070,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111,8161,8180,8181,8182,8200,8282,8363,8443,8761,8787,8800,8848,8866,8873,8880,8881,8882,8883,8884,8885,8886,8887,8888,8889,8890,8899,8900,8983,8989,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008,9009,9010,9043,9080,9081,9082,9083,9090,9200,9300,9443,9999,10000,10001,10080,10443,10800,12580,15672,18080,18090,45566,47001,55555 }, "iis": []int{ 80,443,47001 }, "jboss": []int{ 80,1111,4444,4445,8080,8443,45566 }, "zookeeper": []int{ 2181,2888,3888 }, @@ -588,7 +588,7 @@ var ( "imap": []int{ 143,993 }, "smtp": []int{ 25,465,587,2525 }, "database1": []int{ 210,1158,1433,1434,1521,3306,3307,3308,5432,6379,11211,27017,28017,63790 }, - "database2": []int{ 210,1158,1433,1434,1521,3306,3307,3308,4100,5000,5432,5984,6379,9001,9042,9160,11211,16000,16010,16020,16030,27017,28017,63790 }, + "database2": []int{ 210,1158,1433,1434,1521,3306,3307,3308,4100,5000,5236,5432,5984,6379,9001,9042,9160,11211,16000,16010,16020,16030,27017,28017,54321,63790 }, "mysql": []int{ 3306,3307,3308 }, "mssql": []int{ 1433,1434 }, "oracle": []int{ 210,1158,1521 }, @@ -602,6 +602,8 @@ var ( "memcache": []int{ 11211 }, "hbase": []int{ 16000,16010,16020,16030 }, "cassandra": []int{ 9042,9160 }, + "kingbase8": []int{ 54321 }, + "dameng": []int{ 5236 }, "win": []int{ 21,22,23,88,115,123,135,137,138,139,389,445,593,636,1080,2121,2222,3268,3269,3389,5800,5900,5901,5985,5986 }, "linux": []int{ 21,22,23,43,111,115,123,500,512,513,514,623,873,1026,1080,2049,2121,2222,5800,5900,5901,6000 }, "mac": []int{ 22,548,2049,2222,5800,5900,5901 }, @@ -647,7 +649,7 @@ var ( "hashicorp": []int{ 8500 }, "checkpoint": []int{ 264 }, "pcanywhere": []int{ 5632 }, - "docker": []int{ 2375,2376,2377,5000 }, + "docker": []int{ 2375,2376,2377,4243,5000 }, "iscsi": []int{ 3260 }, "saprouter": []int{ 3299 }, "distcc": []int{ 3632 }, @@ -670,7 +672,7 @@ var ( portGroupMap = make(map[int][]string) portServersMap = make(map[string]string) rawCommonPorts = "in" - commonPorts = ParsePortRange(rawCommonPorts) + commonPorts = ParsePortRange(rawCommonPorts, false) commonPortsMap = GetObjectMap(commonPorts) ) @@ -784,7 +786,7 @@ func main() { log.SetOutput(out) } - defaultPorts := ParsePortRange(portRanges) + defaultPorts := ParsePortRange(portRanges, false) defaultPortsLen = len(defaultPorts) if showPorts { fmt.Printf("# Count: %d\n", defaultPortsLen) @@ -860,7 +862,7 @@ func main() { // exclude ports if excludePortRanges != "" { - excludePorts := ParsePortRange(excludePortRanges) + excludePorts := ParsePortRange(excludePortRanges, false) for _, eport := range excludePorts { if portMap[eport] != nil { for _, rawTarget := range portMap[eport] {