Skip to content

Commit

Permalink
push v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
L-codes committed Nov 13, 2021
1 parent e821b5a commit fb29efe
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 14 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Change Log

### v2.3.0:
更新简述: 更快,更好联动!!!
新特征:
1. 添加 -P 参数,不输出 open 端口的协议预判信息
增强:
1. 检测地址有效性,采用了并发的形式,大大提高了检测地址的速度
修复:
1. 优化了 help 信息

### v2.2.0:
新特征:
1. 添加 -I 参数,忽略错误地址继续扫描
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

## Version

2.2.0 - [版本修改日志](CHANGELOG.md)
2.3.0 - [版本修改日志](CHANGELOG.md)


## Features
Expand All @@ -27,13 +27,14 @@
1. 直接运行,查看帮助信息 (所有参数与语法说明)
```ruby
$ ./mx1014

... .
.111111111111111.........................1111
......111.. .10011111011111110000000000000000111111111100000
10010000000011.1110000001.111.111......1111111111111111..........
10twelve0111... .10001. ..
100011... 1001 MX1014 by L
.001 1001 Version 2.2.0
.001 1001 Version 2.3.0
.1. ...1.


Expand All @@ -49,7 +50,7 @@ Target Example:
Options:
[Target]
-i File Target input from list
-I Ignore the wrong address and continue scanning
-I Ignore the wrong address and continue scanning
-g Net Intranet gateway address range (10/172/192/all)
-sh Show scan target
-cnet C net mode
Expand All @@ -75,6 +76,7 @@ Options:
-d Str Specify Echo mode data (Default is "%port%\n")
-D Int Progress Bar Refresh Delay (Default is 5s)
-l Output alive host
-P Do not output protocol name
-v Verbose mode
```

Expand Down Expand Up @@ -110,6 +112,13 @@ $ ./mx1014 192.168.1.133/24:ssh 192.168.1.133:80-90,443,mysql

# 2021/10/16 15:47:02 Finished 527 tasks. alive: 1% (3/257), open: 12, pps: 345, time: 1s
```
3. 输出信息与第三方程序联动,仅需 IP:PORT 的输出格式
```ruby
$ ./mx1014 -P -o out.txt 192.168.1.133:22 # -P 参数不输出端口协议预判信息
$ grep -v '#' out.txt # 所有的提示信息等均以 '#' 开头,方便过滤

192.168.1.133:22
```


## Advanced Usage
Expand Down
45 changes: 34 additions & 11 deletions mx1014.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,30 +232,39 @@ func ParseTarget(target string, defaultPorts []string) (error) {
if err != nil {
return err
}
mutex.Lock()
hostMap[target] = hosts
mutex.Unlock()
} else if IsIP(target) && strings.ContainsAny(target, "*-") {
hosts, err := IPWildcard(target)
if err != nil {
return err
}
mutex.Lock()
hostMap[target] = hosts
mutex.Unlock()
} else {
if _, err := net.LookupHost(target); err != nil {
_, err := net.LookupHost(target)
if err != nil {
if target[0] == 0x2d { // "-"
log.Println("[*] Usage: ./mx1014 [Options] [Target1] [Target2]...")
}
return err
}
mutex.Lock()
hostMap[target] = []string{ target }
mutex.Unlock()
}

mutex.Lock()
for _, port := range ports {
portMap[port] = append(portMap[port], target)
}

hostCount := len(hostMap[target])
hostTotal += hostCount
total += portsLen * hostCount
mutex.Unlock()

return nil
}
Expand Down Expand Up @@ -672,7 +681,7 @@ func usage() {
10010000000011.1110000001.111.111......1111111111111111..........
10twelve0111... .10001. ..
100011... 1001 MX1014 by L
.001 1001 Version 2.2.0
.001 1001 Version 2.3.0
.1. ...1.
Expand Down Expand Up @@ -820,17 +829,31 @@ func main() {
}
}

for _, rawTarget := range RemoveRepeatedElement(rawTargets) {
err := ParseTarget(rawTarget, defaultPorts)
if err != nil {
if ignoreErrHost {
log.Printf("# Wrong target: %s", rawTarget)
} else {
ErrPrint(fmt.Sprintf("Wrong target: %s", rawTarget))
}
wg := sync.WaitGroup{}
rawtargetChan := make(chan string, timeout)
for i := 0; i <= numOfgoroutine; i++ {
go func() {
for rawTarget := range rawtargetChan {
err := ParseTarget(rawTarget, defaultPorts)
mutex.Lock()
if err != nil {
if ignoreErrHost {
log.Printf("# Wrong target: %s", rawTarget)
} else {
ErrPrint(fmt.Sprintf("Wrong target: %s", rawTarget))
}

}
}
mutex.Unlock()
wg.Done()
}
}()
}
for _, rawTarget := range RemoveRepeatedElement(rawTargets) {
rawtargetChan <- rawTarget
wg.Add(1)
}
wg.Wait()

// exclude ports
if excludePortRanges != "" {
Expand Down

0 comments on commit fb29efe

Please sign in to comment.