Class: Relyze::ExecutableFileModel::BasicBlock

Inherits:
Object
  • Object
show all
Defined in:
C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb

Direct Known Subclasses

CodeBlock, DataBlock

Instance Method Summary collapse

Instance Method Details

#add_reference(owner_rva, target_rva, target, flags = nil) ⇒ Object

Add a new reference from this block to a target location.

Parameters:

  • owner_rva (Integer)

    The RVA location where this reference is from. The owner_rva must be inside this block.

  • target_rva (Integer)

    The RVA location where this reference is to. The target_rva must be inside the target bock.

  • target (BasicBlock)

    The target block where this reference is to.

  • flags (Array<Symbol>, nil) (defaults to: nil)

    Optional flags to describe the reference. May contain :controlflow, :true, :false :unconditional. If :controlflow is used, an implicit reference is created, both the owner (this block) and target must be of type :code. If :controlflow is not used, then an explicit reference is created.



1061
1062
1063
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1061

def add_reference( owner_rva, target_rva, target, flags=nil )
    return nil
end

#adjacentBasicBlock

Get the Relyze::ExecutableFileModel::BasicBlock adjacent to this block.

Returns:

  • (BasicBlock)

    The block adjacent to this block



999
1000
1001
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 999

def adjacent
    return nil
end

#code?true, false

Check of this basic block is code.

Returns:

  • (true, false)


903
904
905
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 903

def code?
    return self.type == :code
end

#colorInteger?

Get the color of this block, if any.

Returns:

  • (Integer, nil)

    Nil if no color set otherwise the color value.



977
978
979
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 977

def color
    return nil
end

#color=(color) ⇒ Integer?

Set of clear the color of this block.

Parameters:

  • color (Integer, nil)

    Nil to clear the color otherwise the color value to set.

Returns:

  • (Integer, nil)

    Nil if no color set otherwise the color value.



985
986
987
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 985

def color=( color )
    return color
end

#custom_name?true, false

Returns true if this blocks name was set by either symbols or user input. Returns false if analysis generated the name.

Returns:

  • (true, false)


938
939
940
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 938

def custom_name?
    return false
end

#data?true, false

Check of this basic block is data.

Returns:

  • (true, false)


896
897
898
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 896

def data?
    return self.type == :data
end

#datatypeDataType?

Get the DataType of this block, if any.

Returns:

  • (DataType, nil)

    This blocks data type or nil if none set.



1006
1007
1008
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1006

def datatype
    return nil
end

#datatype=(data_type) ⇒ Relyze::ExecutableFileModel::DataType

Sets this blocks data type. Returning the data type regardless of success or failure.

Parameters:

Returns:



1014
1015
1016
1017
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1014

def datatype=( data_type )
    self.set_datatype( data_type )
    return data_type
end

#display_name(rva = nil) ⇒ String

Get the name of this basic block as displayed in the GUI, which may be displaying mangled or unmangled names depending on the application settings.

Parameters:

  • rva (Integer, nil) (defaults to: nil)

    An optional RVA located in this basic block to use as an offset when composing the name.

Returns:

  • (String)

    the basic block name



947
948
949
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 947

def display_name( rva=nil )
    return nil
end

#jointrue, false

Try to join this block to its adjacent block. If the adjacent block is in a different segment it cannot be joined. If the adjacent block is of a different type is cannot be joined.

Returns:

  • (true, false)


1041
1042
1043
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1041

def join
    return false
end

#lengthInteger

Get this basic blocks length in bytes.

Returns:



931
932
933
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 931

def length
    return 0
end

#name(rva = nil) ⇒ String

Get the name of this basic block.

Parameters:

  • rva (Integer, nil) (defaults to: nil)

    An optional RVA located in this basic block to use as an offset when composing the name.

Returns:

  • (String)

    the basic block name



955
956
957
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 955

def name( rva=nil )
    return nil
end

#name=(name) ⇒ String

Set or clear this blocks custom name.

Parameters:

  • name (String, nil)

    Use a string to set the name. Use nil to clear the name.

Returns:



963
964
965
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 963

def name=( name )
    return name
end

#nearest_boundary(rva) ⇒ Integer

Return the RVA of the nearest boundary which contains the given RVA. For a CodeBlock a boundary is an Instruction. For a DataBlock a boundary is a DataType.

Parameters:

Returns:



1093
1094
1095
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1093

def nearest_boundary( rva )
    return nil
end

#next_boundary(rva) ⇒ Integer

Return the RVA of the next boundary relative to the current boundary at the given RVA. For a CodeBlock a boundary is an Instruction. For a DataBlock a boundary is a DataType.

Parameters:

Returns:



1102
1103
1104
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1102

def next_boundary( rva )
    return nil
end

#previousBasicBlock

Get the Relyze::ExecutableFileModel::BasicBlock previous to this block.

Returns:

  • (BasicBlock)

    The block previous to this block



992
993
994
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 992

def previous
    return nil
end

#previous_boundary(rva) ⇒ Integer

Return the RVA of the previous boundary relative to the current boundary at the given RVA. For a CodeBlock a boundary is an Instruction. For a DataBlock a boundary is a DataType.

Parameters:

Returns:



1084
1085
1086
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1084

def previous_boundary( rva )
    return nil
end

#references(direction = nil) {|ref| ... } ⇒ Array<Relyze::ExecutableFileModel::Reference>?

Get every reference in to and out of this block.

Parameters:

  • direction (Symbol, nil) (defaults to: nil)

    Either :in, :out, :any, or nil for both directions

Yields:

  • (ref)

    yields the ref to the block.

Yield Parameters:

Returns:



1051
1052
1053
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1051

def references( direction=nil )
    return nil
end

#remove_reference(reference) ⇒ Object

Remove a reference out from this block and destroy it.

Parameters:

  • reference (Reference)

    The reference to remove.



1068
1069
1070
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1068

def remove_reference( reference )
    return false
end

#renderString

Render this block to text as it is seen in the GUI.

Returns:

  • (String)

    The full text content of this block.



917
918
919
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 917

def render
    return nil
end

#reprocessBasicBlock

Reprocess this block if possible.

Returns:



1075
1076
1077
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1075

def reprocess
    return self
end

#rvaInteger

Get this basic blocks RVA location.

Returns:



924
925
926
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 924

def rva
    return nil
end

#segmentSegment

Get the Segment this basic block belongs to.

Returns:



970
971
972
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 970

def segment
    return nil
end

#set_datatype(data_type) ⇒ true, false

Sets this blocks data type. Returning true on success of false on failure.

Parameters:

Returns:

  • (true, false)

    True is the data type was set successfully, or false on failure.



1023
1024
1025
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1023

def set_datatype( data_type )
    return false
end

#split(rva, type = nil) ⇒ BasicBlock

Split this block at the RVA location (which must be inside this block).

Parameters:

  • rva (Integer)

    The RVA location to split the block at.

  • type (Symbol, nil) (defaults to: nil)

    The block type for the split portion, :code or :data or nil to split to the same type as self

Returns:

  • (BasicBlock)

    The new block created from the split or nil



1032
1033
1034
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 1032

def split( rva, type=nil )
    return nil
end

#to_sString

Get a simple description of this basic block.

Returns:

  • (String)

    This basic blocks description.



910
911
912
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 910

def to_s
    return "BasicBlock: 0x%08X - %s - %s (%d bytes)" % [ self.rva, self.type, self.name, self.length ]
end