Minor update to trigger test server
This commit is contained in:
@@ -15,20 +15,20 @@
|
||||
#
|
||||
class Hash
|
||||
|
||||
# Recursively deep merge two hashes together
|
||||
# @param [Hash] hash Hash to be merged
|
||||
# @return [Hash] Combined hash
|
||||
# @note Duplicate keys are overwritten by the value defined in the hash calling deep_merge (not the parameter hash)
|
||||
# @note http://snippets.dzone.com/posts/show/4706
|
||||
def deep_merge(hash)
|
||||
target = dup
|
||||
hash.keys.each do |key|
|
||||
if hash[key].is_a? Hash and self[key].is_a? Hash
|
||||
target[key] = target[key].deep_merge(hash[key])
|
||||
next
|
||||
end
|
||||
target[key] = hash[key]
|
||||
end
|
||||
target
|
||||
# Recursively deep merge two hashes together
|
||||
# @param [Hash] hash Hash to be merged
|
||||
# @return [Hash] Combined hash
|
||||
# @note Duplicate keys are overwritten by the value defined in the hash calling deep_merge (not the parameter hash)
|
||||
# @note http://snippets.dzone.com/posts/show/4706
|
||||
def deep_merge(hash)
|
||||
target = dup
|
||||
hash.keys.each do |key|
|
||||
if hash[key].is_a? Hash and self[key].is_a? Hash
|
||||
target[key] = target[key].deep_merge(hash[key])
|
||||
next
|
||||
end
|
||||
target[key] = hash[key]
|
||||
end
|
||||
target
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ class Module
|
||||
classes = []
|
||||
ObjectSpace.each_object(Class) { |k| classes << k if k.included_modules.include?(self) }
|
||||
|
||||
classes.reverse.inject([]) do |unique_classes, klass|
|
||||
classes.reverse.inject([]) do |unique_classes, klass|
|
||||
unique_classes << klass unless unique_classes.collect { |k| k.to_s }.include?(klass.to_s)
|
||||
unique_classes
|
||||
end
|
||||
@@ -32,8 +32,8 @@ class Module
|
||||
def included_in_modules
|
||||
modules = []
|
||||
ObjectSpace.each_object(Module) { |k| modules << k if k.included_modules.include?(self) }
|
||||
|
||||
modules.reverse.inject([]) do |unique_modules, klass|
|
||||
|
||||
modules.reverse.inject([]) do |unique_modules, klass|
|
||||
unique_modules << klass unless unique_modules.collect { |k| k.to_s }.include?(klass.to_s)
|
||||
unique_modules
|
||||
end
|
||||
|
||||
@@ -14,35 +14,35 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
class Object
|
||||
|
||||
|
||||
# Returns true if the object is a Boolean
|
||||
# @return [Boolean] Whether the object is boolean
|
||||
def boolean?
|
||||
self.is_a?(TrueClass) || self.is_a?(FalseClass)
|
||||
self.is_a?(TrueClass) || self.is_a?(FalseClass)
|
||||
end
|
||||
|
||||
|
||||
# Returns true if the object is a String
|
||||
# @return [Boolean] Whether the object is a string
|
||||
def string?
|
||||
self.is_a?(String)
|
||||
end
|
||||
|
||||
|
||||
# Returns true if the object is an Integer
|
||||
# @return [Boolean] Whether the object is an integer
|
||||
def integer?
|
||||
self.is_a?(Integer)
|
||||
end
|
||||
|
||||
|
||||
# Returns true if the object is a hash
|
||||
# @return [Boolean] Whether the object is a hash
|
||||
def hash?
|
||||
self.is_a?(Hash)
|
||||
end
|
||||
|
||||
|
||||
# Returns true if the object is a class
|
||||
# @return [Boolean] Whether the object is a class
|
||||
def class?
|
||||
self.is_a?(Class)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -31,10 +31,10 @@ end
|
||||
# @note This function will only print messages if the debug flag is set to true
|
||||
# @todo Once the console extension has been merged into the core, remove the extension checks.
|
||||
def print_debug(s)
|
||||
config = BeEF::Core::Configuration.instance
|
||||
if config.get('beef.debug') || (BeEF::Extension.is_loaded('console') && BeEF::Extension::Console.verbose?)
|
||||
puts Time.now.localtime.strftime("[%k:%M:%S]")+'[>]'.yellow+' '+s.to_s
|
||||
end
|
||||
config = BeEF::Core::Configuration.instance
|
||||
if config.get('beef.debug') || (BeEF::Extension.is_loaded('console') && BeEF::Extension::Console.verbose?)
|
||||
puts Time.now.localtime.strftime("[%k:%M:%S]")+'[>]'.yellow+' '+s.to_s
|
||||
end
|
||||
end
|
||||
|
||||
# Function used to print successes to the console
|
||||
@@ -49,14 +49,14 @@ end
|
||||
def print_more(s)
|
||||
time = Time.now.localtime.strftime("[%k:%M:%S]")
|
||||
lines = s.split("\n")
|
||||
|
||||
lines.each_with_index do |line, index|
|
||||
|
||||
lines.each_with_index do |line, index|
|
||||
if ((index+1) == lines.size)
|
||||
puts "#{time} |_ #{line}"
|
||||
else
|
||||
puts "#{time} | #{line}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Function used to print over the current line
|
||||
|
||||
@@ -18,5 +18,5 @@ class String
|
||||
# @note Use a gem to colorize the console.
|
||||
# @note http://flori.github.com/term-ansicolor/
|
||||
include Term::ANSIColor
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user