All hacks moved to hacks.rb
This commit is contained in:
@@ -100,32 +100,6 @@ def get_equal_string_end(stringarray = [''])
|
||||
already_found
|
||||
end
|
||||
|
||||
# Since ruby 1.9.2, URI::escape is obsolete
|
||||
# See http://rosettacode.org/wiki/URL_encoding#Ruby and http://www.ruby-forum.com/topic/207489
|
||||
if RUBY_VERSION >= '1.9.2'
|
||||
module URI
|
||||
def self.escape(str)
|
||||
URI.encode_www_form_component(str).gsub('+', '%20')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if RUBY_VERSION < '1.9'
|
||||
class Array
|
||||
# Fix for grep with symbols in ruby <= 1.8.7
|
||||
def _grep_(regexp)
|
||||
matches = []
|
||||
self.each do |value|
|
||||
value = value.to_s
|
||||
matches << value if value.match(regexp)
|
||||
end
|
||||
matches
|
||||
end
|
||||
|
||||
alias_method :grep, :_grep_
|
||||
end
|
||||
end
|
||||
|
||||
# loading the updater
|
||||
require_files_from_directory(UPDATER_LIB_DIR)
|
||||
@updater = UpdaterFactory.get_updater(ROOT_DIR)
|
||||
@@ -173,13 +147,3 @@ def get_metasploit_url(module_path)
|
||||
module_path = module_path.sub(/^\//, '')
|
||||
"http://www.metasploit.com/modules/#{module_path}"
|
||||
end
|
||||
|
||||
# Override for puts to enable logging
|
||||
def puts(o = '')
|
||||
# remove color for logging
|
||||
if o.respond_to?('gsub')
|
||||
temp = o.gsub(/\e\[\d+m(.*)?\e\[0m/, '\1')
|
||||
File.open(LOG_FILE, 'a+') { |f| f.puts(temp) }
|
||||
end
|
||||
super(o)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user