Last active
February 9, 2024 17:25
-
-
Save jrmuizel/92d3e045313ea09454907df2a9015199 to your computer and use it in GitHub Desktop.
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
#include <assert.h> | |
#include <bsm/audit.h> | |
#include <bsm/audit_session.h> | |
int main() { | |
auditinfo_addr_t auditInfo; | |
int result = getaudit_addr(&auditInfo, sizeof(auditInfo)); | |
assert(result == 0 ); | |
printf("got audit result: %d, uid %d\n", result, auditInfo.ai_auid); | |
if (auditInfo.ai_flags & AU_SESSION_FLAG_IS_INITIAL) { | |
printf("AU_SESSION_FLAG_IS_INITIAL\n"); | |
} | |
if (auditInfo.ai_flags & AU_SESSION_FLAG_HAS_GRAPHIC_ACCESS) { | |
printf("AU_SESSION_FLAG_HAS_GRAPHIC_ACCESS\n"); | |
} | |
if (auditInfo.ai_flags & AU_SESSION_FLAG_HAS_TTY) { | |
printf("AU_SESSION_FLAG_HAS_TTY\n"); | |
} | |
if (auditInfo.ai_flags & AU_SESSION_FLAG_IS_REMOTE) { | |
printf("AU_SESSION_FLAG_IS_REMOTE\n"); | |
} | |
if (auditInfo.ai_flags & AU_SESSION_FLAG_HAS_CONSOLE_ACCESS) { | |
printf("AU_SESSION_FLAG_HAS_CONSOLE_ACCESS\n"); | |
} | |
if (auditInfo.ai_flags & AU_SESSION_FLAG_HAS_AUTHENTICATED) { | |
printf("AU_SESSION_FLAG_HAS_AUTHENTICATED\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment