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
| sudo apt update && sudo apt install auditd -y | |
| sudo auditctl -a always,exit -F arch=b64 -S execve -F euid=0 -F key=root_cmd | |
| sudo auditctl -a always,exit -F arch=b32 -S execve -F euid=0 -F key=root_cmd | |
| # Make rules persistent by adding them to the audit configuration | |
| echo "-a always,exit -F arch=b64 -S execve -F euid=0 -F key=root_cmd" | sudo tee /etc/audit/rules.d/root_cmd.rules | |
| echo "-a always,exit -F arch=b32 -S execve -F euid=0 -F key=root_cmd" | sudo tee -a /etc/audit/rules.d/root_cmd.rules | |
| sudo systemctl restart auditd |
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
| #!/usr/bin/env python3 | |
| import sys | |
| import re | |
| import termios | |
| import tty | |
| from datetime import datetime | |
| class AuditLogViewer: | |
| def __init__(self, log_path='/var/log/audit/audit.log'): |