From d90ffdc01580c95ba6c1ddb3a4667277b3d98e69 Mon Sep 17 00:00:00 2001 From: James Lee Date: Mon, 18 Jan 2010 22:21:39 +0000 Subject: [PATCH] use a username and password from the datastore if provided git-svn-id: file:///home/svn/framework3/trunk@8149 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/auxiliary/auth_brute.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/msf/core/auxiliary/auth_brute.rb b/lib/msf/core/auxiliary/auth_brute.rb index c29862104e..b90d8befe3 100644 --- a/lib/msf/core/auxiliary/auth_brute.rb +++ b/lib/msf/core/auxiliary/auth_brute.rb @@ -99,7 +99,12 @@ protected # def _next_user(state) + if not state[:used_datastore] and datastore['USERNAME'] + state[:used_datastore] = true + return datastore['USERNAME'] + end return nil if not datastore["USER_FILE"] + state[:user_fd] ||= File.open(datastore["USER_FILE"], "r") if state[:user_fd].eof? state[:user_fd].close @@ -110,6 +115,10 @@ def _next_user(state) return state[:user] end def _next_pass(state) + if not state[:used_datastore] and datastore['PASSWORD'] + state[:used_datastore] = true + return datastore['PASSWORD'] + end return nil if not datastore["PASS_FILE"] state[:pass_fd] ||= File.open(datastore["PASS_FILE"], "r") if state[:pass_fd].eof? @@ -121,6 +130,12 @@ def _next_pass(state) return state[:pass] end def _next_user_pass(state) + if not state[:used_datastore] and datastore['USERNAME'] and datastore['PASSWORD'] + state[:used_datastore] = true + state[:user] = datastore['USERNAME'] + state[:pass] = datastore['PASSWORD'] + return [ state[:user], state[:pass] ] + end return if not datastore["USERPASS_FILE"] # Reopen the file each time so that we pick up any changes state[:userpass_fd] ||= File.open(datastore["USERPASS_FILE"], "r")