ANSSI-FR/polichombr

View on GitHub

Showing 1,243 of 1,244 total issues

parseInstr calls 'di.instruction.args.first' 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.

parseInstr calls 'di.to_s.gsub('\', '\\\').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.

parseInstr calls 'di.instruction' 4 times
Open

  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 'di.block.to_normal' 2 times
Open

    return result if di.block.to_normal.nil?
    start_address = di.block.address

    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_fmix calls 'h >> 16' 2 times
Open

    h ^= h >> 16
    h = (h * 0x85ebca6b) & MASK32
    h ^= h >> 13
    h = (h * 0xc2b2ae35) & MASK32
    h ^ (h >> 16)
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' 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.

MetasmUtils#self.is_linked_block calls 'di.block.to_normal' 2 times
Open

    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.

checkCall calls '$gdasm.read_raw_data(carg, 0x10)' 2 times
Open

      if $gdasm.read_raw_data(carg, 0x10)
        strArg = $gdasm.read_raw_data(carg, 0x10).unpack('C*').map { |a| '\\x' + a.to_s(16) }.join
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' 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.

printCallTree calls '@glinestree < 1' 2 times
Open

    log("\n") if @glinestree < 1
    return if @glinestree < 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.

Avoid too many return statements within this method.
Open

                  return di.block.list[i].instruction.args.last
Severity: Major
Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return di.block.list[0].address if $gdasm.function[di.block.list[0].address]
    Severity: Major
    Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      @apiview.route('/samples/<int:sid>/analysis/analyzeit/', methods=['GET'])
      @login_required
      def api_get_sample_analyzeit(sid):
          return jsonify({'analyzeit': 'Not implemented'})
      Severity: Major
      Found in polichombr/views/api_sample.py and 3 other locations - About 30 mins to fix
      polichombr/views/api_sample.py on lines 128..131
      polichombr/views/api_sample.py on lines 140..143
      polichombr/views/api_sample.py on lines 146..149

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 32.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Avoid too many return statements within this method.
      Open

                          return $gdasm.normalize(di.block.list[i].instruction.args.first)
      Severity: Major
      Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        @apiview.route('/samples/<int:sid>/analysis/peinfo/', methods=['GET'])
        @login_required
        def api_get_sample_peinfo(sid):
            return jsonify({'peinfo': 'not implemented'})
        Severity: Major
        Found in polichombr/views/api_sample.py and 3 other locations - About 30 mins to fix
        polichombr/views/api_sample.py on lines 128..131
        polichombr/views/api_sample.py on lines 134..137
        polichombr/views/api_sample.py on lines 140..143

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 32.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Avoid too many return statements within this method.
        Open

                      return nil
        Severity: Major
        Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

          @apiview.route('/samples/<int:sid>/analysis/', methods=['GET'])
          @login_required
          def api_get_sample_full_analysis(sid):
              return jsonify({'analysis': 'Not implemented'})
          Severity: Major
          Found in polichombr/views/api_sample.py and 3 other locations - About 30 mins to fix
          polichombr/views/api_sample.py on lines 134..137
          polichombr/views/api_sample.py on lines 140..143
          polichombr/views/api_sample.py on lines 146..149

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 32.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Avoid too many return statements within this method.
          Open

                return true if is_linked_block(tdi, start_address)
          Severity: Major
          Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return nil if di.block.list[i].opcode.name == 'call'
            Severity: Major
            Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

              @apiview.route('/samples/<int:sid>/analysis/strings/', methods=['GET'])
              @login_required
              def api_get_sample_strings(sid):
                  return jsonify({'strings': 'Not implemented'})
              Severity: Major
              Found in polichombr/views/api_sample.py and 3 other locations - About 30 mins to fix
              polichombr/views/api_sample.py on lines 128..131
              polichombr/views/api_sample.py on lines 134..137
              polichombr/views/api_sample.py on lines 146..149

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 32.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language