rapid7/ruby_smb

View on GitHub

Showing 310 of 310 total issues

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 97..100
lib/ruby_smb/dcerpc/winreg.rb on lines 123..125
lib/ruby_smb/dcerpc/winreg.rb on lines 151..153
lib/ruby_smb/dcerpc/winreg.rb on lines 165..167
lib/ruby_smb/dcerpc/winreg.rb on lines 294..296
lib/ruby_smb/dcerpc/winreg.rb on lines 322..324

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_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 97..100
lib/ruby_smb/dcerpc/winreg.rb on lines 151..153
lib/ruby_smb/dcerpc/winreg.rb on lines 165..167
lib/ruby_smb/dcerpc/winreg.rb on lines 294..296
lib/ruby_smb/dcerpc/winreg.rb on lines 322..324

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 query_value_response.error_status == WindowsError::Win32::ERROR_SUCCESS
          raise RubySMB::Dcerpc::Error::WinregError, "Error returned when reading value #{value_name}: "\
            "#{WindowsError::Win32.find_by_retval(query_value_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 97..100
lib/ruby_smb/dcerpc/winreg.rb on lines 123..125
lib/ruby_smb/dcerpc/winreg.rb on lines 151..153
lib/ruby_smb/dcerpc/winreg.rb on lines 294..296
lib/ruby_smb/dcerpc/winreg.rb on lines 322..324

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 samr_open_user_response.error_status == WindowsError::NTStatus::STATUS_SUCCESS
          raise RubySMB::Dcerpc::Error::SamrError,
            "Error returned when getting a handle to user #{user_id}: "\
            "#{WindowsError::NTStatus.find_by_retval(samr_open_user_response.error_status.value).join(',')}"
Severity: Major
Found in lib/ruby_smb/dcerpc/samr.rb and 8 other locations - About 15 mins to fix
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 97..100
lib/ruby_smb/dcerpc/winreg.rb on lines 123..125
lib/ruby_smb/dcerpc/winreg.rb on lines 151..153
lib/ruby_smb/dcerpc/winreg.rb on lines 165..167
lib/ruby_smb/dcerpc/winreg.rb on lines 294..296
lib/ruby_smb/dcerpc/winreg.rb on lines 322..324

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

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 97..100
lib/ruby_smb/dcerpc/winreg.rb on lines 123..125
lib/ruby_smb/dcerpc/winreg.rb on lines 151..153
lib/ruby_smb/dcerpc/winreg.rb on lines 165..167
lib/ruby_smb/dcerpc/winreg.rb on lines 294..296

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_service_w_response.error_status == WindowsError::Win32::ERROR_SUCCESS
          raise RubySMB::Dcerpc::Error::SvcctlError,
            "Error returned when creating #{service_name} service: "\
            "#{WindowsError::Win32.find_by_retval(create_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 351..354
lib/ruby_smb/dcerpc/winreg.rb on lines 97..100
lib/ruby_smb/dcerpc/winreg.rb on lines 123..125
lib/ruby_smb/dcerpc/winreg.rb on lines 151..153
lib/ruby_smb/dcerpc/winreg.rb on lines 165..167
lib/ruby_smb/dcerpc/winreg.rb on lines 294..296
lib/ruby_smb/dcerpc/winreg.rb on lines 322..324

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

        begin
          header = RubySMB::SMB2::SMB2Header.read(raw_request)
        rescue IOError => e
          logger.error("Caught a #{e.class} while reading the SMB2 header (#{e.message})")
          disconnect!
Severity: Minor
Found in lib/ruby_smb/server/server_client.rb and 1 other location - About 15 mins to fix
lib/ruby_smb/server/server_client.rb on lines 81..87

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

          begin
            header = RubySMB::SMB1::SMBHeader.read(raw_request)
          rescue IOError => e
            logger.error("Caught a #{e.class} while reading the SMB1 header (#{e.message})")
            disconnect!
Severity: Minor
Found in lib/ruby_smb/server/server_client.rb and 1 other location - About 15 mins to fix
lib/ruby_smb/server/server_client.rb on lines 415..421

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