Skip to content

Commit

Permalink
Fix Whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragnt committed Jan 19, 2024
1 parent 5f58dde commit 1adbcda
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -2,7 +2,7 @@
members = ["libs/libwifi", "libs/libwifi_macros", "libs/pcap-file"]

[workspace.package]
version = "0.7.4"
version = "0.7.5"
authors = ["Ryan Butler"]
description = "80211 Attack Tool"
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Expand Up @@ -354,15 +354,15 @@ impl OxideRuntime {
.filter_map(|f| {
match MacAddress::from_str(&f) {
Ok(mac) => {
if targ_list.is_target_mac(&mac) {
if targ_list.is_actual_target_mac(&mac) {
println!("Whitelist {} is a target. Cannot add to whitelist.", mac);
None
} else {
Some(White::MAC(WhiteMAC::new(mac)))
}
},
Err(_) => {
if targ_list.is_target_ssid(&f) {
if targ_list.is_actual_target_ssid(&f) {
println!("Whitelist {} is a target. Cannot add to whitelist.", f);
None
} else {
Expand Down
30 changes: 30 additions & 0 deletions src/targets.rs
Expand Up @@ -182,6 +182,36 @@ impl TargetList {
return matches;
}

pub fn is_actual_target_mac(&self, mac: &MacAddress) -> bool {

for target in &self.targets {
match target {
Target::MAC(tgt) => {
if tgt.addr == *mac {
return true;
}
}
Target::SSID(_) => {} // do nothing
}
}
false
}

pub fn is_actual_target_ssid(&self, ssid: &str) -> bool {

for target in &self.targets {
match target {
Target::MAC(_) => {} // do nothing, we don't have anything to compare to here.
Target::SSID(tgt) => {
if tgt.match_ssid(ssid.to_owned()) {
return true;
}
}
}
}
false
}

pub fn is_target_mac(&self, mac: &MacAddress) -> bool {
if self.empty() {
return true;
Expand Down

0 comments on commit 1adbcda

Please sign in to comment.