github-vet / github-vet/rangeloop-pointer-findings
awake1t/linglong: pkg/brute/brute.go; 33 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [awake1t/linglong](https://www.github.com/awake1t/linglong) at [pkg/brute/brute.go](https://github.com/awake1t/linglong/blob/f8ce242a34b7218a2b0a32ce9247cdadcea9c891/pkg/brute/brute.go#L50-L82)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.
> range-loop variable target used in defer or goroutine at line 54
[Click here to see the code in its original context.](https://github.com/awake1t/linglong/blob/f8ce242a34b7218a2b0a32ce9247cdadcea9c891/pkg/brute/brute.go#L50-L82)
Click here to show the 33 line(s) of Go which triggered the analyzer.
```go
for target := range taskChan {
//fmt.Println("now is :runBrute ",target)
defer func() {
if err := recover(); err != nil {
fmt.Println("错误:runBrute error", target,err)
}
}()
protocol := strings.ToUpper(target.Protocol)
var k string
if protocol == "REDIS" || protocol == "FTP" || protocol == "SNMP" || protocol == "POSTGRESQL" || protocol == "SSH" {
k = fmt.Sprintf("%v-%v-%v", target.Ip, target.Port, target.Protocol)
} else {
k = fmt.Sprintf("%v-%v-%v", target.Ip, target.Port, target.UserName)
}
// 生成唯一hask
h := pkg.MakeTaskHash(k)
if checkTashHash(h) {
wg.Done()
continue
}
fmt.Fprintf(os.Stdout, "Now is %s %s %s\r", target.Ip,target.UserName, target.PassWord)
err, res := plugins.ScanFuncMap[protocol](target.Ip, strconv.Itoa(target.Port), target.UserName, target.PassWord)
if err == nil && res == true {
saveRes(target, h,taskruntime,taskid)
} else {
//fmt.Println("插件爆破时错误:", err)
}
wg.Done()
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: f8ce242a34b7218a2b0a32ce9247cdadcea9c891
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.