Skip to content

Commit

Permalink
Quit Confirmation & Copy key (with JSON!)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragnt committed Jan 20, 2024
1 parent 6b5e800 commit 0e3b829
Show file tree
Hide file tree
Showing 9 changed files with 704 additions and 145 deletions.
179 changes: 176 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ nl80211-ng = "0.2.3"
procfs = "0.16.0"
uname = "0.1.1"
globset = "0.4.14"
terminal-clipboard = "0.4.1"
31 changes: 31 additions & 0 deletions libs/libwifi/src/frame/data/qos_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,21 @@ impl NullDataFrame for QosNull {
}
}

#[derive(Clone, Debug)]
pub struct KeyInformation {
pub descriptor_version: u8,
pub key_type: bool,
pub key_index: u8,
pub install: bool,
pub key_ack: bool,
pub key_mic: bool,
pub secure: bool,
pub error: bool,
pub request: bool,
pub encrypted_key_data: bool,
pub smk_message: bool,
}

#[derive(Clone, Debug)]
pub struct EapolKey {
pub protocol_version: u8,
Expand Down Expand Up @@ -216,6 +231,22 @@ impl EapolKey {
Ok(buf)
}

pub fn parse_key_information(&self) -> KeyInformation {
KeyInformation {
descriptor_version: (self.key_information & 0x0007) as u8, // Bits 0-2
key_type: (self.key_information & 0x0008) != 0, // Bit 3
key_index: ((self.key_information & 0x0030) >> 4) as u8, // Bits 4-5
install: (self.key_information & 0x0040) != 0, // Bit 6
key_ack: (self.key_information & 0x0080) != 0, // Bit 7
key_mic: (self.key_information & 0x0100) != 0, // Bit 8
secure: (self.key_information & 0x0200) != 0, // Bit 9
error: (self.key_information & 0x0400) != 0, // Bit 10
request: (self.key_information & 0x0800) != 0, // Bit 11
encrypted_key_data: (self.key_information & 0x1000) != 0, // Bit 12
smk_message: (self.key_information & 0x2000) != 0, // Bit 13
}
}

pub fn determine_key_type(&self) -> MessageType {
/*
00000001 00001010
Expand Down
Loading

0 comments on commit 0e3b829

Please sign in to comment.