Skip to content

Commit 6cccf86

Browse files
author
m-1-k-3
committed
Merge branch 'master' of git://github.com/rapid7/metasploit-framework into dlink-dir300-600-execution
2 parents 43f3bb4 + 7370d7d commit 6cccf86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1779
-855
lines changed

data/gui/msfgui.jar

-1.01 KB
Binary file not shown.

external/source/gui/msfguijava/src/msfgui/RpcConnection.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ protected RpcConnection doInBackground() throws Exception {
260260
// Don't fork cause we'll check if it dies
261261
String rpcType = "Basic";
262262
java.util.List args = new java.util.ArrayList(java.util.Arrays.asList(new String[]{
263-
"msfrpcd","-f","-P",defaultPass,"-t","Msg","-U",defaultUser,"-a","127.0.0.1"}));
263+
"msfrpcd","-f","-P",defaultPass,"-t","Msg","-U",defaultUser,"-a","127.0.0.1",
264+
"-p",Integer.toString(defaultPort)}));
264265
if(!defaultSsl)
265266
args.add("-S");
266267
if(disableDb)

lib/anemone/rex_http.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ def connection(url)
188188
context,
189189
url.scheme == "https",
190190
'SSLv23',
191-
@opts[:proxies]
191+
@opts[:proxies],
192+
@opts[:username],
193+
@opts[:password]
192194
)
193195

194196
conn.set_config(

lib/msf/core/auxiliary/crawler.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ def initialize(info = {})
2222
Opt::Proxies,
2323
OptInt.new('MAX_PAGES', [ true, 'The maximum number of pages to crawl per URL', 500]),
2424
OptInt.new('MAX_MINUTES', [ true, 'The maximum number of minutes to spend on each URL', 5]),
25-
OptInt.new('MAX_THREADS', [ true, 'The maximum number of concurrent requests', 4])
25+
OptInt.new('MAX_THREADS', [ true, 'The maximum number of concurrent requests', 4]),
26+
OptString.new('USERNAME', [false, 'The HTTP username to specify for authentication']),
27+
OptString.new('PASSWORD', [false, 'The HTTP password to specify for authentication'])
2628
], self.class
2729
)
2830

@@ -34,8 +36,6 @@ def initialize(info = {})
3436
OptString.new('UserAgent', [true, 'The User-Agent header to use for all requests',
3537
"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
3638
]),
37-
OptString.new('BasicAuthUser', [false, 'The HTTP username to specify for basic authentication']),
38-
OptString.new('BasicAuthPass', [false, 'The HTTP password to specify for basic authentication']),
3939
OptString.new('HTTPAdditionalHeaders', [false, "A list of additional headers to send (separated by \\x01)"]),
4040
OptString.new('HTTPCookie', [false, "A HTTP cookie header to send with each request"]),
4141
OptBool.new('SSL', [ false, 'Negotiate SSL for outgoing connections', false]),
@@ -118,8 +118,9 @@ def run
118118
:info => ""
119119
})
120120

121-
if datastore['BasicAuthUser']
122-
t[:http_basic_auth] = [ "#{datastore['BasicAuthUser']}:#{datastore['BasicAuthPass']}" ].pack("m*").gsub(/\s+/, '')
121+
if datastore['USERNAME'] and datastore['USERNAME'] != ''
122+
t[:username] = datastore['USERNAME'].to_s
123+
t[:password] = datastore['PASSWORD'].to_s
123124
end
124125

125126
if datastore['HTTPCookie']
@@ -278,9 +279,8 @@ def crawler_options(t)
278279
opts[:cookies] = t[:cookies]
279280
end
280281

281-
if t[:http_basic_auth]
282-
opts[:http_basic_auth] = t[:http_basic_auth]
283-
end
282+
opts[:username] = t[:username] || ''
283+
opts[:password] =t[:password] || ''
284284

285285
opts
286286
end

lib/msf/core/auxiliary/web/http.rb

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
module Msf
1111
class Auxiliary::Web::HTTP
1212

13+
1314
class Request
1415
attr_accessor :url
1516
attr_reader :opts
@@ -69,6 +70,7 @@ def timed_out
6970
attr_reader :framework
7071

7172
attr_accessor :redirect_limit
73+
attr_accessor :username , :password
7274

7375
def initialize( opts = {} )
7476
@opts = opts.dup
@@ -84,8 +86,8 @@ def initialize( opts = {} )
8486

8587
@request_opts = {}
8688
if opts[:auth].is_a? Hash
87-
@request_opts['basic_auth'] = [ opts[:auth][:user].to_s + ':' +
88-
opts[:auth][:password] ]. pack( 'm*' ).gsub( /\s+/, '' )
89+
@username = opts[:auth][:user].to_s
90+
@password = opts[:auth][:password].to_s
8991
end
9092

9193
self.redirect_limit = opts[:redirect_limit] || 20
@@ -105,7 +107,9 @@ def connect
105107
opts[:target].port,
106108
{},
107109
opts[:target].ssl,
108-
'SSLv23'
110+
'SSLv23',
111+
username,
112+
password
109113
)
110114

111115
c.set_config({
@@ -266,10 +270,12 @@ def queue( request )
266270
end
267271

268272
def _request( url, opts = {} )
269-
body = opts[:body]
273+
body = opts[:body]
270274
timeout = opts[:timeout] || 10
271-
method = opts[:method].to_s.upcase || 'GET'
272-
url = url.is_a?( URI ) ? url : URI( url.to_s )
275+
method = opts[:method].to_s.upcase || 'GET'
276+
url = url.is_a?( URI ) ? url : URI( url.to_s )
277+
278+
rex_overrides = opts.delete( :rex ) || {}
273279

274280
param_opts = {}
275281

@@ -285,14 +291,19 @@ def _request( url, opts = {} )
285291
end
286292

287293
opts = @request_opts.merge( param_opts ).merge(
288-
'uri' => url.path || '/',
289-
'method' => method,
294+
'uri' => url.path || '/',
295+
'method' => method,
290296
'headers' => headers.merge( opts[:headers] || {} )
291-
)
297+
# Allow for direct rex overrides
298+
).merge( rex_overrides )
292299

293300
opts['data'] = body if body
294301

295302
c = connect
303+
if opts['username'] and opts['username'] != ''
304+
c.username = opts['username'].to_s
305+
c.password = opts['password'].to_s
306+
end
296307
Response.from_rex_response c.send_recv( c.request_cgi( opts ), timeout )
297308
rescue ::Timeout::Error
298309
Response.timed_out

lib/msf/core/auxiliary/wmapmodule.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def wmap_base_url
7171
else
7272
res << datastore['VHOST']
7373
end
74-
res << ":" + wmap_target_port
74+
res << ":" + wmap_target_port.to_s
7575
res
7676
end
7777

lib/msf/core/exploit/file_dropper.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ def on_new_session(session)
2222
# Meterpreter should do this automatically as part of
2323
# fs.file.rm(). Until that has been implemented, remove the
2424
# read-only flag with a command.
25-
session.shell_command_token(%Q|attrib.exe -r "#{win_file}"|)
25+
if session.platform =~ /win/
26+
session.shell_command_token(%Q|attrib.exe -r #{win_file}|)
27+
end
2628
session.fs.file.rm(file)
2729
print_good("Deleted #{file}")
2830
true

0 commit comments

Comments
 (0)