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/lib/msf_matchers.rb
Views: 11768
$:.unshift(File.join((File.dirname(__FILE__))))1require 'regexr'23module MsfTest4module MsfMatchers5class ContainACompleteTest67def initialize()8@r = Regexr.new(true)9end1011def matches?(data)12@data = data13return @r.verify_start_and_end(@data, "meterpreter_functional_test_start", "meterpreter_functional_test_end")14end1516def failure_message17"Beginning or end was incorrect."18end1920def negative_failure_message21"Expected to find a no beginning or end, but it matched."22end2324end2526def contain_a_complete_test27ContainACompleteTest.new28end2930class ContainAllSuccesses3132def initialize(successes = [])33@successes = successes34@r = Regexr.new(true)35end3637def matches?(data)38@data = data39@string = @r.find_strings_that_dont_exist_in_data(@data, @successes)40return true if !@string4142nil43end4445def failure_message46"expected all successes, but didn't find '#{@string}'"47end4849def negative_failure_message50"expected to miss successes but found'm all :("51end5253# alias :have_all_successes :contain_all_successes54end5556def contain_all_successes(successes = [])57ContainAllSuccesses.new(successes)58end5960class ContainNoFailuresExcept6162def initialize(failures = [], exceptions = [])63@failures = failures64@exceptions = exceptions65@r = Regexr.new(true)66end6768def matches?(data)69@data = data70@string = @r.find_strings_that_exist_in_data_except(@data, @failures, @exceptions)71return true if !@string7273nil74end7576def failure_message77"expected no failure to be found, but found this: '#{@string}'"78end7980def negative_falure_message81"expected to find failures, but didn't find any :("82end8384# alias :have_no_failures :contain_no_failures85end8687def contain_no_failures_except(failures = [], exceptions = [])88ContainNoFailuresExcept.new(failures, exceptions)89end90end91end929394