Struct osquery_rs::OSQuery
source · [−]pub struct OSQuery { /* private fields */ }Expand description
A Struct that handles osquery Thrif API comunication
Examples
use osquery_rs::OSQuery;
fn main () {
let res = OSQuery::new()
.set_socket("/home/root/.osquery/shell.em")
.query(String::from("select * from time"))
.unwrap();
println!("{:#?}", res);
}Implementations
sourceimpl OSQuery
impl OSQuery
pub fn new() -> Self
sourcepub fn set_socket(self, path: &str) -> Self
pub fn set_socket(self, path: &str) -> Self
Set the osquery Thrift API socket to be used for comunication with osquery service
sourcepub fn get_socket(&self) -> String
pub fn get_socket(&self) -> String
A getter for socket used for comunication
sourcepub fn spawn_instance(self, path: &str) -> Result<Self>
pub fn spawn_instance(self, path: &str) -> Result<Self>
Spawn an instance of osquery. This allows the use of osquery in system that does not have osquery installed (standalone)
Examples
use osquery_rs::OSQuery;
fn main() {
let res = OSQuery::new()
// Specify the path to the osquery binary
.spawn_instance("./osqueryd")
.unwrap()
.query(String::from("select * from time"))
.unwrap();
println!("{:#?}", res);
}Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for OSQuery
impl Send for OSQuery
impl Sync for OSQuery
impl Unpin for OSQuery
impl UnwindSafe for OSQuery
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more