Skip to content

Commit

Permalink
fixes mqtt issue results
Browse files Browse the repository at this point in the history
  • Loading branch information
RicYaben committed Jul 22, 2024
1 parent 8e6d355 commit ab1c011
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modules/mqtt/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (module *Module) Description() string {

// A Results object returned from the MQTT module's Scanner.Scan().
type Results struct {
topics map[string][]string
Topics map[string][]string `json:"topics,omitempty"`
}

// scan holds the state for a single scan. This may entail multiple connections.
Expand All @@ -72,7 +72,7 @@ type scan struct {
scanner *Scanner
target *zgrab2.ScanTarget
client paho.Client
results *Results
results Results
tls bool
}

Expand Down Expand Up @@ -169,9 +169,9 @@ func (scan *scan) Grab() *zgrab2.ScanError {

for m := range msgs {
// handle here to addd the results to the scan
msgs := scan.results.topics[m.Topic()]
msgs := scan.results.Topics[m.Topic()]
msgs = append(msgs, string(m.Payload()))
scan.results.topics[m.Topic()] = msgs
scan.results.Topics[m.Topic()] = msgs
}

return nil
Expand Down Expand Up @@ -217,8 +217,8 @@ func (scanner *Scanner) newMQTTScan(t *zgrab2.ScanTarget, tls bool) (*scan, erro
ret := &scan{
scanner: scanner,
target: t,
results: &Results{
topics: make(map[string][]string),
results: Results{
Topics: make(map[string][]string),
},
tls: tls,
}
Expand Down

0 comments on commit ab1c011

Please sign in to comment.