Created
January 2, 2022 09:19
-
-
Save MiggieNRG/4b414ea26dca5f44165fdf3550b7f3eb to your computer and use it in GitHub Desktop.
Get All Local Admins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Custom.GetLocalAdmins | |
description: | | |
Gets a list of local admin accounts | |
reference: | |
- https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.localaccounts/get-localgroupmember?view=powershell-5.1 | |
# Can be CLIENT, CLIENT_EVENT, SERVER, SERVER_EVENT | |
type: CLIENT | |
parameters: | |
- name: script | |
default: | | |
Get-LocalGroupMember -Group "Administrators" |SELECT -ExpandProperty SID -Property Name, PrincipalSource |select Name, Value, PrincipalSource|convertto-json | |
sources: | |
- precondition: | |
SELECT OS From info() where OS = 'windows' | |
queries: | |
- LET out = SELECT parse_json_array(data=Stdout) AS Output | |
FROM execve(argv=["powershell", | |
"-ExecutionPolicy", "Unrestricted", "-encodedCommand", | |
base64encode(string=utf16_encode( | |
string=script)) | |
], length=1000000) | |
- SELECT * FROM foreach(row=out.Output[0], | |
query={ | |
SELECT Name, Value AS SID FROM scope() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment