rapid7/metasploit-framework

View on GitHub

Showing 21,886 of 21,886 total issues

Method do_login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def do_login(user, pass)
          # prep the data needed for login
          protocol = ssl ? 'https' : 'http'
          # attempt to get an authentication token
          auth_token_res = get_auth_token(user)
Severity: Minor
Found in lib/metasploit/framework/login_scanner/softing_sis.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method hosts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def hosts(opts = {})
    begin
      self.data_service_operation do |data_service|
        opts[:non_dead] = false unless opts.has_key?(:non_dead)
        opts[:address] = opts.delete(:address) || opts.delete(:host)
Severity: Minor
Found in lib/metasploit/framework/data_service/proxy/host_data_proxy.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method attempt_login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def attempt_login(credential)
          result_opts = {
              credential: credential,
              host: host,
              port: port,
Severity: Minor
Found in lib/metasploit/framework/login_scanner/wordpress_rpc.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

                for root, dirs, files in os.walk('./src/stage/'):
                    for name in files:
                        build(name[:-4])
Severity: Major
Found in external/source/shellcode/windows/x86/build.py and 5 other locations - About 45 mins to fix
external/source/shellcode/windows/x86/build.py on lines 109..111
external/source/shellcode/windows/x86/build.py on lines 112..114
external/source/shellcode/windows/x86/build.py on lines 115..117
external/source/shellcode/windows/x86/build.py on lines 121..123
external/source/shellcode/windows/x86/build.py on lines 124..126

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 35.

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

Method modify_function has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

          def modify_function(s)
            function_statements = s.var.initializer.statements
            new_function_statements = []

            function_statements.each do |func_stmt|
Severity: Minor
Found in lib/metasploit/framework/obfuscation/crandomizer/modifier.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

                for root, dirs, files in os.walk('./src/stager/'):
                    for name in files:
                        build(name[:-4])
Severity: Major
Found in external/source/shellcode/windows/x86/build.py and 5 other locations - About 45 mins to fix
external/source/shellcode/windows/x86/build.py on lines 109..111
external/source/shellcode/windows/x86/build.py on lines 112..114
external/source/shellcode/windows/x86/build.py on lines 115..117
external/source/shellcode/windows/x86/build.py on lines 118..120
external/source/shellcode/windows/x86/build.py on lines 124..126

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 35.

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

Method CfConvertToPlaceholder has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

            SafeHandle FileHandle,
            IntPtr FileIdentity,
            int FileIdentityLength,
            CF_CONVERT_FLAGS ConvertFlags,
            out long ConvertUsn,

    Avoid deeply nested control flow statements.
    Open

                  elsif info =~ /sh: id: not found/
                    info = ssh_socket.exec!("vmware -v\n").to_s
                  else
                    info << ssh_socket.exec!("help\n?\n\n\n").to_s
    Severity: Major
    Found in lib/metasploit/framework/ssh/platform.rb - About 45 mins to fix

      Method parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def parse(request,result)
          return unless result['Content-Type'].include?('text/html')
      
          doc = Nokogiri::HTML(result.body.to_s)
          doc.css('link').each do |link|
      Severity: Minor
      Found in data/msfcrawler/link.rb - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method CreateThread has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);
      Severity: Minor
      Found in external/source/psh_exe/dot_net_service.cs - About 45 mins to fix

        Method print_results has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def print_results(doc, action)
                  response = "#{action}Response"
                  result = "#{action}Result"
                  resource = /[A-Z][a-z]+([A-Za-z]+)/.match(action)[1]
        
        
        Severity: Minor
        Found in lib/metasploit/framework/aws/client.rb - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Avoid deeply nested control flow statements.
        Open

                    s[:lmhash] = "00" * 24 if s[:lmhash] == s[:ntlmhash]
        Severity: Major
        Found in data/exploits/psnuffle/smb.rb - About 45 mins to fix

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

                          for root, dirs, files in os.walk('./src/egghunter/'):
                              for name in files:
                                  build(name[:-4])
          Severity: Major
          Found in external/source/shellcode/windows/x86/build.py and 5 other locations - About 45 mins to fix
          external/source/shellcode/windows/x86/build.py on lines 112..114
          external/source/shellcode/windows/x86/build.py on lines 115..117
          external/source/shellcode/windows/x86/build.py on lines 118..120
          external/source/shellcode/windows/x86/build.py on lines 121..123
          external/source/shellcode/windows/x86/build.py on lines 124..126

          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 35.

          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

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

                          for root, dirs, files in os.walk('./src/kernel/'):
                              for name in files:
                                  build(name[:-4])
          Severity: Major
          Found in external/source/shellcode/windows/x86/build.py and 5 other locations - About 45 mins to fix
          external/source/shellcode/windows/x86/build.py on lines 109..111
          external/source/shellcode/windows/x86/build.py on lines 112..114
          external/source/shellcode/windows/x86/build.py on lines 115..117
          external/source/shellcode/windows/x86/build.py on lines 118..120
          external/source/shellcode/windows/x86/build.py on lines 121..123

          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 35.

          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

          Method write has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def write(buf, opts={})
          
                    return super(buf, opts) if not @evasive
          
                    ret = 0
          Severity: Minor
          Found in lib/metasploit/framework/tcp/client.rb - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Avoid deeply nested control flow statements.
          Open

                      s[:lmhash] = "00" * 24 if s[:lmhash] == '' or s[:lmhash] =~ /^(00)*$/m
          Severity: Major
          Found in data/exploits/psnuffle/smb.rb - About 45 mins to fix

            Method CreateThread has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private static extern IntPtr CreateThread(IntPtr lpThreadAttributes, UIntPtr dwStackSize, IntPtr lpStartAddress, IntPtr param, Int32 dwCreationFlags, ref IntPtr lpThreadId);
            Severity: Minor
            Found in external/source/SqlClrPayload/StoredProcedures.cs - About 45 mins to fix

              Method parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def parse(request,result)
              
                  return unless result['Content-Type'].include?('text/html')
              
                  doc = Nokogiri::HTML(result.body.to_s)
              Severity: Minor
              Found in data/msfcrawler/frames.rb - About 45 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

                              for root, dirs, files in os.walk('./src/migrate/'):
                                  for name in files:
                                      build(name[:-4])
              Severity: Major
              Found in external/source/shellcode/windows/x86/build.py and 5 other locations - About 45 mins to fix
              external/source/shellcode/windows/x86/build.py on lines 109..111
              external/source/shellcode/windows/x86/build.py on lines 115..117
              external/source/shellcode/windows/x86/build.py on lines 118..120
              external/source/shellcode/windows/x86/build.py on lines 121..123
              external/source/shellcode/windows/x86/build.py on lines 124..126

              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 35.

              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

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

                              for root, dirs, files in os.walk('./src/single/'):
                                  for name in files:
                                      build(name[:-4])
              Severity: Major
              Found in external/source/shellcode/windows/x86/build.py and 5 other locations - About 45 mins to fix
              external/source/shellcode/windows/x86/build.py on lines 109..111
              external/source/shellcode/windows/x86/build.py on lines 112..114
              external/source/shellcode/windows/x86/build.py on lines 118..120
              external/source/shellcode/windows/x86/build.py on lines 121..123
              external/source/shellcode/windows/x86/build.py on lines 124..126

              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 35.

              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