mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
use a username and password from the datastore if provided
git-svn-id: file:///home/svn/framework3/trunk@8149 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
c13841d902
commit
d90ffdc015
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user