Skip to content

Commit 57d9149

Browse files
committed
Added some additional token information.
1 parent 3beeb4f commit 57d9149

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

NtObjectManager/NtObjectManager.psm1

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,8 @@ Show integrity information.
10951095
Show token security attributes.
10961096
.PARAMETER TrustLevel
10971097
Show token trust level.
1098+
.PARAMETER Information
1099+
Show token information such as type, impersonation level and ID.
10981100
.OUTPUTS
10991101
Text data
11001102
.EXAMPLE
@@ -1117,7 +1119,8 @@ function Format-NtToken {
11171119
[switch]$User,
11181120
[switch]$Integrity,
11191121
[switch]$SecurityAttributes,
1120-
[switch]$TrustLevel
1122+
[switch]$TrustLevel,
1123+
[switch]$Information
11211124
)
11221125

11231126
if ($All) {
@@ -1127,11 +1130,12 @@ function Format-NtToken {
11271130
$Integrity = $true
11281131
$SecurityAttributes = $true
11291132
$TrustLevel = $true
1133+
$Information = $true
11301134
}
11311135

11321136
if (!$User -and !$Group -and !$Privilege `
11331137
-and !$Integrity -and !$TrustLevel `
1134-
-and !$SecurityAttributes) {
1138+
-and !$SecurityAttributes -and !$Information) {
11351139
$token.User.ToString()
11361140
return
11371141
}
@@ -1194,6 +1198,18 @@ function Format-NtToken {
11941198
"-------------------"
11951199
$token.SecurityAttributes | Format-Table
11961200
}
1201+
1202+
if ($Information) {
1203+
"TOKEN INFORMATION"
1204+
"-----------------"
1205+
"Type : {0}" -f $token.TokenType
1206+
if ($token.TokenType -eq "Impersonation") {
1207+
"Imp Level : {0}" -f $token.TokenType
1208+
}
1209+
"ID : {0}" -f $token.Id
1210+
"Auth ID : {0}" -f $token.AuthenticationId
1211+
"Session ID: {0}" -f $token.SessionId
1212+
}
11971213
}
11981214

11991215
<#

0 commit comments

Comments
 (0)