GithubHelp home page GithubHelp logo

myoutdeskllc / win-event-log-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rustysec/win-event-log-rs

0.0 0.0 0.0 30 KB

clean interface for the windows event log

License: MIT License

Shell 0.50% Rust 99.50%

win-event-log-rs's Introduction

win-event-log

A library for simple interface into the Windows Event Log system.

Build Status

Usage

[dependencies]
win-event-log = { git = "https://github.com/rustysec/win-event-log-rs" }

This example will print the raw XML event from the event log:

extern crate win_event_log;

use win_event_log::prelude::*;

fn main() {
    let conditions = vec![
        Condition::filter(EventFilter::level(1, Comparison::Equal)),
        Condition::filter(EventFilter::level(4, Comparison::GreaterThanOrEqual)),
    ];
    let query = QueryList::new()
        .with_query(
            Query::new()
                .item(
                    QueryItem::selector("Application".to_owned())
                        .system_conditions(Condition::or(conditions))
                        .build(),
                )
                .query(),
        )
        .build();

    match WinEvents::get(query) {
        Ok(events) => {
            if let Some(event) = events.into_iter().next() {
                println!("{}", event);
            }
        }
        Err(e) => println!("Error: {}", e),
    }
}

The examples/ folder has an example for easily deserializing the XML objects into a struct.

Important

Currently, the Windows APIs used internally are only available on Vista+, meaning this library will not be able to access events on legacy systems such as XP or Server 2003. However, the required methods are loaded dynamically so executables compiled against this library will continue to work on these legacy systems (win-event-log will just return Error results).

win-event-log-rs's People

Contributors

cactter avatar rustysec avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.