foxmark3 0.1.1

Send/receive Proxmark 3 commands
Documentation
//! An example which attempts to read an ISO 14443A card from atop the HF antenna

use foxmark3::commands::iclass::Card;

fn main() {
    tracing_subscriber::fmt()
        .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
        .init();

    let path = {
        let mut args = std::env::args();
        args.next();

        match (args.next(), args.next()) {
            (None, _) | (_, Some(_)) => {
                eprintln!("Usage: hid_iclass [PATH]");
                return;
            }
            (Some(path), None) => path,
        }
    };

    let mut pm3 = foxmark3::new(path).expect("connecting to device");
    let card = pm3.read_iclass().expect("HID IClass card selection");

    match card {
        None => eprintln!("No card found!"),
        Some(Card { csn: None, .. }) => eprintln!("Card found, but CSN is UNKNOWN"),
        Some(Card { csn: Some(csn), .. }) => {
            println!("{}", csn.map(|b| format!("{b:02X}")).join(" "))
        }
    }
}