#authentication #utmp #utmp-raw #utmp-rs

utmp-raw

Provides raw types for parsing login records in utmp file

6 releases (3 breaking)

0.4.0 Sep 27, 2024
0.3.0 Jul 24, 2022
0.2.0 Nov 21, 2021
0.1.2 Feb 9, 2020

#679 in Unix APIs

Download history 108/week @ 2024-12-25 224/week @ 2025-01-01 188/week @ 2025-01-08 99/week @ 2025-01-15 136/week @ 2025-01-22 175/week @ 2025-01-29 168/week @ 2025-02-05 158/week @ 2025-02-12 165/week @ 2025-02-19 243/week @ 2025-02-26 168/week @ 2025-03-05 208/week @ 2025-03-12 181/week @ 2025-03-19 126/week @ 2025-03-26 146/week @ 2025-04-02 183/week @ 2025-04-09

681 downloads per month
Used in 3 crates (via utmp-rs)

MIT license

10KB
179 lines

utmp-rs

Crates.io Docs

A Rust crate for parsing utmp files like /var/run/utmp and /var/log/wtmp.

Usage

Simplest way is to use parse_from_* functions, which returns a Vec<UtmpEntry> on success:

let entries = utmp_rs::parse_from_path("/var/run/utmp")?;
// ...

If you don't need to collect them all, UtmpParser can be used as an iterator:

use utmp_rs::UtmpParser;
for entry in UtmpParser::from_path("/var/run/utmp")? {
    let entry = entry?;
    // ...
}

All the parse_from_* functions as well as UtmpParser parse utmp file based on the native format for the target platform. If cross-platform parsing is needed, Utmp32Parser or Utmp64Parser can be used instead of UtmpParser.

Dependencies

~1–1.6MB
~27K SLoC