mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-05 14:57:30 +01:00
ver
git-svn-id: file:///home/svn/incoming/trunk@2710 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
d93792ad46
commit
eba7bb2a6d
@ -15,17 +15,18 @@ class Core
|
||||
# Returns the list of commands supported by this command dispatcher
|
||||
def commands
|
||||
return {
|
||||
"?" => "Help menu",
|
||||
"back" => "Move back from the current context",
|
||||
"exit" => "Exit the console",
|
||||
"help" => "Help menu",
|
||||
"info" => "Displays information about one or more module",
|
||||
"search" => "Adds one or more module search paths",
|
||||
"set" => "Sets a variable to a value",
|
||||
"unset" => "Unsets one or more variables",
|
||||
"show" => "Displays modules of a given type, or all modules",
|
||||
"use" => "Selects a module by name",
|
||||
"quit" => "Exit the console",
|
||||
"?" => "Help menu",
|
||||
"back" => "Move back from the current context",
|
||||
"exit" => "Exit the console",
|
||||
"help" => "Help menu",
|
||||
"info" => "Displays information about one or more module",
|
||||
"quit" => "Exit the console",
|
||||
"search" => "Adds one or more module search paths",
|
||||
"set" => "Sets a variable to a value",
|
||||
"show" => "Displays modules of a given type, or all modules",
|
||||
"unset" => "Unsets one or more variables",
|
||||
"use" => "Selects a module by name",
|
||||
"version" => "Show the console library version number",
|
||||
}
|
||||
end
|
||||
|
||||
@ -85,7 +86,9 @@ class Core
|
||||
print(tbl.to_s)
|
||||
end
|
||||
|
||||
#
|
||||
# Displays information about one or more module
|
||||
#
|
||||
def cmd_info(args)
|
||||
if (args.length == 0)
|
||||
print(
|
||||
@ -107,7 +110,9 @@ class Core
|
||||
|
||||
alias cmd_? cmd_help
|
||||
|
||||
#
|
||||
# Adds one or more search paths
|
||||
#
|
||||
def cmd_search(args)
|
||||
if (args.length == 0)
|
||||
print_error("No search paths were provided.")
|
||||
@ -121,7 +126,9 @@ class Core
|
||||
print_line("Added #{args.length} search paths.")
|
||||
end
|
||||
|
||||
#
|
||||
# Sets a name to a value in a context aware environment
|
||||
#
|
||||
def cmd_set(args)
|
||||
|
||||
# Determine which data store we're operating on
|
||||
@ -164,33 +171,10 @@ class Core
|
||||
print_line("#{name} => #{value}")
|
||||
end
|
||||
|
||||
# Unsets a value if it's been set
|
||||
def cmd_unset(args)
|
||||
# Determine which data store we're operating on
|
||||
if (mod = get_active_module())
|
||||
datastore = mod.datastore
|
||||
else
|
||||
datastore = driver.datastore
|
||||
end
|
||||
|
||||
# No arguments? No cookie.
|
||||
if (args.length == 0)
|
||||
print(
|
||||
"Usage: unset var1 var2 var3 ...\n\n" +
|
||||
"The unset command is used to unset one or more variables.\n")
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
while ((val = args.shift))
|
||||
print_line("Unsetting #{val}...")
|
||||
|
||||
datastore.delete(val)
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Displays the list of modules based on their type, or all modules if
|
||||
# no type is provided
|
||||
#
|
||||
def cmd_show(args)
|
||||
args << "all" if (args.length == 0)
|
||||
|
||||
@ -216,6 +200,33 @@ class Core
|
||||
}
|
||||
end
|
||||
|
||||
#
|
||||
# Unsets a value if it's been set
|
||||
#
|
||||
def cmd_unset(args)
|
||||
# Determine which data store we're operating on
|
||||
if (mod = get_active_module())
|
||||
datastore = mod.datastore
|
||||
else
|
||||
datastore = driver.datastore
|
||||
end
|
||||
|
||||
# No arguments? No cookie.
|
||||
if (args.length == 0)
|
||||
print(
|
||||
"Usage: unset var1 var2 var3 ...\n\n" +
|
||||
"The unset command is used to unset one or more variables.\n")
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
while ((val = args.shift))
|
||||
print_line("Unsetting #{val}...")
|
||||
|
||||
datastore.delete(val)
|
||||
end
|
||||
end
|
||||
|
||||
# Uses a module
|
||||
def cmd_use(args)
|
||||
if (args.length == 0)
|
||||
@ -266,6 +277,17 @@ class Core
|
||||
driver.update_prompt("#{mod.type}(#{mod_name}) ")
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the revision of the console library
|
||||
#
|
||||
def cmd_version(args)
|
||||
ver = "$Revision$"
|
||||
|
||||
print_line("Version: #{ver.match(/ (.+?) \$/)[1]}")
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
#
|
||||
|
@ -53,9 +53,9 @@ class Payload
|
||||
return false
|
||||
end
|
||||
|
||||
# Generate the sled
|
||||
# Generate the payload
|
||||
begin
|
||||
sled = Msf::Simple::Payload.generate(
|
||||
buf = Msf::Simple::Payload.generate(
|
||||
mod,
|
||||
'Badchars' => badchars,
|
||||
'Encoder' => encoder,
|
||||
@ -66,7 +66,7 @@ class Payload
|
||||
end
|
||||
|
||||
# Display generated payload
|
||||
print(sled)
|
||||
print(buf)
|
||||
|
||||
return true
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user