Module: Ronin::Support::Binary::CTypes::Mixin

Included in:
Array, Buffer, Stack, Stream, Struct, Template
Defined in:
lib/ronin/support/binary/ctypes/mixin.rb

Overview

Adds a type system that can be used by Memory objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#arch:x86, ... (readonly)

The desired architecture of the binary format.

Returns:

  • (:x86, :x86_64, :ppc, :ppc64, :arm, :arm_be, :arm64, :arm64_be, :mips, :mips_le, :mips64, :mips64_le, nil)


44
45
46
# File 'lib/ronin/support/binary/ctypes/mixin.rb', line 44

def arch
  @arch
end

#endian:little, ... (readonly)

The endianness of the binary format.

Returns:

  • (:little, :big, :net, nil)


36
37
38
# File 'lib/ronin/support/binary/ctypes/mixin.rb', line 36

def endian
  @endian
end

#os:linux, ... (readonly)

The desired Operating System (OS) of the binary format.

Returns:

  • (:linux, :macos, :windows, :bsd, :freebsd, :openbsd, :netbsd, nil)


52
53
54
# File 'lib/ronin/support/binary/ctypes/mixin.rb', line 52

def os
  @os
end

#type_resolverResolver (readonly)

The type resolver.

Returns:

  • (Resolver)


77
78
79
# File 'lib/ronin/support/binary/ctypes/mixin.rb', line 77

def type_resolver
  @type_resolver
end

#type_systemNative, ... (readonly)

The type system module or object to lookup type names in.



70
71
72
# File 'lib/ronin/support/binary/ctypes/mixin.rb', line 70

def type_system
  @type_system
end

Instance Method Details

#initialize_type_system(type_system: nil, endian: nil, arch: nil, os: nil) ⇒ Object (protected)

Initializes the type system.

Optional type system to use instead.

The desired architecture to use.

The Operating System (OS) to use.

Parameters:



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/ronin/support/binary/ctypes/mixin.rb', line 113

def initialize_type_system(type_system: nil,
                           endian:      nil,
                           arch:        nil,
                           os:          nil)
  @endian = endian
  @arch   = arch
  @os     = os

  @type_system = type_system || CTypes.platform(
                                  endian: endian,
                                  arch:   arch,
                                  os:     os
                                )

  @type_resolver = CTypes::TypeResolver.new(@type_system)
end