rapid7/ruby_smb

View on GitHub

Showing 126 of 299 total issues

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

        unless open_key_response.error_status == WindowsError::Win32::ERROR_SUCCESS
          raise RubySMB::Dcerpc::Error::WinregError, "Error returned when opening subkey #{sub_key}: "\
            "#{WindowsError::Win32.find_by_retval(open_key_response.error_status.value).join(',')}"
Severity: Major
Found in lib/ruby_smb/dcerpc/winreg.rb and 8 other locations - About 15 mins to fix
lib/ruby_smb/dcerpc/samr.rb on lines 964..967
lib/ruby_smb/dcerpc/svcctl.rb on lines 325..328
lib/ruby_smb/dcerpc/svcctl.rb on lines 351..354
lib/ruby_smb/dcerpc/winreg.rb on lines 89..92
lib/ruby_smb/dcerpc/winreg.rb on lines 145..147
lib/ruby_smb/dcerpc/winreg.rb on lines 159..161
lib/ruby_smb/dcerpc/winreg.rb on lines 288..290
lib/ruby_smb/dcerpc/winreg.rb on lines 316..318

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

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 9 locations. Consider refactoring.
Open

        unless create_key_response.error_status == WindowsError::Win32::ERROR_SUCCESS
          raise RubySMB::Dcerpc::Error::WinregError, "Error returned when creating key #{sub_key}: "\
            "#{WindowsError::Win32.find_by_retval(create_key_response.error_status.value).join(',')}"
Severity: Major
Found in lib/ruby_smb/dcerpc/winreg.rb and 8 other locations - About 15 mins to fix
lib/ruby_smb/dcerpc/samr.rb on lines 964..967
lib/ruby_smb/dcerpc/svcctl.rb on lines 325..328
lib/ruby_smb/dcerpc/svcctl.rb on lines 351..354
lib/ruby_smb/dcerpc/winreg.rb on lines 89..92
lib/ruby_smb/dcerpc/winreg.rb on lines 118..120
lib/ruby_smb/dcerpc/winreg.rb on lines 145..147
lib/ruby_smb/dcerpc/winreg.rb on lines 159..161
lib/ruby_smb/dcerpc/winreg.rb on lines 316..318

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

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 9 locations. Consider refactoring.
Open

        unless save_key_response.error_status == WindowsError::Win32::ERROR_SUCCESS
          raise RubySMB::Dcerpc::Error::WinregError, "Error returned when saving key to #{file_name}: "\
            "#{WindowsError::Win32.find_by_retval(save_key_response.error_status.value).join(',')}"
Severity: Major
Found in lib/ruby_smb/dcerpc/winreg.rb and 8 other locations - About 15 mins to fix
lib/ruby_smb/dcerpc/samr.rb on lines 964..967
lib/ruby_smb/dcerpc/svcctl.rb on lines 325..328
lib/ruby_smb/dcerpc/svcctl.rb on lines 351..354
lib/ruby_smb/dcerpc/winreg.rb on lines 89..92
lib/ruby_smb/dcerpc/winreg.rb on lines 118..120
lib/ruby_smb/dcerpc/winreg.rb on lines 145..147
lib/ruby_smb/dcerpc/winreg.rb on lines 159..161
lib/ruby_smb/dcerpc/winreg.rb on lines 288..290

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

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 2 locations. Consider refactoring.
Open

      when lookup_table['ntPwdHistory']
        tmp_nt_history = client.decrypt_attribute_value(attribute_value)
        tmp_nt_history.bytes.each_slice(16) do |block|
          nt_history << client.remove_des_layer(block.map(&:chr).join, rid)
Severity: Minor
Found in examples/dump_secrets_from_sid.rb and 1 other location - About 15 mins to fix
examples/dump_secrets_from_sid.rb on lines 130..133

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

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 9 locations. Consider refactoring.
Open

        unless open_service_w_response.error_status == WindowsError::Win32::ERROR_SUCCESS
          raise RubySMB::Dcerpc::Error::SvcctlError,
            "Error returned when opening #{service_name} service: "\
            "#{WindowsError::Win32.find_by_retval(open_service_w_response.error_status.value).join(',')}"
Severity: Major
Found in lib/ruby_smb/dcerpc/svcctl.rb and 8 other locations - About 15 mins to fix
lib/ruby_smb/dcerpc/samr.rb on lines 964..967
lib/ruby_smb/dcerpc/svcctl.rb on lines 325..328
lib/ruby_smb/dcerpc/winreg.rb on lines 89..92
lib/ruby_smb/dcerpc/winreg.rb on lines 118..120
lib/ruby_smb/dcerpc/winreg.rb on lines 145..147
lib/ruby_smb/dcerpc/winreg.rb on lines 159..161
lib/ruby_smb/dcerpc/winreg.rb on lines 288..290
lib/ruby_smb/dcerpc/winreg.rb on lines 316..318

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

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 2 locations. Consider refactoring.
Open

      when lookup_table['lmPwdHistory']
        tmp_lm_history = client.decrypt_attribute_value(attribute_value)
        tmp_lm_history.bytes.each_slice(16) do |block|
          lm_history << client.remove_des_layer(block.map(&:chr).join, rid)
Severity: Minor
Found in examples/dump_secrets_from_sid.rb and 1 other location - About 15 mins to fix
examples/dump_secrets_from_sid.rb on lines 135..138

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

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