rapid7/metasploit-framework

View on GitHub
modules/exploits/multi/sap/sap_mgmt_con_osexec_payload.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

      service_url = 'http://' + datastore['DOWNHOST'] + ':' + datastore['SRVPORT'].to_s + resource_uri
    else

      #we use SRVHOST as download IP for the coming wget command.
      #SRVHOST needs a real IP address of our download host
Severity: Major
Found in modules/exploits/multi/sap/sap_mgmt_con_osexec_payload.rb and 3 other locations - About 2 hrs to fix
modules/exploits/linux/http/dlink_diagnostic_exec_noauth.rb on lines 122..143
modules/exploits/linux/http/dlink_dir615_up_exec.rb on lines 155..173
modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb on lines 270..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 81.

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

    print_status("#{rhost}:#{rport} - Waiting for the victim to request the ELF payload...")

    waited = 0
    while (not @elf_sent)
      select(nil, nil, nil, 1)
Severity: Major
Found in modules/exploits/multi/sap/sap_mgmt_con_osexec_payload.rb and 7 other locations - About 45 mins to fix
modules/exploits/linux/http/dlink_diagnostic_exec_noauth.rb on lines 206..214
modules/exploits/linux/http/dlink_dir615_up_exec.rb on lines 241..249
modules/exploits/linux/http/linksys_e1500_apply_exec.rb on lines 234..242
modules/exploits/linux/http/linksys_wrt54gl_apply_exec.rb on lines 401..409
modules/exploits/linux/http/netgear_dgn1000b_setup_exec.rb on lines 238..246
modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb on lines 343..351
modules/exploits/linux/smtp/exim4_dovecot_exec.rb on lines 71..79

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

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

Identical blocks of code found in 11 locations. Consider refactoring.
Open

    #print_status("on_request_uri called: #{request.inspect}")
    if (not @pl)
      print_error("#{rhost}:#{rport} - A request came in, but the payload wasn't ready yet!")
      return
    end
Severity: Major
Found in modules/exploits/multi/sap/sap_mgmt_con_osexec_payload.rb and 10 other locations - About 20 mins to fix
modules/exploits/linux/http/dlink_diagnostic_exec_noauth.rb on lines 194..202
modules/exploits/linux/http/dlink_dir615_up_exec.rb on lines 229..237
modules/exploits/linux/http/linksys_e1500_apply_exec.rb on lines 222..230
modules/exploits/linux/http/linksys_wrt54gl_apply_exec.rb on lines 389..397
modules/exploits/linux/http/netgear_dgn1000b_setup_exec.rb on lines 226..234
modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb on lines 331..339
modules/exploits/linux/smtp/exim4_dovecot_exec.rb on lines 85..92
modules/exploits/multi/http/bassmaster_js_injection.rb on lines 87..94
modules/exploits/multi/http/rails_dynamic_render_code_exec.rb on lines 95..102
modules/exploits/multi/http/trendmicro_threat_discovery_admin_sys_time_cmdi.rb on lines 137..144

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

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

      print_status("#{rhost}:#{rport} - Giving #{datastore['HTTP_DELAY']} seconds to the SAP Management Console to download the payload")
      select(nil, nil, nil, datastore['HTTP_DELAY'])
    else
      wait_linux_payload
    end
Severity: Minor
Found in modules/exploits/multi/sap/sap_mgmt_con_osexec_payload.rb and 5 other locations - About 15 mins to fix
modules/exploits/linux/http/dlink_diagnostic_exec_noauth.rb on lines 163..167
modules/exploits/linux/http/dlink_dir615_up_exec.rb on lines 193..197
modules/exploits/linux/http/linksys_wrt160nv2_apply_exec.rb on lines 169..173
modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb on lines 311..315
modules/exploits/linux/smtp/exim4_dovecot_exec.rb on lines 204..208

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

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

There are no issues that match your filters.

Category
Status