Added is_present, is_enabled, is_loaded helper functions for Extensions / Modules

git-svn-id: https://beef.googlecode.com/svn/trunk@935 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
passbe
2011-04-27 04:33:10 +00:00
parent b9818239e3
commit 90e0b30c78
2 changed files with 31 additions and 1 deletions

View File

@@ -1,5 +1,20 @@
module BeEF
module Extension
# Checks to see if extensions is in configuration
def self.is_present(ext)
return BeEF::Core::Configuration.instance.get('beef.extension').has_key?(ext.to_s)
end
# Checks to see if extension is enabled in configuration
def self.is_enabled(ext)
return (self.is_present(ext) and BeEF::Core::Configuration.instance.get('beef.extension.'+ext.to_s+'.enable') == true)
end
# Checks to see if extensions reports loaded through the configuration
def self.is_loaded(ext)
return (self.is_enabled(ext) and BeEF::Core::Configuration.instance.get('beef.extension.'+ext.to_s+'.loaded') == true)
end
end
end

View File

@@ -1,10 +1,25 @@
module BeEF
module Module
# Checks to see if module is in configuration
def self.is_present(mod)
return BeEF::Core::Configuration.instance.get('beef.module').has_key?(mod.to_s)
end
# Checks to see if module is enabled in configuration
def self.is_enabled(mod)
return (self.is_present(mod) and BeEF::Core::Configuration.instance.get('beef.module.'+mod.to_s+'.enable') == true)
end
# Checks to see if the module reports that it has loaded through the configuration
def self.is_loaded(mod)
return (self.is_enabled(mod) and BeEF::Core::Configuration.instance.get('beef.module.'+mod.to_s+'.loaded') == true)
end
# Returns category name in a system folder format
def self.safe_category(cat)
return cat.to_s.strip.downcase.sub(/\s/, '_')
end
end
end