I understand that I can get what I need by running "klist.exe" and parsing the output, but I'm wondering if there is a Windows/C#/Powershell API to get information about cached Kerberos tickets on Windows server.
Windows API to get information about cached Kerberos tickets
5.9k Views Asked by arainchi At
2
There are 2 best solutions below
0
arainchi
On
So far I was able to find source code for klist.exe and "LsaCallAuthenticationPackage" seems to be the way to communicate with Kerberos cache in Windows:
Status = LsaCallAuthenticationPackage(
LogonHandle,
PackageId,
&CacheRequest,
sizeof(CacheRequest),
(PVOID *) &CacheResponse,
&ResponseSize,
&SubStatus
);
if (!SEC_SUCCESS(Status) || !SEC_SUCCESS(SubStatus))
{
ShowNTError("LsaCallAuthenticationPackage", Status);
printf("Substatus: 0x%x\n",SubStatus);
return FALSE;
}
printf("\nCached Tickets: (%lu)\n", CacheResponse->CountOfTickets);
for (Index = 0; Index < CacheResponse->CountOfTickets ; Index++ )
{
printf("\n Server: %wZ@%wZ\n",
&CacheResponse->Tickets[Index].ServerName,
&CacheResponse->Tickets[Index].RealmName);
Related Questions in C#
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in POWERSHELL
- PowerShell Linphone Configuration
- How avoid \t being converted to Tab in Powershell
- How do I get my terminal to work in VS Code? Exit Code:2, doesn't allow me to type anything
- Npm command not working in powershell but works in cmd
- Issue with path not being treated as encapsulated when calling cmd /C
- Native command throws error only when I redirect to a variable
- Logic Apps and long running Azure Function (Powershell)
- April fools - PsExec (PsTools)
- How to use nested ForEach-Object
- Batch Script-Powershell MessageBox | How do I set TopMost within PS command line of Batch?
- Execution Stuck at Get-PnPPage if function executed on Button Click
- How can I expand a column from group output?
- How to use expression in regex -replace with capturing group in powershell
- powershell where-object -cnotmatch filter unwanted lines
- How to make Visual Studio 2022 project launch Windows Terminal instead of PowerShell?
Related Questions in WINAPI
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Changing the theme of a #32768 (menu) window class at runtime
- Issue with GetOpenFileName while debugging
- How to populate a ListBox with SendMessage?
- Is there a function to end a child process?
- HDR video publishing
- Frameless Qt + WinAPI maximized window size is bigger than the availableGeometry()
- Mount .iso file with python
- What is Win32 x86-64 CONTEXT::VectorRegister for?
- WinAPI - right mouse drag & drop and IContextMenu
- Win32 per-filesystem cache tuning?
- Client connection timeout during Android & Windows PC communication via sockets
- MessageBoxEx sometimes shows as hollow window, border only, and only on Windows 11
- Win32api send message and Pydirectinput and Powertoy (Keyboard Manager ) Not working when open the application
- Would it be possible to run an application right after csrss.exe loads? (Windows)
Related Questions in KERBEROS
- Jndi connect to LDAP by GssApi KrbException: Server not found in Kerberos database (7)
- Kerberos Authentication for an API
- SASL GSSAPI: ldap_sasl_interactive_bind : Other error (80) no credentials supplied
- SQL Server Kerberos authentication
- How do I obtain a user's domain in nginx during authentication through AD with Kerberos?
- Kerberos ticket validity
- Unable to create Kafka Consumer using Kerberos Authentication System
- Does DataGrip Support Postgres Authentication with Kerberos?
- Setting up SOLR authentication kerebos plugin
- Authenticating and transferring files to the shared drive using Kerberos auth via SMB in Python
- Resolving Kerberos vs NTLM Authentication Issue in Cross-Domain SQL Server Connection
- Git clone failed with Krb5LoginModule error - JNA Library
- SPNEGO/GSS-API Golang packages for Kerberos authentication on MacOS
- VBA MSXML2.ServerXMLHTTP60 Web Request with Kerberos Authentication
- Deserializing a Kerberos Token
Related Questions in KLIST
- Kerberos SSO - klist get - should it work for every domain user?
- VB.Net app won't launch klist.exe executable (even from full path)
- Why is kerberos collection not listing valid principals?
- Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)
- Windows API to get information about cached Kerberos tickets
- klist not updating group membership
- Kerberos cache user how it works
- Determining IWA Implementation
- Kerberos: kinit on Windows 8.1 leads to empty ticket cache
- Kerberos authorization to add another user
- Kerberos key Lifetime
- bash error "date: invalid date `24/06/2013 21:22'" with Debian but not with RHEL?
- How do I aquire an encoded kerberos ticket in windows?
- Are HList/KList suitable as method parameter? How to refer to? Type List?
- Scala shapeless KList with extra constraint
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Microsoft already provides a set of scripts for this. So, you don't have to write this from scratch. Viewing and Purging Cached Kerberos Tickets and yes they have klist in the mix. Otherwise, you end up trying to leverage …
… and then doing SID translations and the like or you end up going down the same discussion in this Q&A.
How to programmatically clear the Kerberos ticket cache
Or leveraging these resources and tweaking as needed.
Kerberos Module The module gives access to the Kerberos ticket cache. It can read and purge tickets of the current logon session.
A Managed Code validator for Kerberos tickets
List All Cached Kerberos Tickets
When administering or troubleshooting authentication in a domain there are times when you need to know whether a ticket for a user and service are cached on a computer. This script exports all user's cached tickets on a computer to a text file for review.
Download : GetKerbTix.ps1
Purge All Kerberos Tickets
There are situations where an administrator may want to clear the cached Kerberos tickets on a server. For example, user Bob left the company. In situations like that you can run this script to clear all cached Kerberos tickets and TGTs for all sessions on the computer.
Download : PurgeAllKerbTickets.ps1