ANSSI-FR/polichombr

View on GitHub

Showing 1,243 of 1,244 total issues

MetasmUtils#self.is_linked_block calls 'di.block' 3 times
Open

    return result unless defined?(di.block)
    return result if di.block.to_normal.nil?
    di.block.to_normal.each do |tdi_addr|
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 'str.bytesize' 2 times
Open

    tailn = str.bytesize % 4
    tail = numbers.slice!(numbers.size - tailn, tailn)
    for k1 in numbers
      h1 ^= murmur3_32__mmix(k1)
      h1 = murmur3_32_rotl(h1, 13)
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.

checkCall calls 'basefunc.nil?' 4 times
Open

  unless basefunc.nil?
    log('')
    log("Top of function : #{PoliUtils.poliLinkAddr(basefunc)} ; Top of block : #{PoliUtils.poliLinkAddr($gdasm.di_at(xrefCall).block.list[0].address)}")
    log('')
  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.

printSubCallTree calls 'indent.length' 3 times
Open

  if indent.length > 9
    log(space1 + '       +- [...]')
    @glinestree -= 1
    log('    [...]') if @glinestree == 0
    return
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.

repareIatLinks calls 'di.instruction.args.last' 7 times
Open

    next unless (di.opcode.name == 'mov') && defined?(di.instruction.args.last.symbolic.target)
    label = $gdasm.get_label_at(di.instruction.args.last.symbolic.target.bind.reduce)
    if label =~ /^iat_/
      if $gdasm.xrefs[di.instruction.args.last.symbolic.target.bind.reduce].nil?
        $gdasm.xrefs[di.instruction.args.last.symbolic.target.bind.reduce] = [di.instruction.args.last.symbolic.target.bind.reduce, di]
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.

repareIatLinks calls 'di.instruction.args.last.symbolic.target' 7 times
Open

    next unless (di.opcode.name == 'mov') && defined?(di.instruction.args.last.symbolic.target)
    label = $gdasm.get_label_at(di.instruction.args.last.symbolic.target.bind.reduce)
    if label =~ /^iat_/
      if $gdasm.xrefs[di.instruction.args.last.symbolic.target.bind.reduce].nil?
        $gdasm.xrefs[di.instruction.args.last.symbolic.target.bind.reduce] = [di.instruction.args.last.symbolic.target.bind.reduce, di]
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.

checkCall calls '@tbComments[xrefCall]' 3 times
Open

          @tbComments[xrefCall] += ' (CLSID_InternetExplorer)'
          AddTagFunction(basefunc, 'Net_') unless basefunc.nil?
        end
        if strArg.casecmp('{0002DF05-0000-0000-C000-000000000046}') == 0
          strArg += ' (IID_IWebBrowserApp)'
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.is_looping calls 'tdi.block' 3 times
Open

      next unless defined?(tdi.block)
      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.

MetasmUtils#self.is_linked_block calls 'tdi.block' 3 times
Open

      next unless defined?(tdi.block)
      return true if tdi.block.address == start_address
      next if @blocks_done.include? tdi.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.

checkCall calls '$gdasm.decode_dword(carg)' 4 times
Open

      strArg = if $gdasm.decode_dword(carg)
                 "0x#{$gdasm.decode_dword(carg).to_s(16)}"
               else
                 ''
                 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.

printSubCallTree calls 'log(' [...]')' 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.

parse_some_string calls 'di.block.list[0]' 3 times
Open

  if defined?(di.block) && defined?(di.block.list[0]) && defined?(di.block.list[0].address)
    tbloc = 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.

checkCall calls 'log('')' 2 times
Open

    log('')
    log("Top of function : #{PoliUtils.poliLinkAddr(basefunc)} ; Top of block : #{PoliUtils.poliLinkAddr($gdasm.di_at(xrefCall).block.list[0].address)}")
    log('')
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.

printCallTree calls 'log("\n")' 3 times
Open

  log("\n")
  if calculateSizeSubCallTree(fromaddr, toaddr, [[0, false]], countSubCallTree(fromaddr, toaddr)) > 20
    @glinestree = 40
  end
  log("    - #{PoliUtils.poliLinkAddr(fromaddr)} (entrypoint/EAT/TLS)")
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.

repareIatLinks calls 'di.instruction.args.last.symbolic.target.bind' 6 times
Open

    label = $gdasm.get_label_at(di.instruction.args.last.symbolic.target.bind.reduce)
    if label =~ /^iat_/
      if $gdasm.xrefs[di.instruction.args.last.symbolic.target.bind.reduce].nil?
        $gdasm.xrefs[di.instruction.args.last.symbolic.target.bind.reduce] = [di.instruction.args.last.symbolic.target.bind.reduce, di]
      elsif !$gdasm.xrefs[di.instruction.args.last.symbolic.target.bind.reduce].include? di
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.instruction.args.first.to_s' 3 times
Open

    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.

PoliUtils has no descriptive comment
Open

class PoliUtils
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

checkCall calls 'AddTagFunction(basefunc, 'Net_')' 2 times
Open

          AddTagFunction(basefunc, 'Net_') unless basefunc.nil?
        end
        if strArg.casecmp('{0002DF05-0000-0000-C000-000000000046}') == 0
          strArg += ' (IID_IWebBrowserApp)'
          @tbComments[xrefCall] += ' (IID_IWebBrowserApp)'
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.

printCallTree calls 'log('')' 2 times
Open

  log('')
  log('Call tree from entry point to function :')
  log('')
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 'indent.each' 3 times
Open

  indent.each do |_id, iscontinue|
    space1 += '       '
    space1 += if iscontinue
                '|'
              else
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.

Severity
Category
Status
Source
Language