@@ -102,7 +102,8 @@ def initialize
102
102
'Christian Mehlmauer' , # Msf module
103
103
'wvu' , # Msf module
104
104
'juan vazquez' , # Msf module
105
- 'Sebastiano Di Paola' # Msf module
105
+ 'Sebastiano Di Paola' , # Msf module
106
+ 'Tom Sellers' # Msf module
106
107
] ,
107
108
'References' =>
108
109
[
@@ -193,22 +194,35 @@ def tls_pop3
193
194
res
194
195
end
195
196
196
- def tls_jabber
197
+ def jabber_connect_msg ( hostname )
197
198
# http://xmpp.org/extensions/xep-0035.html
198
199
msg = "<stream:stream xmlns='jabber:client' "
199
200
msg << "xmlns:stream='http://etherx.jabber.org/streams' "
200
201
msg << "version='1.0' "
201
- msg << "to='#{ datastore [ 'XMPPDOMAIN' ] } '>"
202
- sock . put ( msg )
202
+ msg << "to='#{ hostname } '>"
203
+ end
204
+
205
+ def tls_jabber
206
+ sock . put ( jabber_connect_msg ( datastore [ 'XMPPDOMAIN' ] ) )
203
207
res = sock . get
204
- if res . nil? || res =~ /stream:error/ || res !~ /<starttls xmlns=['"]urn:ietf:params:xml:ns:xmpp-tls['"]/
205
- vprint_error ( "#{ peer } - Jabber host unknown. Please try changing the XMPPDOMAIN option." ) if res && res =~ /<host-unknown/
208
+ if res && res . include? ( 'host-unknown' )
209
+ jabber_host = res . match ( / from='([\w .]*)' / )
210
+ if jabber_host && jabber_host [ 1 ]
211
+ disconnect
212
+ connect
213
+ vprint_status ( "#{ peer } - Connecting with autodetected remote XMPP hostname: #{ jabber_host [ 1 ] } ..." )
214
+ sock . put ( jabber_connect_msg ( jabber_host [ 1 ] ) )
215
+ res = sock . get
216
+ end
217
+ end
218
+ if res . nil? || res . include? ( 'stream:error' ) || res !~ /<starttls xmlns=['"]urn:ietf:params:xml:ns:xmpp-tls['"]/
219
+ vprint_error ( "#{ peer } - Jabber host unknown. Please try changing the XMPPDOMAIN option." ) if res && res . include? ( 'host-unknown' )
206
220
return nil
207
221
end
208
222
msg = "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"
209
223
sock . put ( msg )
210
224
res = sock . get
211
- return nil if res . nil? || res !~ / <proceed/
225
+ return nil if res . nil? || ! res . include? ( ' <proceed' )
212
226
res
213
227
end
214
228
0 commit comments