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

Adding the services command #1557

Merged
merged 4 commits into from
Jan 15, 2024
Merged

Adding the services command #1557

merged 4 commits into from
Jan 15, 2024

Conversation

RafBishopFox
Copy link
Collaborator

This PR adds the services command that gives the operator the ability to interrogate and control (start, stop) services on Windows.

There are four new commands, described below. All of the commands can be run against the local machine (the implant) or a remote machine by specifying its hostname with the -H flag.

  • services: Get information about the services on the system. On small width terminals, you get the service name, display name, and status. On wide width terminals, you get the same information plus startup type (manual, disabled, automatic), path to the service binary, and the account that the service runs under.
  • services info <service_name>: Gives more detailed information about a specific service, including the information from the wide terminal view plus a description of the service.
  • services start <service_name>: If you have the appropriate permissions, you can start a service on the machine or a remote machine.
  • services stop <service_name>: With the appropriate permissions, you can stop a service on the machine or a remote machine.

I would like to open this command up to other platforms in the future. On Linux, that would require interacting with the systemd API or shelling out on SysV-style init systems (have to look into that more). On macOS, that would likely require interacting with launchd.

@RafBishopFox RafBishopFox requested a review from a team as a code owner January 15, 2024 16:09
Copy link
Member

@rkervella rkervella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of things to change related to hardcoded strings and a test I'm not sure we need.

implant/sliver/service/service_windows.go Outdated Show resolved Hide resolved
implant/sliver/service/service_windows.go Outdated Show resolved Hide resolved
implant/sliver/service/service_windows.go Outdated Show resolved Hide resolved
implant/sliver/service/service_windows.go Outdated Show resolved Hide resolved
implant/sliver/service/service_windows.go Outdated Show resolved Hide resolved
@rkervella
Copy link
Member

or shelling out on SysV-style init systems

We don't want to shell out for this kind of things. There's already the Execute RPC for that.

@RafBishopFox
Copy link
Collaborator Author

or shelling out on SysV-style init systems

We don't want to shell out for this kind of things. There's already the Execute RPC for that.

That is what I meant 🙂. Good catch 😁

…ngService to StartServiceByName, removing unnecessary test
@RafBishopFox
Copy link
Collaborator Author

@rkervella Hopefully the latest commit addresses the issues you identified 🙂

@rkervella rkervella merged commit 310b844 into master Jan 15, 2024
5 checks passed
@RafBishopFox RafBishopFox deleted the windows-services branch January 18, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants