Class: Relyze::ExecutableFileModel::FunctionDataType
- Defined in:
- C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb
Instance Method Summary collapse
-
#add_parameter(name, data_type, index = nil) ⇒ true, false
Add a new parameter to this function.
-
#block(rva) ⇒ Relyze::ExecutableFileModel::CodeBlock?
Get the basic block which both contains a given RVA and belongs to this function, if any.
-
#blocks {|basic_block| ... } ⇒ Array<Relyze::ExecutableFileModel::CodeBlock>?
Get every basic block in this function.
-
#cc ⇒ Symbol?
Get this functions current calling convention if known.
-
#cc=(calling_convention) ⇒ Symbol?
Set this functions current calling convention.
-
#color=(color) ⇒ Object
Set or clear the color of every basic block in the function.
-
#dfs {|basic_block| ... } ⇒ Array<Relyze::ExecutableFileModel::CodeBlock>?
Perform a depth first search over this function from its root block, yielding every block in the search.
-
#diff(functionB) ⇒ Relyze::DiffResults::DiffFunctionResult?
Perform a differential analysis of this function (side A) against another function (side B).
-
#leaf? ⇒ true, false
Check if this a leaf function; a function with no child calls.
-
#library? ⇒ true, false
Check if this a static library function; a function which analysis has identified as originating from a static library used when this executable code was linked.
-
#parameter(index) ⇒ Hash?
Get a description for the parameter at a given zero based index, see #parameters.
-
#parameters {|parameter| ... } ⇒ Object
Get a description of every parameter in this function.
-
#remove_parameter(index) ⇒ true, false
Remove a parameters name at a given index.
-
#return ⇒ Relyze::ExecutableFileModel::DataType?
Get this functions current return type if known.
-
#return=(data_type) ⇒ true, false
Set this functions current return type.
-
#rva ⇒ Integer?
Get this functions RVA if known.
-
#set_parameter_data_type(index, data_type) ⇒ true, false
Set a parameters DataType at a given index.
-
#set_parameter_name(index, name) ⇒ true, false
Set a parameters name at a given index.
-
#stack_block(rva) ⇒ Relyze::ExecutableFileModel::DataBlock?
Get the basic block in this functions stack segment which contains the given RVA location.
-
#stack_blocks {|basic_block| ... } ⇒ Array<Relyze::ExecutableFileModel::DataBlock>?
Get every basic block in this functions stack segment.
-
#stack_delta2rva(delta) ⇒ Integer?
Convert a stack delta value into a stack segment RVA location.
-
#stack_rva2delta(rva) ⇒ Integer
Convert a stack segment RVA location into a stack delta value.
-
#to_graph(display = {}) ⇒ Relyze::Graph::DirectedGraph
Generate a Graph::DirectedGraph object for this functions control flow graph.
-
#to_pseudo(options = {}) ⇒ String?
Decompile this function to pseudo code.
-
#to_tcg ⇒ Relyze::TCG::TCGGraph?
Generate a TCG::TCGGraph for this function.
Methods inherited from DataType
#access, #dup, #modifiers, #name, #size, #to_s, #type
Instance Method Details
#add_parameter(name, data_type, index = nil) ⇒ true, false
Add a new parameter to this function.
505 506 507 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 505 def add_parameter( name, data_type, index=nil ) return false end |
#block(rva) ⇒ Relyze::ExecutableFileModel::CodeBlock?
Get the basic block which both contains a given RVA and belongs to this function, if any.
530 531 532 533 534 535 536 537 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 530 def block( rva ) self.blocks do | b | if( rva >= b.rva and rva < (b.rva + b.length) ) return b end end return nil end |
#blocks {|basic_block| ... } ⇒ Array<Relyze::ExecutableFileModel::CodeBlock>?
Get every basic block in this function. No order is assumed.
522 523 524 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 522 def blocks return nil end |
#cc ⇒ Symbol?
Get this functions current calling convention if known.
400 401 402 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 400 def cc return nil end |
#cc=(calling_convention) ⇒ Symbol?
Set this functions current calling convention.
408 409 410 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 408 def cc=( calling_convention ) return nil end |
#color=(color) ⇒ Object
Set or clear the color of every basic block in the function.
597 598 599 600 601 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 597 def color=( color ) self.blocks do | b | b.color = color end end |
#dfs {|basic_block| ... } ⇒ Array<Relyze::ExecutableFileModel::CodeBlock>?
Perform a depth first search over this function from its root block, yielding every block in the search.
544 545 546 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 544 def dfs return nil end |
#diff(functionB) ⇒ Relyze::DiffResults::DiffFunctionResult?
Perform a differential analysis of this function (side A) against another function (side B).
710 711 712 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 710 def diff( functionB ) nil end |
#leaf? ⇒ true, false
Check if this a leaf function; a function with no child calls.
386 387 388 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 386 def leaf? return false end |
#library? ⇒ true, false
Check if this a static library function; a function which analysis has identified as originating from a static library used when this executable code was linked.
393 394 395 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 393 def library? return false end |
#parameter(index) ⇒ Hash?
Get a description for the parameter at a given zero based index, see #parameters.
477 478 479 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 477 def parameter( index ) return nil end |
#parameters {|parameter| ... } ⇒ Object
Get a description of every parameter in this function.
469 470 471 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 469 def parameters return nil end |
#remove_parameter(index) ⇒ true, false
Remove a parameters name at a given index.
513 514 515 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 513 def remove_parameter( index ) return false end |
#return ⇒ Relyze::ExecutableFileModel::DataType?
Get this functions current return type if known.
415 416 417 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 415 def return return nil end |
#return=(data_type) ⇒ true, false
Set this functions current return type.
423 424 425 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 423 def return=( data_type ) return false end |
#rva ⇒ Integer?
Get this functions RVA if known.
373 374 375 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 373 def rva return nil end |
#set_parameter_data_type(index, data_type) ⇒ true, false
Set a parameters DataType at a given index.
495 496 497 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 495 def set_parameter_data_type( index, data_type ) return false end |
#set_parameter_name(index, name) ⇒ true, false
Set a parameters name at a given index.
486 487 488 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 486 def set_parameter_name( index, name ) return false end |
#stack_block(rva) ⇒ Relyze::ExecutableFileModel::DataBlock?
Get the basic block in this functions stack segment which contains the given RVA location.
569 570 571 572 573 574 575 576 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 569 def stack_block( rva ) self.stack_blocks do | b | if( rva >= b.rva and rva < (b.rva + b.length) ) return b end end return nil end |
#stack_blocks {|basic_block| ... } ⇒ Array<Relyze::ExecutableFileModel::DataBlock>?
Get every basic block in this functions stack segment.
562 563 564 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 562 def stack_blocks return [] end |
#stack_delta2rva(delta) ⇒ Integer?
Convert a stack delta value into a stack segment RVA location.
582 583 584 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 582 def stack_delta2rva( delta ) return nil end |
#stack_rva2delta(rva) ⇒ Integer
Convert a stack segment RVA location into a stack delta value.
590 591 592 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 590 def stack_rva2delta( rva ) return nil end |
#to_graph(display = {}) ⇒ Relyze::Graph::DirectedGraph
Generate a Graph::DirectedGraph object for this functions control flow graph.
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 612 def to_graph( display={} ) graph = ::Relyze::Graph::DirectedGraph.new( 'CFG', { :node_padding => 0 }.merge!( display ) ) self.blocks do | block | source_node = graph.find_or_create_node( block ) source_node.display[:rva] = block.rva if( not block.color.nil? ) source_node.display[:node_background_color] = graph.color2html( block.color ) end if( block.rva == self.rva ) graph.root = source_node end block.references( :out ) do | ref | next if not ref.control_flow? next if ref.target.nil? if( not ref.implicit? ) inst = block.instruction( ref.owner_rva ) if( inst.nil? or ( inst.branch? and (inst.branch_type != :conditional_jump and inst.branch_type != :unconditional_jump) ) ) next end end target_node = graph.find_or_create_node( ref.target ) target_node.display[:rva] = ref.target.rva edge = graph.create_edge( source_node, target_node, ref ) case ref.control_flow_condition when :true edge.display[:edge_color] = "#16A085" when :false edge.display[:edge_color] = "#C0392B" when :unconditional edge.display[:edge_color] = "#3498DB" else end end end return graph end |
#to_pseudo(options = {}) ⇒ String?
Decompile this function to pseudo code.
684 685 686 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 684 def to_pseudo( ={} ) return nil end |
#to_tcg ⇒ Relyze::TCG::TCGGraph?
Generate a TCG::TCGGraph for this function.
673 674 675 |
# File 'C:/Program Files/Relyze/lib/relyze/core/executable_file_model.rb', line 673 def to_tcg return nil end |