File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 5
5
6
6
module Msf
7
7
module Auxiliary ::MQTT
8
- include Exploit ::Remote ::Tcp
9
-
10
8
def initialize ( info = { } )
11
9
super
12
10
@@ -25,7 +23,7 @@ def initialize(info = {})
25
23
]
26
24
)
27
25
28
- register_autofilter_ports ( [ Rex ::Proto ::MQTT ::DEFAULT_PORT ] )
26
+ register_autofilter_ports ( [ Rex ::Proto ::MQTT ::DEFAULT_PORT , Rex :: Proto :: MQTT :: DEFAULT_PORT ] )
29
27
end
30
28
31
29
def setup
@@ -44,9 +42,10 @@ def client_id
44
42
datastore [ 'CLIENT_ID' ] || Rex ::Text . rand_text_alpha ( 1 + rand ( 10 ) )
45
43
end
46
44
45
+ # creates a new mqtt client for use against the connected socket
47
46
def mqtt_client
48
47
client_opts = {
49
- client_id : client_id ( ) . to_s ,
48
+ client_id : client_id . to_s ,
50
49
username : datastore [ 'USERNAME' ] ,
51
50
password : datastore [ 'PASSWORD' ] ,
52
51
read_timeout : read_timeout
@@ -59,7 +58,7 @@ def mqtt_connect(client)
59
58
end
60
59
61
60
def mqtt_connect? ( client )
62
- mqtt_connect ( client ) . return_code == 0
61
+ client . connect?
63
62
end
64
63
65
64
def mqtt_disconnect ( client )
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def connect
29
29
end
30
30
31
31
def connect?
32
- connect . return_code == 0
32
+ connect . return_code . zero?
33
33
end
34
34
35
35
def disconnect
You can’t perform that action at this time.
0 commit comments