Class: Indis::MachO::PVarsSectionAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/indis-macho/analyzers/pvars_section_analyzer.rb

Instance Method Summary (collapse)

Constructor Details

- (PVarsSectionAnalyzer) initialize(target)



24
25
26
27
# File 'lib/indis-macho/analyzers/pvars_section_analyzer.rb', line 24

def initialize(target)
  @target = target
  target.subscribe_for_event(:target_section_processed, self)
end

Instance Method Details

- (Object) target_section_processed(sect)



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/indis-macho/analyzers/pvars_section_analyzer.rb', line 29

def target_section_processed(sect)
  return unless sect.name == '__program_vars'
  return unless sect.vmsize == 20
  e = DataEntity.new(sect.vmaddr+4*0, 4, @target.vmmap)
  e.tags[:meta] = 'ProgramVars.mh'
  @target.vmmap.map(e)
  e = DataEntity.new(sect.vmaddr+4*1, 4, @target.vmmap)
  e.tags[:meta] = 'ProgramVars.NXArgcPtr'
  @target.vmmap.map(e)
  e = DataEntity.new(sect.vmaddr+4*2, 4, @target.vmmap)
  e.tags[:meta] = 'ProgramVars.NXArgvPtr'
  @target.vmmap.map(e)
  e = DataEntity.new(sect.vmaddr+4*3, 4, @target.vmmap)
  e.tags[:meta] = 'ProgramVars.environPtr'
  @target.vmmap.map(e)
  e = DataEntity.new(sect.vmaddr+4*4, 4, @target.vmmap)
  e.tags[:meta] = 'ProgramVars.__prognamePtr'
  @target.vmmap.map(e)
end