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§
Source§impl 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 set_timeout(self, timeout: u64) -> Self
pub fn set_timeout(self, timeout: u64) -> Self
Set osquery queries timeout in seconds (default 10 seconds)
Sourcepub fn get_timeout(&self) -> u64
pub fn get_timeout(&self) -> u64
Get osquery queries timeout in seconds
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 Freeze for OSQuery
impl RefUnwindSafe for OSQuery
impl Send for OSQuery
impl Sync for OSQuery
impl Unpin for OSQuery
impl UnwindSafe for OSQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more