Skip to content

VerKnowSys/kvmpro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

146 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kvmpro - Performance driven, low level processes listing library for HardenedBSD/ FreeBSD.

Project is developed on and requires 64bit FreeBSD-11-compliant systems.

Author:

Daniel (@dmilith) Dettlaff

Dependencies:

  • HardenedBSD +11-STABLE (or FreeBSD),

  • Rust (Cargo)

  • Kernel Memory Interface system feature: "kvm" (for details: man kvm on supported OS)

  • Process Information system library: "procstat" (for details: man procstat on supported OS)

API (Rust):

The library provides a functional-style API that returns structured data:

  • pub fn get_process_usage(uid: uid_t) -> Result<ProcessListResponse<ProcessInfo>, String> - returns detailed information about all processes for a given UID, including open sockets, TCP/UDP connections, bound addresses, and protocols.

  • pub fn get_process_usage_short(uid: uid_t) -> Result<ProcessListResponse<ProcessInfoShort>, String> - returns a simplified list of process information.

Features:

  • Idiomatic Rust: Leverages functional programming patterns (iterators, closures) for safety and immutability.
  • Enhanced Protocol Support: Supports a wide range of address families including:
    • AF_INET, AF_INET6, AF_LOCAL
    • AF_LINK, AF_ARP, AF_ROUTE
    • AF_NETGRAPH, AF_BLUETOOTH, AF_NETLINK (Value 38)
    • AF_IPX, AF_APPLETALK, AF_ATM, AF_SNA, AF_ISDN, AF_NATM
    • SDP4 (40) and SDP6 (42)
  • JSON Ready: All response structures derive Serialize for easy integration with web services or CLI tools via serde_json.

Usage:

use kvmpro::{get_process_usage_short, get_process_usage};

let uid = 1001;
match get_process_usage(uid) {
    Ok(resp) => {
        println!("Status: {}", resp.status);
        for proc in resp.list {
            println!("PID: {}, CMD: {}, Sockets: {}", proc.pid, proc.cmd, proc.stat_info);
        }
    }
    Err(e) => eprintln!("Error fetching process data: {}", e),
}

Build & Test:

The project utilizes standard cargo workflows:

cargo build --release
cargo test

Legacy wrapper scripts are also provided in the bin/ directory for convenience:

  • bin/build: Runs cargo build --release.
  • bin/test: Runs cargo test -- --nocapture.
  • bin/clean: Runs cargo clean.

Released under multiple licenses:

  • BSD license,
  • MIT license,
  • IDGaF license.

About

Performance driven, low level processes listing library for HardenedBSD/ FreeBSD.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors