Skip to content

Commit

Permalink
support domain in the address
Browse files Browse the repository at this point in the history
  • Loading branch information
RicYaben committed Oct 18, 2024
1 parent a125e7f commit d6b82ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions modules/mqtt/mqtt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
package mqtt

import (
"net"
"testing"
"time"

"github.com/zmap/zgrab2"
)

type mqttTester struct {
addr string
port int
expectedStatus zgrab2.ScanStatus
}
Expand Down Expand Up @@ -49,7 +49,7 @@ func (t *mqttTester) runTest(test *testing.T, name string) {
}

target := zgrab2.ScanTarget{
IP: net.ParseIP("127.0.0.1"),
Domain: t.addr,
}

status, ret, err := scanner.Scan(target)
Expand All @@ -68,6 +68,7 @@ func (t *mqttTester) runTest(test *testing.T, name string) {

var tests = map[string]*mqttTester{
"success": {
addr: "test.mosquitto.org",
port: 1883,
expectedStatus: zgrab2.SCAN_SUCCESS,
},
Expand Down
2 changes: 1 addition & 1 deletion modules/mqtt/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (scan *scan) makeClient() (paho.Client, error) {
if scan.target.Port != nil {
port = scan.target.Port
}
t := fmt.Sprintf("%s://%s:%d", scheme, scan.target.IP.String(), *port)
t := fmt.Sprintf("%s://%s:%d", scheme, scan.target.Host(), *port)
o.AddBroker(t)

// Add auth details
Expand Down

0 comments on commit d6b82ae

Please sign in to comment.