Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved bruteforce(ip) under the sys_name check. #11423

Merged
merged 3 commits into from
Mar 5, 2019
Merged

Moved bruteforce(ip) under the sys_name check. #11423

merged 3 commits into from
Mar 5, 2019

Conversation

jnqpblc
Copy link
Contributor

@jnqpblc jnqpblc commented Feb 16, 2019

Moving the bruteforce(ip) under the sys_name check stops the script from executing against the wrong systems.

Moving the bruteforce(ip) under the sys_name check stops the script from executing against the wrong systems.
@bcoles
Copy link
Contributor

bcoles commented Feb 19, 2019

That unless block is starting to get a little crowded:

    sys_name = get_system_name(res)
    unless sys_name.blank?
      print_good("System name detected: #{sys_name}")
      report_note(
        :host => ip,
        :type => "system.name",
        :data => sys_name
      )
      if anonymous_access?(res)
        print_good("No login necessary. Server allows anonymous access.")
        return
      end
      init_loginscanner(ip)
      bruteforce(ip)
    end

Also, the module will print nothing at all if sys_name.blank?

Something like this would be a good idea:

    sys_name = get_system_name(res)

    if sys_name.blank?
      print_error 'Could not retrieve system name'
      return
    end

    print_good("System name detected: #{sys_name}")
    report_note(
      :host => ip,
      :type => "system.name",
      :data => sys_name
    )

    if anonymous_access?(res)
      print_good("No login necessary. Server allows anonymous access.")
      return
    end

    init_loginscanner(ip)
    bruteforce(ip)

@jnqpblc
Copy link
Contributor Author

jnqpblc commented Feb 22, 2019

Yep that worked for me. The only additional thing I see is to move the sys_name = get_system_name(res) and if sys_name.blank? blocks above the version = get_version(res).


    if sys_name.blank?
      print_error 'Could not retrieve system name'
      return
    end

    version = get_version(res)
    unless version.blank?
      print_status("Version detected: #{version}")
      unless is_version_tested?(version)
        print_warning("You're running the module against a version we have not tested")
      end
    end

    print_good("System name detected: #{sys_name}")
    report_note(
      :host => ip,
      :type => "system.name",
      :data => sys_name
    )

    if anonymous_access?(res)
      print_good("No login necessary. Server allows anonymous access.")
      return
    end

    init_loginscanner(ip)
    bruteforce(ip)
  end

@wchen-r7 wchen-r7 self-assigned this Mar 5, 2019
@wchen-r7 wchen-r7 merged commit a9ba765 into rapid7:master Mar 5, 2019
@wchen-r7
Copy link
Contributor

wchen-r7 commented Mar 5, 2019

Release Notes

This adds a check for system name in HP System Management Homepage Login Utility.

@jnqpblc jnqpblc deleted the patch-1 branch March 5, 2019 20:48
@gdavidson-r7 gdavidson-r7 added the rn-enhancement release notes enhancement label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants