Skip to content

Commit 3beeb4f

Browse files
committed
Added Trust Level to Format-NtToken.
1 parent 8ea078b commit 3beeb4f

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

NtObjectManager/NtObjectManager.psm1

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,8 @@ Show privilege information.
10931093
Show integrity information.
10941094
.PARAMETER SecurityAttributes
10951095
Show token security attributes.
1096+
.PARAMETER TrustLevel
1097+
Show token trust level.
10961098
.OUTPUTS
10971099
Text data
10981100
.EXAMPLE
@@ -1114,7 +1116,8 @@ function Format-NtToken {
11141116
[switch]$Privilege,
11151117
[switch]$User,
11161118
[switch]$Integrity,
1117-
[switch]$SecurityAttributes
1119+
[switch]$SecurityAttributes,
1120+
[switch]$TrustLevel
11181121
)
11191122

11201123
if ($All) {
@@ -1123,9 +1126,12 @@ function Format-NtToken {
11231126
$Privilege = $true
11241127
$Integrity = $true
11251128
$SecurityAttributes = $true
1129+
$TrustLevel = $true
11261130
}
11271131

1128-
if (!$User -and !$Group -and !$Privilege -and !$Integrity) {
1132+
if (!$User -and !$Group -and !$Privilege `
1133+
-and !$Integrity -and !$TrustLevel `
1134+
-and !$SecurityAttributes) {
11291135
$token.User.ToString()
11301136
return
11311137
}
@@ -1172,6 +1178,17 @@ function Format-NtToken {
11721178
""
11731179
}
11741180

1181+
if ($TrustLevel) {
1182+
"TRUST LEVEL"
1183+
"-----------"
1184+
$trust_level = $token.TrustLevel
1185+
if ($trust_level -eq $null) {
1186+
$trust_level = Get-NtSid "S-1-19-0-0"
1187+
}
1188+
$trust_level | Write-Output
1189+
""
1190+
}
1191+
11751192
if ($SecurityAttributes) {
11761193
"SECURITY ATTRIBUTES"
11771194
"-------------------"
@@ -1197,6 +1214,8 @@ Show privilege information.
11971214
Show integrity information.
11981215
.PARAMETER SecurityAttributes
11991216
Show token security attributes.
1217+
.PARAMETER TrustLevel
1218+
Show token trust level.
12001219
.OUTPUTS
12011220
Text data
12021221
.EXAMPLE
@@ -1216,12 +1235,14 @@ function Show-NtTokenEffective {
12161235
[switch]$Privilege,
12171236
[switch]$User,
12181237
[switch]$Integrity,
1219-
[switch]$SecurityAttributes
1238+
[switch]$SecurityAttributes,
1239+
[switch]$TrustLevel
12201240
)
12211241

12221242
Use-NtObject($token = Get-NtToken -Effective) {
12231243
Format-NtToken -Token $token -All:$All -Group:$Group -Privilege:$Privilege `
1224-
-User:$User -Integrity:$Integrity -SecurityAttributes:$SecurityAttributes
1244+
-User:$User -Integrity:$Integrity -SecurityAttributes:$SecurityAttributes `
1245+
-TrustLevel:$TrustLevel
12251246
}
12261247
}
12271248

0 commit comments

Comments
 (0)