All hacks moved to hacks.rb

This commit is contained in:
erwanlr
2013-03-11 17:21:09 +01:00
parent 9b5ee28f04
commit 2f14be09b5
2 changed files with 36 additions and 36 deletions

View File

@@ -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