Pure-Python library to decode/read utmp and wtmp files https://pypi.org/project/utmp/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Henning Jacobs 231ead66d7 v20.10.0 3 weeks ago
tests add first test and argparse 6 years ago
utmp v20.10.0 3 weeks ago
.gitignore add first test and argparse 6 years ago
MANIFEST.in add requirements.txt to sdist 6 years ago
README.rst add first test and argparse 6 years ago
requirements.txt initial commit 6 years ago
setup.py v20.10.0 3 weeks ago
tox.ini initial commit 6 years ago

README.rst

====
utmp
====

Pure-Python library to decode/read utmp and wtmp files.
Please note that there is an alternative library which uses the underlying C API: pyutmp_

This package requires Python 3.4.

What is utmp/wtmp?
==================
**utmp**, **wtmp**, **btmp** and variants such as **utmpx**, **wtmpx** and **btmpx** are files on Unix-like systems that keep track of all logins and logouts to the system.

The utmp file keeps track of the current login state of each user. The wtmp file records all logins and logouts history. The btmp file records failed login attempts.

On Linux the ``wtmp`` and ``btmp`` files are usually located in the ``/var/log/`` directory.

Usage
=====

The ``utmp.read`` function decodes a binary utmp/wtmp stream and yields record objects:

.. code-block:: python

with open('/var/log/wtmp', 'rb') as fd:
buf = fd.read()
for entry in utmp.read(buf):
print(entry.time, entry.type, entry)

.. _pyutmp: https://pypi.python.org/pypi/pyutmp