diff options
| author | Leandro Pereira <leandro@hardinfo.org> | 2018-10-13 11:21:35 -0700 | 
|---|---|---|
| committer | Leandro Pereira <leandro@hardinfo.org> | 2018-10-13 11:23:04 -0700 | 
| commit | d963aa3e914615631a8169f6d88d82167fe06a63 (patch) | |
| tree | 94a631150dbb0186df374bccd0b0c8ce9d173a4c | |
| parent | ee4f894bd87ad9e246c3d973aa3882f24cb19e04 (diff) | |
Display status of ASLR in Computer->Operating System
| -rw-r--r-- | includes/computer.h | 3 | ||||
| -rw-r--r-- | modules/computer.c | 6 | ||||
| -rw-r--r-- | modules/computer/os.c | 14 | 
3 files changed, 21 insertions, 2 deletions
diff --git a/includes/computer.h b/includes/computer.h index 2482f142..2e381285 100644 --- a/includes/computer.h +++ b/includes/computer.h @@ -142,7 +142,8 @@ extern gchar *module_list;  gchar *computer_get_formatted_loadavg();  gchar *computer_get_formatted_uptime();  gchar *computer_get_alsacards(Computer * computer); -gchar *computer_get_entropy_avail(); +gchar *computer_get_entropy_avail(void); +gchar *computer_get_aslr(void);  OperatingSystem *computer_get_os(void);  AlsaInfo *computer_get_alsainfo(void); diff --git a/modules/computer.c b/modules/computer.c index 3984efc9..45c4502e 100644 --- a/modules/computer.c +++ b/modules/computer.c @@ -511,10 +511,14 @@ gchar *callback_os(void)          info_field(_("Home Directory"), computer->os->homedir),          info_field_last()); +    info_add_group(info, _("Security"), +        info_field_update(_("Available entropy in /dev/random"), 1000), +        info_field(_("ASLR"), idle_free(computer_get_aslr())), +        info_field_last()); +      info_add_group(info, _("Misc"),          info_field_update(_("Uptime"), 1000),          info_field_update(_("Load Average"), 10000), -        info_field_update(_("Available entropy in /dev/random"), 1000),          info_field_last());      return info_flatten(info); diff --git a/modules/computer/os.c b/modules/computer/os.c index aec53df2..fc370ee8 100644 --- a/modules/computer/os.c +++ b/modules/computer/os.c @@ -235,6 +235,20 @@ detect_desktop_environment(void)  }  gchar * +computer_get_aslr(void) +{ +    switch (h_sysfs_read_int("/proc/sys/kernel", "randomize_va_space")) { +    case 0: +        return g_strdup(_("Disabled")); +    case 1: +        return g_strdup(_("Partially enabled (mmap base+stack+VDSO base)")); +    case 2: +        return g_strdup(_("Fully enabled (mmap base+stack+VDSO base+heap)")); +    default: +        return g_strdup(_("Unknown")); +    } +} +gchar *  computer_get_entropy_avail(void)  {      gchar tab_entropy_fstr[][32] = {  | 
