keyfork-mnemonic-generate: treat offline as success

This commit is contained in:
Ryan Heywood 2023-08-16 05:50:08 -05:00
parent 067a373993
commit d4036d8b72
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ use sha2::{Digest, Sha256};
static WARNING_LINKS: [&str; 1] = static WARNING_LINKS: [&str; 1] =
["https://lore.kernel.org/lkml/20211223141113.1240679-2-Jason@zx2c4.com/"]; ["https://lore.kernel.org/lkml/20211223141113.1240679-2-Jason@zx2c4.com/"];
fn check_kernel_version() { fn ensure_safe_kernel_version() {
let kernel_version = read_to_string("/proc/version").expect("/proc/version"); let kernel_version = read_to_string("/proc/version").expect("/proc/version");
let v = kernel_version let v = kernel_version
.split(' ') .split(' ')
@ -40,7 +40,7 @@ fn check_kernel_version() {
); );
} }
fn check_online() { fn ensure_offline() {
let paths = read_dir("/sys/class/net").expect("Unable to read network interfaces"); let paths = read_dir("/sys/class/net").expect("Unable to read network interfaces");
for entry in paths { for entry in paths {
let mut path = entry.expect("Unable to read directory entry").path(); let mut path = entry.expect("Unable to read directory entry").path();
@ -74,8 +74,8 @@ fn main() -> Result<(), Box<dyn Error>> {
if !env::vars() if !env::vars()
.any(|(name, _)| name == "SHOOT_SELF_IN_FOOT" || name == "INSECURE_HARDWARE_ALLOWED") .any(|(name, _)| name == "SHOOT_SELF_IN_FOOT" || name == "INSECURE_HARDWARE_ALLOWED")
{ {
check_kernel_version(); ensure_safe_kernel_version();
check_online(); ensure_offline();
} }
let wordlist = build_wordlist(); let wordlist = build_wordlist();