Class: Metasploit::Framework::Obfuscation::CRandomizer::RandomStatements
- Inherits:
-
Object
- Object
- Metasploit::Framework::Obfuscation::CRandomizer::RandomStatements
- Defined in:
- lib/metasploit/framework/obfuscation/crandomizer/random_statements.rb
Instance Attribute Summary collapse
-
#fake_function_collection ⇒ Object
readonly
Returns the value of attribute fake_function_collection.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#statements ⇒ Object
readonly
Returns the value of attribute statements.
Instance Method Summary collapse
-
#get ⇒ Array<Metasm::C::CExpression>, Array<Metasm::C::Declaration>
Returns a random statement.
-
#initialize(p, fake_functions, s = nil) ⇒ RandomStatements
constructor
Initializes the RandomStatements class.
Constructor Details
#initialize(p, fake_functions, s = nil) ⇒ RandomStatements
Initializes the RandomStatements class.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/random_statements.rb', line 18 def initialize(p, fake_functions, s=nil) @parser = p @fake_function_collection = fake_functions @statements = [ Proc.new { get_random_statements } ] # Only generate fake function calls when the function we are modifying isn't # from one of those fake functions (to avoid a recursion). if s && fake_function_collection && !fake_function_collection.has_function_name?(s.var.name) @statements << Proc.new { get_random_function_call } end end |
Instance Attribute Details
#fake_function_collection ⇒ Object (readonly)
Returns the value of attribute fake_function_collection.
11 12 13 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/random_statements.rb', line 11 def fake_function_collection @fake_function_collection end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
10 11 12 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/random_statements.rb', line 10 def parser @parser end |
#statements ⇒ Object (readonly)
Returns the value of attribute statements.
12 13 14 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/random_statements.rb', line 12 def statements @statements end |
Instance Method Details
#get ⇒ Array<Metasm::C::CExpression>, Array<Metasm::C::Declaration>
Returns a random statement.
34 35 36 |
# File 'lib/metasploit/framework/obfuscation/crandomizer/random_statements.rb', line 34 def get statements.sample.call end |