From 664b94f414da6dbdf6c956f5378f0094eadb8444 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 1 Feb 2022 21:19:51 -0800 Subject: include keys typed into audit log This will help people cross-correlate when the app performs specific calls. --- src/lcurses/window.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/lcurses') diff --git a/src/lcurses/window.c b/src/lcurses/window.c index 2ce418d..beaa148 100644 --- a/src/lcurses/window.c +++ b/src/lcurses/window.c @@ -36,6 +36,8 @@ @classmod curses.window */ +#include + #include "../teliva.h" #include "_helpers.c" #include "chstr.c" @@ -1305,6 +1307,13 @@ Wgetch(lua_State *L) if (x > COLS-2) x = COLS-2; if (y > LINES-1) y = LINES-1; /* http://gnats.netbsd.org/56664 */ mvaddstr(y, x, ""); int c = wgetch(w); + static char buffer[1024] = {0}; + memset(buffer, '\0', 1024); + if (isspace(c)) + snprintf(buffer, 1020, "getch() => %s", character_name(c)); + else + snprintf(buffer, 1020, "getch() => %c", c); + append_to_audit_log(L, buffer); if (c == ERR) return 0; -- cgit 1.4.1-2-gfad0