/
githubmirror
/
metasploit-framework
Обзор
Документация
Войти
/
githubmirror
/
metasploit-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
lib/metasploit/framework/compiler/headers/base.rb
44 строки
1 KB
Wei Chen
Add compiler support capable of including headers.
10 май 2018, 08:33
10 май 2018, 08:33
caf0711
Код
Авторство
О чём код?
module Metasploit module Framework module Compiler module Headers class Base attr_accessor :loaded_dep # Initializes the Base class for headers. def initialize # This is used to avoid loading the same dependency code twice @loaded_dep = [] end # Returns the header source code. # # @param lib_name [String] The file name of the header. # @return [String] def include(lib_name) lib = lib_dep_map[lib_name] unless lib raise RuntimeError, "#{lib_name} not found" end # Load the dependencies first, and only once dep = '' lib.each do |f| unless loaded_dep.include?(f) dep_path = File.join(headers_path, f) dep << File.read(dep_path) << "\n" loaded_dep << f end end # Load the headers lib_path = File.join(headers_path, lib_name) "#{dep}#{File.read(lib_path)}" end end end end end end