Class: Metasploit::Framework::Obfuscation::CRandomizer::Utility

Inherits:
Object
  • Object
show all
Defined in:
lib/metasploit/framework/obfuscation/crandomizer/utility.rb

Class Method Summary collapse

Class Method Details

.parse(code) ⇒ Metasm::C::Parser

Returns a Metasm parser.

Parameters:

  • code (String)

    The C code to parse.

Returns:

  • (Metasm::C::Parser)

29
30
31
32
33
34
# File 'lib/metasploit/framework/obfuscation/crandomizer/utility.rb', line 29

def self.parse(code)
  parser = Metasm::C::Parser.new
  parser.allow_bad_c = true
  parser.parse(code)
  parser
end

.rand_intInteger

Returns a random number.

Returns:

  • (Integer)

14
15
16
# File 'lib/metasploit/framework/obfuscation/crandomizer/utility.rb', line 14

def self.rand_int
  SecureRandom.random_number(100000000)
end

.rand_stringString

Returns a random string.

Returns:

  • (String)

21
22
23
# File 'lib/metasploit/framework/obfuscation/crandomizer/utility.rb', line 21

def self.rand_string
  SecureRandom.hex
end