metasploit-framework/test/functional/meterpreter/meterpreter_specs.rb

126 lines
2.8 KiB
Ruby
Raw Normal View History

module MsfTest
module MeterpreterSpecs
def self.included(base)
base.class_eval do
it "should not error when running help" do
success_strings = [ 'Core Commands',
'Stdapi: File system Commands',
'Stdapi: Networking Commands',
'Stdapi: System Commands',
'Stdapi: User interface Commands',
'Priv: Elevate Commands',
'Priv: Password database Commands',
'Priv: Timestomp Commands' ]
hlp_run_command_check_output("help","help", success_strings)
end
it "should not error when running the help shortcut" do
success_strings = [ 'Core Commands',
'Stdapi: File system Commands',
'Stdapi: Networking Commands',
'Stdapi: System Commands',
'Stdapi: User interface Commands',
'Priv: Elevate Commands',
'Priv: Password database Commands',
'Priv: Timestomp Commands' ]
hlp_run_command_check_output("help_shortcut","?", success_strings)
end
it "should not error when taking a screenshot" do
success_strings = [ 'Screenshot saved to' ]
hlp_run_command_check_output("screenshot","screenshot", success_strings)
end
def test_all_commands
success_strings = [ '' ]
commands = [ "?",
"background",
"bgkill",
"bglist",
"bgrun",
"channel",
"close",
"exit",
"help",
"interact",
#"irb",
"migrate",
#"quit",
"read",
"run",
"use",
"write",
"cat",
"cd",
"del",
"download",
#"edit",
"getlwd",
"getwd",
"lcd",
"lpwd",
"ls",
"mkdir",
"pwd",
"rm",
"rmdir",
"search",
"upload",
"ipconfig",
"portfwd",
"route",
"clearev",
"drop_token",
"execute",
"getpid",
"getprivs",
"getuid",
"kill",
"ps",
#"reboot",
"reg",
"rev2self",
"shell",
#"shutdown",
"steal_token",
"sysinfo",
"enumdesktops",
"getdesktop",
"idletime",
"keyscan_dump",
"keyscan_start",
"keyscan_stop",
"screenshot",
"setdesktop",
"uictl",
"getsystem",
"hashdump",
"timestomp"
]
## Run each command, check for execeptions
commands.each do |command|
hlp_run_command_check_output(command,command, success_strings)
end
end
it "should not error when listing background jobs" do
success_strings = [ '' ]
hlp_run_command_check_output("bglist_no_bg_script_running_empty","bglist", success_strings)
end
it "should not error when checking for background channels" do
success_strings = [ 'No active channels.' ]
hlp_run_command_check_output("channel_list_empty","channel -l", success_strings)
end
end
end
end
end