use std::time::Duration;
use super::Vulnerability;
use crate::SwitchHandle;
impl Vulnerability for SwitchHandle {
fn backend_name() -> &'static str {
"macos"
}
fn trigger(&self, length: usize) -> crate::Result<()> {
const GET_STATUS: u8 = 0x0;
const STANDARD_REQUEST_DEVICE_TO_HOST_TO_ENDPOINT: u8 = 0x82;
let mut buf = vec![0u8; length];
let read = self.handle.read_control(
STANDARD_REQUEST_DEVICE_TO_HOST_TO_ENDPOINT,
GET_STATUS,
0,
0,
&mut buf,
Duration::from_secs(1),
);
let Err(err) = read else {
return Err(crate::SwitchError::ExpectedError);
};
if err != rusb::Error::Timeout {
return Err(err.into());
}
Ok(())
}
fn validate_environment(&self) -> crate::Result<()> {
Ok(())
}
}