https://github.com/franckferman/lastlog-audit
A Python tool to analyze and export login activity from /var/log/lastlog for security.
https://github.com/franckferman/lastlog-audit
forensic forensic-tools forensics forensics-tools lastlog lastlogin lastlogontimestamp linux linux-logs linux-python linux-security linux-security-audit logs logs-analysis parser-python python python-3 python-linux python-linux-audit python3
Last synced: 10 months ago
JSON representation
A Python tool to analyze and export login activity from /var/log/lastlog for security.
- Host: GitHub
- URL: https://github.com/franckferman/lastlog-audit
- Owner: franckferman
- License: agpl-3.0
- Created: 2022-08-06T17:13:49.000Z (over 3 years ago)
- Default Branch: stable
- Last Pushed: 2025-03-12T13:46:58.000Z (11 months ago)
- Last Synced: 2025-03-29T08:24:30.608Z (11 months ago)
- Topics: forensic, forensic-tools, forensics, forensics-tools, lastlog, lastlogin, lastlogontimestamp, linux, linux-logs, linux-python, linux-security, linux-security-audit, logs, logs-analysis, parser-python, python, python-3, python-linux, python-linux-audit, python3
- Language: Python
- Homepage: https://github.com/franckferman/LastLog-Audit
- Size: 40 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Contributors][contributors-shield]](https://github.com/franckferman/LastLog-Audit/graphs/contributors)
[![Stargazers][stars-shield]](https://github.com/franckferman/LastLog-Audit/stargazers)
[![License][license-shield]](https://github.com/franckferman/LastLog-Audit/blob/stable/LICENSE)
🧭 LastLog-Audit
Analyzing system login activities.
A Python tool to analyze and export login activity from /var/log/lastlog for security.
## 📜 Table of Contents
Click to collapse/expand
## 📖 About
**LastLog-Audit** is a lightweight Python tool designed to **parse and analyze system login activity** stored in `/var/log/lastlog`.
Originally built for personal use and professional system audits, this tool offers **customizable output** (table/line) and **export options (TXT/CSV)** for easy reporting, tracking, and compliance.
> ⚙️ **Note:** LastLog-Audit is a simple, focused tool — perfect for quick audits and reviews.
### ⚙️ **Features of _LastLog-Audit_**
- ✅ Parse `/var/log/lastlog` and extract login records (terminal, hostname, last login date).
- ✅ Optionally **include usernames** mapped via system UID.
- ✅ **Multiple output modes**: clean **table view** or **line output** (easy for grep/awk parsing).
- ✅ **Export to TXT or CSV** formats for archiving and sharing reports.
## 🚀 Installation
Before getting started, make sure you meet the following prerequisites.
### Prerequisites
1. **Python 3**: Ensure Python 3 is installed on your system.
2. **Dependencies**: No external libraries required.
LastLog-Audit relies **only on Python's standard library** — ready to use out-of-the-box on any modern Linux system (Python 3.7+).
> ⚙️ Optional: For Python 3.6 support, you may install the backport of `dataclasses` via `pip install dataclasses`.
> ⚠️ Note: LastLog-Audit has been tested on Python 3.11.10 under Linux. While it might work on other versions or operating systems, compatibility is officially guaranteed only for this specific setup.
### Installation Methods
1. **Clone the repository via Git**:
```bash
git clone https://github.com/franckferman/LastLog-Audit.git
```
2. **Direct download of the script (_without Git_)**:
If you only need the script without cloning the entire repository:
```bash
curl -O https://raw.githubusercontent.com/franckferman/LastLog-Audit/stable/src/LastLog-Audit.py
```
## 🎮 Usage
Make sure to adjust the commands based on your setup.
### **Basic usage**
To display the full help menu and explore available options:
```bash
python3 LastLog-Audit.py --help
```
### 📝 **Example Commands**
| Task | Command |
| --- | --- |
| Parse and display lastlog in a table | `python3 LastLogAudit.py` |
| Show logins in a simple line format | `python3 LastLogAudit.py --display line` |
| Include usernames (if available) | `python3 LastLogAudit.py --include-username` |
| Export to CSV | `python3 LastLogAudit.py --export output.csv --export-format csv` |
| Export to TXT (table format) | `python3 LastLogAudit.py --export output.txt` |
| Parse a custom lastlog file | `python3 LastLogAudit.py --file /path/to/custom_lastlog` |
## 🤝 Contributing
We truly appreciate and welcome community involvement. Your contributions, feedback, and suggestions play a crucial role in improving the project for everyone. If you're interested in contributing or have ideas for enhancements, please feel free to open an issue or submit a pull request on our GitHub repository. Every contribution, no matter how big or small, is highly valued and greatly appreciated!
## 📚 License
This project is licensed under the GNU Affero General Public License, Version 3.0. For more details, please refer to the LICENSE file in the repository: [Read the license on GitHub](https://github.com/franckferman/LastLog-Audit/blob/stable/LICENSE)
## 📞 Contact
[![ProtonMail][protonmail-shield]](mailto:contact@franckferman.fr)
[![LinkedIn][linkedin-shield]](https://www.linkedin.com/in/franckferman)
[![Twitter][twitter-shield]](https://www.twitter.com/franckferman)
[contributors-shield]: https://img.shields.io/github/contributors/franckferman/LastLog-Audit.svg?style=for-the-badge
[contributors-url]: https://github.com/franckferman/LastLog-Audit/graphs/contributors
[stars-shield]: https://img.shields.io/github/stars/franckferman/LastLog-Audit.svg?style=for-the-badge
[stars-url]: https://github.com/franckferman/LastLog-Audit/stargazers
[license-shield]: https://img.shields.io/github/license/franckferman/LastLog-Audit.svg?style=for-the-badge
[license-url]: https://github.com/franckferman/LastLog-Audit/blob/stable/LICENSE
[protonmail-shield]: https://img.shields.io/badge/ProtonMail-8B89CC?style=for-the-badge&logo=protonmail&logoColor=blueviolet
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=blue
[twitter-shield]: https://img.shields.io/badge/-Twitter-black.svg?style=for-the-badge&logo=twitter&colorB=blue