Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions evil_winrm_py/evil_winrm_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Krb5Error(Exception):
"menu",
"clear",
"exit",
"services",
]
COMMAND_SUGGESTIONS = []

Expand Down Expand Up @@ -142,6 +143,7 @@ def show_menu() -> None:
("download <remote_path> <local_path>", "Download a file"),
("loadps <local_path>.ps1", "Load PowerShell functions from a local script"),
("runps <local_path>.ps1", "Run a local PowerShell script on the remote host"),
("services", "Show the running services (except system services)")
("menu", "Show this menu"),
("clear, cls", "Clear the screen"),
("exit", "Exit the shell"),
Expand Down Expand Up @@ -896,6 +898,19 @@ def interactive_shell(r_pool: RunspacePool) -> None:
log.info("Displaying menu.")
show_menu()
continue
elif command_lower == "services":
log.info("Displaying services.")
get_services_command = '$servicios = Get-ItemProperty "registry::HKLM\System\CurrentControlSet\Services\*" | Where-Object {$_.imagepath -notmatch "system" -and $_.imagepath -ne $null } | Select-Object pschildname,imagepath ; foreach ($servicio in $servicios ) {Get-Service $servicio.PSChildName -ErrorAction SilentlyContinue | Out-Null ; if ($? -eq $true) {$privs = $true} else {$privs = $false} ; $Servicios_object = New-Object psobject -Property @{"Service" = $servicio.pschildname ; "Path" = $servicio.imagepath ; "Privileges" = $privs} ; $Servicios_object | Format-List}'
services, streams, had_errors = run_ps_cmd(r_pool, get_services_command)
if not services:
print(
RED + "[-] Can not retrieve service information" + RESET
)
continue
print(services)
continue


elif command_lower.startswith("download"):
command_parts = quoted_command_split(command)
if len(command_parts) < 3:
Expand Down