Skip to content

Commit

Permalink
add FailedMapString out put
Browse files Browse the repository at this point in the history
Signed-off-by: allan716 <525223688@qq.com>
  • Loading branch information
allanpk716 committed Aug 5, 2022
1 parent 27932b2 commit 6e65987
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions pkg/scan_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,23 @@ func (s ScanTools) Scan(protocolType ProtocolType, inputInfo InputInfo, showProg
ProtocolType: protocolType,
}
outputInfo.SuccessMapString = make(map[string][]string, 0)
outputInfo.FailedMapString = make(map[string][]string, 0)
go func() {
for {
select {
case revCheckResult := <-checkResultChan:
if revCheckResult.Success == false {
continue
}
if _, ok := outputInfo.SuccessMapString[revCheckResult.Host]; ok {
outputInfo.SuccessMapString[revCheckResult.Host] = append(outputInfo.SuccessMapString[revCheckResult.Host], revCheckResult.Port)
if _, ok := outputInfo.FailedMapString[revCheckResult.Host]; ok {
outputInfo.FailedMapString[revCheckResult.Host] = append(outputInfo.FailedMapString[revCheckResult.Host], revCheckResult.Port)
} else {
outputInfo.FailedMapString[revCheckResult.Host] = []string{revCheckResult.Port}
}
} else {
outputInfo.SuccessMapString[revCheckResult.Host] = []string{revCheckResult.Port}
if _, ok := outputInfo.SuccessMapString[revCheckResult.Host]; ok {
outputInfo.SuccessMapString[revCheckResult.Host] = append(outputInfo.SuccessMapString[revCheckResult.Host], revCheckResult.Port)
} else {
outputInfo.SuccessMapString[revCheckResult.Host] = []string{revCheckResult.Port}
}
}
case <-exitRevResultChan:
return
Expand Down Expand Up @@ -360,6 +366,7 @@ type InputInfo struct {
type OutputInfo struct {
ProtocolType ProtocolType
SuccessMapString map[string][]string
FailedMapString map[string][]string
}

type ProtocolType int
Expand Down

0 comments on commit 6e65987

Please sign in to comment.