Class: Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::FakeFunctionCollection
- Inherits:
-
Object
- Object
- Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::FakeFunctionCollection
- Defined in:
- lib/metasploit/framework/obfuscation/crandomizer/code_factory/fake_function_collection.rb
Instance Attribute Summary collapse
-
#functions ⇒ Object
Returns the value of attribute functions.
-
#max_functions ⇒ Object
readonly
Returns the value of attribute max_functions.
Instance Method Summary collapse
-
#each ⇒ Object
Yields a list of fake functions available.
-
#empty? ⇒ Boolean
Checks if the collection is empty or not.
-
#has_function_name?(name) ⇒ Boolean
Asks the FakeFunctionCollection if a function is available.
-
#initialize(max_functions) ⇒ Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::FakeFunctionCollection
constructor
Initializes a Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::FakeFunctionCollection instance.
-
#sample ⇒ Metasm::C::Declaration
Returns a fake Metasm::C::Declaration from the FakeFunctionCollection object.
-
#to_s ⇒ Object
Returns a string that joins the fake functions.
Constructor Details
#initialize(max_functions) ⇒ Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::FakeFunctionCollection
Initializes a Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::FakeFunctionCollection instance.
17 18 19 20 21 22 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/fake_function_collection.rb', line 17 def initialize(max_functions) @functions = [] @max_functions = max_functions populate self end |
Instance Attribute Details
#functions ⇒ Object
Returns the value of attribute functions.
10 11 12 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/fake_function_collection.rb', line 10 def functions @functions end |
#max_functions ⇒ Object (readonly)
Returns the value of attribute max_functions.
11 12 13 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/fake_function_collection.rb', line 11 def max_functions @max_functions end |
Instance Method Details
#each ⇒ Object
Yields a list of fake functions available.
25 26 27 28 29 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/fake_function_collection.rb', line 25 def each functions.each do |f| yield f end end |
#empty? ⇒ Boolean
Checks if the collection is empty or not.
58 59 60 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/fake_function_collection.rb', line 58 def empty? functions.empty? end |
#has_function_name?(name) ⇒ Boolean
Asks the FakeFunctionCollection if a function is available.
47 48 49 50 51 52 53 54 55 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/fake_function_collection.rb', line 47 def has_function_name?(name) functions.each do |f| if f.var.name == name return true end end false end |
#sample ⇒ Metasm::C::Declaration
Returns a fake Metasm::C::Declaration from the FakeFunctionCollection object.
34 35 36 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/fake_function_collection.rb', line 34 def sample functions.sample end |
#to_s ⇒ Object
Returns a string that joins the fake functions
39 40 41 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/fake_function_collection.rb', line 39 def to_s functions.join("\n") end |