ANSSI-FR/polichombr

View on GitHub

Showing 1,243 of 1,244 total issues

MetasmUtils#self.getArg calls 'di.block.list[i].instruction.args.first.to_s' 2 times
Open

                if (di.block.list[i].opcode.name == 'mov') && (((di.block.list[i].instruction.args.first.to_s == "[esp+0#{arg.to_s(16)}h]") || ((di.block.list[i].instruction.args.first.to_s == 'dword ptr [esp]') && (esp == 0))))
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.getArg calls 'di.opcode.name' 2 times
Open

    if di.opcode.name == 'call'
      i = di.block.list.length
      while i > 0
        if di.block.list[i - 1].address == addrori
          i -= 1
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.find_start_of_function calls 'di.block' 19 times
Open

    return nil unless defined?(di.block)
    while (defined?(di.block.from_normal.length) && !di.block.from_normal.empty?) || (defined?(di.block.from_subfuncret.length) && !di.block.from_subfuncret.empty?)
      if defined?(di.block.from_normal.length)
        i = 0
        while blocks.include?(di.block.from_normal[i]) && (i < di.block.from_normal.length)
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.find_start_of_function calls 'di.block.list[0].block.from_normal.nil?' 2 times
Open

      if di.block.list[0].block.from_normal.nil? && !di.block.list[0].block.from_subfuncret.nil? && (di.block.list[0].block.from_subfuncret.length == 1)
        blocks << di.address
        di = $gdasm.di_at(di.block.list[0].block.from_subfuncret[0])
      elsif
        blocks << di.address
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.getArg calls 'di.block.list' 21 times
Open

      i = di.block.list.length
      while i > 0
        if di.block.list[i - 1].address == addrori
          i -= 1
          while i > 0
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.getArg calls 'di.block.list[i - 1].instruction' 4 times
Open

                return $gdasm.normalize(di.block.list[i - 1].instruction.args.first)
              end
              carg += 1
              esp -= 4
            end
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.getArg calls 'di.block.list[i].instruction.args' 5 times
Open

            if (di.block.list[i].opcode.name == 'call') && (di.block.list[i].instruction.args.first == creg)
              i -= 1
              while i >= 0
                if di.block.list[i].opcode.name == 'push'
                  if carg == arg
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.getArg calls 'di.block.list[i].opcode.name == 'call'' 2 times
Open

            if (di.block.list[i].opcode.name == 'call') && (di.block.list[i].instruction.args.first == creg)
              i -= 1
              while i >= 0
                if di.block.list[i].opcode.name == 'push'
                  if carg == arg
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.getArg calls 'di.opcode' 3 times
Open

    return nil unless defined?(di.opcode)

    carg = 0
    esp = 4 * arg
    if di.opcode.name == 'call'
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.find_start_of_function calls 'di.block.list[0].address' 4 times
Open

      return di.block.list[0].address if $gdasm.function[di.block.list[0].address]
    end
    return di.block.list[0].address if $gdasm.function[di.block.list[0].address]
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.find_start_of_function calls 'di.block.list[0].block.from_normal' 2 times
Open

      if di.block.list[0].block.from_normal.nil? && !di.block.list[0].block.from_subfuncret.nil? && (di.block.list[0].block.from_subfuncret.length == 1)
        blocks << di.address
        di = $gdasm.di_at(di.block.list[0].block.from_subfuncret[0])
      elsif
        blocks << di.address
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.getArg calls 'di.block.list[i - 1].instruction.args' 4 times
Open

                return $gdasm.normalize(di.block.list[i - 1].instruction.args.first)
              end
              carg += 1
              esp -= 4
            end
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.getArg calls 'esp == 0' 2 times
Open

            if (di.block.list[i - 1].opcode.name == 'mov') && ((di.block.list[i - 1].instruction.args.first.to_s == "dword ptr [esp+0#{arg.to_s(16)}h]") || (((di.block.list[i - 1].instruction.args.first.to_s == 'dword ptr [esp]') && (esp == 0))))
              return $gdasm.normalize(di.block.list[i - 1].instruction.args.last)
            end

            return nil if di.block.list[i - 1].opcode.name == 'call'
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.getArg calls 'i > 0' 2 times
Open

      while i > 0
        if di.block.list[i - 1].address == addrori
          i -= 1
          while i > 0
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MurmurHash#self.murmur3_32_str_hash calls 'murmur3_32__mmix(k1)' 2 times
Open

      h1 ^= murmur3_32__mmix(k1)
      h1 = murmur3_32_rotl(h1, 13)
      h1 = (h1 * 5 + 0xe6546b64) & MASK32
    end
    unless tail.empty?
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

printSubCallTree calls '@glinestree == 0' 2 times
Open

    log('    [...]') if @glinestree == 0
    return
  end
  getToFunc(fromaddr).each do |tdi_addr|
    next unless isFuncTreeLink(tdi_addr, toaddr)
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

parseInstr calls 'di.to_s.gsub('\', '\\\')' 3 times
Open

  return di.to_s.gsub('\\', '\\\\\\').gsub('"', '\\"') if $SVG.nil?
  ret = nil
  if (di.opcode.name == 'call') && (di.instruction.args.length == 1)
    if di.instruction.args.first.to_s[0..3] == 'loc_'
      ret = di.to_s.gsub('\\', '\\\\\\').gsub('"', '\\"').gsub(di.instruction.args.first.to_s, di.instruction.args.first.to_s)

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils#self.is_looping calls 'tdi.block.address' 2 times
Open

      return true if tdi.block.address == start_address
      next if @blocks_done.include? di.address
      @blocks_done << tdi.block.address
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

calculateSizeSubCallTree calls 'indent.length' 3 times
Open

  return total if indent.length > 5
  getToFunc(fromaddr).each do |tdi_addr|
    next unless isFuncTreeLink(tdi_addr, toaddr)
    tindent = []
    i += 1
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

MetasmUtils has no descriptive comment
Open

class MetasmUtils
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb by reek

Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.

Example

Given

class Dummy
  # Do things...
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [1]:Dummy has no descriptive comment (IrresponsibleModule)

Fixing this is simple - just an explaining comment:

# The Dummy class is responsible for ...
class Dummy
  # Do things...
end
Severity
Category
Status
Source
Language