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

Post::Windows::Service: Support start/stop service on shell sessions #17919

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

bcoles
Copy link
Contributor

@bcoles bcoles commented Apr 22, 2023

Tested regex on a few Windows systems with different localizations. Regex worked on all.

Sample test code:

  def check
    puts service_start('dhcp', '127.0.0.2').to_s      # already started
    puts service_start('asdf', '127.0.0.2').to_s      # does not exist

    puts service_start('wmiApSrv', '127.0.0.2').to_s  # start...
    puts service_stop('wmiApSrv', '127.0.0.2').to_s   # ...then stop

    puts service_stop('asdf', '127.0.0.2').to_s       # does not exist
    CheckCode::Unknown
  end

Will not work on Windows 2000 systems (and earlier) as sc.exe does not exist.

lib/msf/core/post/windows/services.rb Outdated Show resolved Hide resolved
lib/msf/core/post/windows/services.rb Outdated Show resolved Hide resolved
lib/msf/core/post/windows/services.rb Outdated Show resolved Hide resolved
@bcoles bcoles force-pushed the msf-post-windows-services branch from daee599 to 71f9386 Compare April 28, 2023 08:44
@bwatters-r7
Copy link
Contributor

Hey there; I don't want you to think I've forgotten this. I was working to add a couple more updates to get both Meterpreter and shell sessions to work with the post/test/services module. I've had varying success, but I'm working on it on and off, so it may be a bit longer as I work it out.

@bwatters-r7 bwatters-r7 merged commit a16379b into rapid7:master Oct 4, 2023
@bwatters-r7
Copy link
Contributor

Release Notes

This PR adds support for starting and stopping Windows services using the service control manager to shell payloads.

@bcoles bcoles deleted the msf-post-windows-services branch October 4, 2023 22:54
@jharris-r7 jharris-r7 added the rn-enhancement release notes enhancement label Oct 6, 2023
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