lib/ronin/ui/console/commands.rb in ronin-1.3.0 vs lib/ronin/ui/console/commands.rb in ronin-1.4.0.rc1

- old
+ new

@@ -39,10 +39,13 @@ (path.file? && path.executable?) end end + # Prefixes that denote a command, instead of Ruby code. + PREFIXES = Set['!', '.'] + # Blacklist of known commands that conflict with Ruby keywords. BLACKLIST = Set[ '[', 'ap', 'begin', 'case', 'class', 'def', 'fail', 'false', 'for', 'if', 'lambda', 'load', 'loop', 'module', 'p', 'pp', 'print', 'proc', 'puts', 'raise', 'require', 'true', 'undef', @@ -54,10 +57,10 @@ # # @param [String] input # The input from the console. # def loop_eval(input) - if input[0,1] == '!' + if PREFIXES.include?(input[0,1]) command = input[1..-1] name, arguments = command.split(' ') unless BLACKLIST.include?(name) if Commands.singleton_class.method_defined?(name)