|
|
|
@ -58,7 +58,14 @@ ip_address = run_command(['awk', '$1 == "inet" {gsub(/\/.*$/, "", $2); print $2}
|
|
|
|
|
|
|
|
|
|
print("start running the service commands, this sometimes takes longer");
|
|
|
|
|
logins_today_log = subprocess.run(["sudo", "journalctl","_COMM=systemd-logind", "-S", "today", "-g", "New session" ], check=True, capture_output=True)
|
|
|
|
|
logins_today = run_command(['grep', '-v', "Boot"], based=logins_today_log.stdout).splitlines()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: merge into one command and then grep the various _COMM\s, wrap in a function
|
|
|
|
|
groupadd_today_log = subprocess.run(["sudo", "journalctl", "-S","today","_COMM=groupadd","-r"], check=True, capture_output=True)
|
|
|
|
|
groupremove_today_log = subprocess.run(["sudo", "journalctl", "-S","today","_COMM=groupremove","-r"], check=True, capture_output=True)
|
|
|
|
|
usermod_today_log = subprocess.run(["sudo", "journalctl", "-S","today","_COMM=usermod","-r"], check=True, capture_output=True)
|
|
|
|
|
userdel_today_log = subprocess.run(["sudo", "journalctl", "-S","today","_COMM=userdel","-r"], check=True, capture_output=True)
|
|
|
|
|
|
|
|
|
|
kitchen_services = run_command(["sudo", "journalctl", "-S", "today", "-u", "kitchen-stove.service", "-u", "kitchen-bin.service", "-u", "kitchen-fridge.service", "-r", "-n"]).splitlines()
|
|
|
|
|
|
|
|
|
|
# loading the jinja template environment
|
|
|
|
@ -85,17 +92,17 @@ output = template.render(
|
|
|
|
|
days_since_last_boot = time_since_last_boot.days,
|
|
|
|
|
kitchen_services = kitchen_services,
|
|
|
|
|
ip_address = ip_address,
|
|
|
|
|
logins_today = logins_today,
|
|
|
|
|
logins_today = run_command(['grep', '-v', "Boot"], based=logins_today_log.stdout).splitlines(),
|
|
|
|
|
list_groups = run_command(["getent","group"]).splitlines(),
|
|
|
|
|
list_active_services = run_command(["sudo", "service", "--status-all"]).splitlines(),
|
|
|
|
|
debian_version = run_command(["cat", "/etc/debian_version"]),
|
|
|
|
|
kernel_version = run_command(["uname","-a"]),
|
|
|
|
|
hostname = run_command(["hostname","-i"]),
|
|
|
|
|
|
|
|
|
|
groups_created = run_command(["sudo", "journalctl", "-S","today","_COMM=groupadd","-r"]).splitlines(),
|
|
|
|
|
groups_removed = run_command(["sudo", "journalctl", "-S","today","_COMM=groupremove","-r"]).splitlines(),
|
|
|
|
|
user_modified = run_command(["sudo", "journalctl", "-S","today","_COMM=usermod","-r"]).splitlines(),
|
|
|
|
|
user_deleted = run_command(["sudo", "journalctl", "-S","today","_COMM=userdel","-r"]).splitlines(),
|
|
|
|
|
groups_created = run_command(['grep', '-v', "Boot"], based=groupadd_today_log.stdout).splitlines(),
|
|
|
|
|
groups_removed = run_command(['grep', '-v', "Boot"], based=groupremove_today_log.stdout).splitlines(),
|
|
|
|
|
user_modified = run_command(['grep', '-v', "Boot"], based=usermod_today_log.stdout).splitlines(),
|
|
|
|
|
user_deleted = run_command(['grep', '-v', "Boot"], based=userdel_today_log.stdout).splitlines()
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|