-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlog.rs
30 lines (24 loc) · 835 Bytes
/
log.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use std::env;
use vmw_backdoor as vmw;
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
fn main() {
let msg = match env::args().collect::<Vec<_>>().get(1) {
Some(val) => val.clone(),
None => "Hello world (from vmw_backdoor)".to_string(),
};
let is_vmw = vmw::is_vmware_cpu();
eprintln!("VMware CPU detected: {}.", is_vmw);
if !is_vmw {
panic!("Hypervisor not present");
}
let mut backdoor = vmw::probe_backdoor_privileged().unwrap();
eprintln!("Got backdoor access.");
let mut erpc = backdoor.open_enhanced_chan().unwrap();
eprintln!("Got ERPC channel: {:?}.", erpc);
erpc.log(&msg).unwrap();
eprintln!("Sent log message: {}.", msg);
}
#[cfg(not(all(target_os = "linux", target_arch = "x86_64")))]
fn main() {
eprintln!("Unsupported target");
}