Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/test/functional/meterpreter/meterpreter_spec_helper.rb
Views: 11623
module MsfTest1module MeterpreterSpecHelper2def self.included(base)3base.class_eval do4def generic_failure_strings5['fail', 'error', 'exception']6end78def generic_failure_exception_strings9['nserror.dll', 'tiki-error.php', 'tiki-error_simple.php', 'tiki-rss_error.php'] # #ugh, this is dependent on the target10end1112def hlp_run_command_check_output(name, command, success_strings = [], fail_strings = [], fail_exception_strings = [])13fail_strings = fail_strings | generic_failure_strings14fail_exception_strings = fail_exception_strings | generic_failure_exception_strings1516temp_command_file = "#{@output_directory}/#{name}"1718command_output = Rex::Ui::Text::Output::File.new(temp_command_file)19@session.init_ui(@input, command_output)2021command_output.print_line("meterpreter_functional_test_start")2223if @verbose24puts "Running Command: " + command25end2627@session.run_cmd(command)28command_output.print_line("meterpreter_functional_test_end")29data = hlp_file_to_string(temp_command_file)3031data.should contain_a_complete_test32data.should contain_all_successes33data.should contain_no_failures_except34end3536def hlp_file_to_string(filename)37data = ""38f = File.open(filename, "r")39f.each_line do |line|40data += line41end42return data43end4445def hlp_string_to_file(string, filepath)46# Create a new file and write to it47File.open(filepath, 'w') do |f2|48f2.puts string49end50end51end52end53end54end555657