Skip to content

A WiFi security auditing software

feat: version 0.7.3 (#128)

Martin Olivier26e0888bdd8e
diff --git a/.fpm b/.fpm
index 075ef3a..b0603b5 100644
--- a/.fpm
+++ b/.fpm
@@ -1,7 +1,7 @@
-s dir ./target/release/airgorah ./icons/app_icon.png package README.md LICENSE
--name airgorah
--license MIT
---version 0.7.2
+--version 0.7.3
--description "A WiFi auditing software that can perform deauth attacks and passwords cracking"
--url "https://github.com/martin-olivier/airgorah"
--maintainer "Martin Olivier <[email protected]>"
diff --git a/.gitignore b/.gitignore
index 0d9563d..e87d714 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,8 +4,14 @@
.vscode/
.DS_Store
*~
-\#*#
+\#*
# Build Folder
/target
+
+# Build artifacts
+
+*.deb
+*.rpm
+*.tar.gz
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index 4231f9d..5c6c074 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -19,13 +19,12 @@ dependencies = [
[[package]]
name = "airgorah"
-version = "0.7.2"
+version = "0.7.3"
dependencies = [
"chrono",
"csv",
"ctrlc",
"env_logger",
- "glib",
"gtk4",
"lazy_static",
"log",
diff --git a/Cargo.toml b/Cargo.toml
index 5dc3d36..2d646db 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "airgorah"
-version = "0.7.2"
+version = "0.7.3"
edition = "2021"
license = "MIT"
description = "A WiFi security auditing software mainly based on aircrack-ng tools suite"
@@ -14,7 +14,6 @@ exclude = ["/.github", "/.fpm", "/Dockerfile"]
[dependencies]
gtk4 = { version = "0.8", features = ["v4_6"] }
-glib = "0.19"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
toml = "0.8"
diff --git a/package/.desktop b/package/.desktop
index 3664c42..7b49a3d 100644
--- a/package/.desktop
+++ b/package/.desktop
@@ -4,6 +4,6 @@ Comment=A WiFi auditing software that can perform deauth attacks and passwords c
Exec=pkexec airgorah
Icon=/usr/share/pixmaps/airgorah.png
ApplicationId=com.molivier.airgorah
-Categories=System;Utility;
+Categories=Network;Monitor;Utility;GTK;
Type=Application
Terminal=false
diff --git a/src/backend/app.rs b/src/backend/app.rs
index 0cb7f98..e6d21cd 100755
--- a/src/backend/app.rs
+++ b/src/backend/app.rs
@@ -1,5 +1,4 @@
use super::*;
-use crate::globals::*;
#[derive(thiserror::Error, Debug)]
pub enum AppError {
@@ -50,12 +49,13 @@ pub fn app_cleanup() {
if let Some(ref iface) = get_iface() {
disable_monitor_mode(iface).ok();
- restore_network_manager().ok();
}
- std::fs::remove_file(LIVE_SCAN_PATH.to_string() + "-01.csv").ok();
- std::fs::remove_file(LIVE_SCAN_PATH.to_string() + "-01.cap").ok();
- std::fs::remove_file(OLD_SCAN_PATH.to_string() + "-01.cap").ok();
+ restore_network_manager().ok();
+
+ std::fs::remove_file(get_live_scan_path() + get_csv_ext()).ok();
+ std::fs::remove_file(get_live_scan_path() + get_cap_ext()).ok();
+ std::fs::remove_file(get_old_scan_path() + get_cap_ext()).ok();
}
/// Check if a dependency is installed
diff --git a/src/backend/capture.rs b/src/backend/capture.rs
index 6d338ce..9cb8c4b 100755
--- a/src/backend/capture.rs
+++ b/src/backend/capture.rs
@@ -1,5 +1,4 @@
use super::*;
-use crate::globals::*;
use crate::types::*;
use regex::Regex;
@@ -29,8 +28,8 @@ pub enum CapError {
/// Update the handshake capture status of all APs
pub fn update_handshakes() -> Result<(), CapError> {
let handshakes = get_handshakes([
- &(LIVE_SCAN_PATH.to_string() + "-01.cap"),
- &(OLD_SCAN_PATH.to_string() + "-01.cap"),
+ &(get_live_scan_path() + get_cap_ext()),
+ &(get_old_scan_path() + get_cap_ext()),
])?;
let mut aps = get_aps();
@@ -86,7 +85,7 @@ where
/// Save the current capture to a file
pub fn save_capture(path: &str) -> Result<(), CapError> {
- std::fs::copy(OLD_SCAN_PATH.to_string() + "-01.cap", path)?;
+ std::fs::copy(get_old_scan_path() + get_cap_ext(), path)?;
log::info!("capture saved to '{}'", path);
diff --git a/src/backend/interface.rs b/src/backend/interface.rs
index bef8402..a2d46e1 100644
--- a/src/backend/interface.rs
+++ b/src/backend/interface.rs
@@ -79,7 +79,7 @@ pub fn is_5ghz_supported(iface: &str) -> Result<bool, IfaceError> {
let check_band_output = String::from_utf8(check_band_cmd.stdout)?;
- if check_band_output.contains("5200 MHz") {
+ if check_band_output.contains("5200 MHz") || check_band_output.contains("5200.0 MHz") {
return Ok(true);
}
@@ -148,6 +148,10 @@ pub fn set_mac_address(iface: &str) -> Result<(), IfaceError> {
/// enable monitor mode on an interface
pub fn enable_monitor_mode(iface: &str) -> Result<String, IfaceError> {
+ if is_monitor_mode(iface)? {
+ *IFACE_WAS_MONITOR.lock().unwrap() = true;
+ }
+
kill_network_manager()?;
if is_monitor_mode(iface)? {
@@ -214,6 +218,12 @@ pub fn disable_monitor_mode(iface: &str) -> Result<(), IfaceError> {
return Ok(());
}
+ let mut iface_was_monitor = IFACE_WAS_MONITOR.lock().unwrap();
+ if *iface_was_monitor {
+ *iface_was_monitor = false;
+ return Ok(());
+ }
+
let disable_monitor_cmd = Command::new("airmon-ng").args(["stop", iface]).output()?;
log::info!("{}: monitor mode disabled", iface);
diff --git a/src/backend/scan.rs b/src/backend/scan.rs
index e794c60..e1cc561 100644
--- a/src/backend/scan.rs
+++ b/src/backend/scan.rs
@@ -137,13 +137,14 @@ pub fn set_scan_process(
stop_scan_process()?;
+ let live_scan_path = get_live_scan_path();
let mut proc_args = vec![
iface,
"-a",
"--output-format",
"csv,cap",
"-w",
- LIVE_SCAN_PATH,
+ &live_scan_path,
"--write-interval",
"1",
];
@@ -194,17 +195,17 @@ pub fn stop_scan_process() -> Result<(), ScanError> {
kill(child_pid, Signal::SIGTERM)?;
- log::info!("scan stopped, sent kill SIGTERM to pid {}", child_pid);
+ log::info!("scan stopped, sent SIGTERM to pid {}", child_pid);
child.wait()?;
}
SCAN_PROC.lock().unwrap().take();
- let old_path_exists = Path::new(&(OLD_SCAN_PATH.to_string() + "-01.cap")).exists();
- let live_path_exists = Path::new(&(LIVE_SCAN_PATH.to_string() + "-01.cap")).exists();
+ let old_path_exists = Path::new(&(get_old_scan_path() + get_cap_ext())).exists();
+ let live_path_exists = Path::new(&(get_live_scan_path() + get_cap_ext())).exists();
- std::fs::remove_file(LIVE_SCAN_PATH.to_string() + "-01.csv").ok();
+ std::fs::remove_file(get_live_scan_path() + get_csv_ext()).ok();
if !live_path_exists {
return Ok(());
@@ -212,8 +213,8 @@ pub fn stop_scan_process() -> Result<(), ScanError> {
if !old_path_exists {
std::fs::rename(
- LIVE_SCAN_PATH.to_string() + "-01.cap",
- OLD_SCAN_PATH.to_string() + "-01.cap",
+ get_live_scan_path() + get_cap_ext(),
+ get_old_scan_path() + get_cap_ext(),
)
.ok();
return Ok(());
@@ -225,17 +226,17 @@ pub fn stop_scan_process() -> Result<(), ScanError> {
"-F",
"pcap",
"-w",
- &(MERGE_SCAN_PATH.to_string() + "-01.cap"),
- &(OLD_SCAN_PATH.to_string() + "-01.cap"),
- &(LIVE_SCAN_PATH.to_string() + "-01.cap"),
+ &(get_merge_scan_path() + get_cap_ext()),
+ &(get_old_scan_path() + get_cap_ext()),
+ &(get_live_scan_path() + get_cap_ext()),
])
.status()?;
- std::fs::remove_file(LIVE_SCAN_PATH.to_string() + "-01.cap").ok();
- std::fs::remove_file(OLD_SCAN_PATH.to_string() + "-01.cap").ok();
+ std::fs::remove_file(get_live_scan_path() + get_cap_ext()).ok();
+ std::fs::remove_file(get_old_scan_path() + get_cap_ext()).ok();
std::fs::rename(
- MERGE_SCAN_PATH.to_string() + "-01.cap",
- OLD_SCAN_PATH.to_string() + "-01.cap",
+ get_merge_scan_path() + get_cap_ext(),
+ get_old_scan_path() + get_cap_ext(),
)
.ok();
@@ -256,7 +257,7 @@ pub fn get_airodump_data() -> HashMap<String, AP> {
aps.insert(ap.0.clone(), ap.1.clone());
}
- let full_path = LIVE_SCAN_PATH.to_string() + "-01.csv";
+ let full_path = get_live_scan_path() + get_csv_ext();
let csv_file = match std::fs::read_to_string(full_path) {
Ok(file) => file,
Err(_) => return aps,
@@ -405,12 +406,30 @@ pub fn get_airodump_data() -> HashMap<String, AP> {
aps
}
-/// Get the APs data collected
pub fn get_aps() -> MutexGuard<'static, HashMap<String, AP>> {
APS.lock().unwrap()
}
-/// Get unlinked clients
pub fn get_unlinked_clients() -> MutexGuard<'static, HashMap<String, Client>> {
UNLINKED_CLIENTS.lock().unwrap()
}
+
+pub fn get_cap_ext() -> &'static str {
+ "-01.cap"
+}
+
+pub fn get_csv_ext() -> &'static str {
+ "-01.csv"
+}
+
+pub fn get_live_scan_path() -> String {
+ format!("{}-{}", LIVE_SCAN_PATH, std::process::id())
+}
+
+pub fn get_old_scan_path() -> String {
+ format!("{}-{}", OLD_SCAN_PATH, std::process::id())
+}
+
+pub fn get_merge_scan_path() -> String {
+ format!("{}-{}", MERGE_SCAN_PATH, std::process::id())
+}
diff --git a/src/frontend/connections/interface.rs b/src/frontend/connections/interface.rs
index 0fbf40c..e61f551 100644
--- a/src/frontend/connections/interface.rs
+++ b/src/frontend/connections/interface.rs
@@ -64,7 +64,6 @@ fn connect_interface_select(app_data: Rc<AppData>) {
Ok(res) => {
if let Err(e) = backend::set_mac_address(&res) {
backend::disable_monitor_mode(&iface).ok();
- backend::restore_network_manager().ok();
app_data.interface_gui.refresh_but.emit_clicked();
@@ -98,8 +97,6 @@ fn connect_interface_select(app_data: Rc<AppData>) {
app_data.interface_gui.window.hide();
}
Err(e) => {
- backend::restore_network_manager().ok();
-
app_data.interface_gui.refresh_but.emit_clicked();
ErrorDialog::spawn(
diff --git a/src/frontend/interfaces/interface.rs b/src/frontend/interfaces/interface.rs
index 4c930fd..df93e3f 100755
--- a/src/frontend/interfaces/interface.rs
+++ b/src/frontend/interfaces/interface.rs
@@ -33,7 +33,7 @@ impl InterfaceGui {
let window = Window::builder()
.title("Select a wireless interface")
.hide_on_close(true)
- .default_width(280)
+ .default_width(300)
.default_height(70)
.resizable(false)
.modal(true)
diff --git a/src/globals.rs b/src/globals.rs
index 088aad7..397a878 100644
--- a/src/globals.rs
+++ b/src/globals.rs
@@ -7,7 +7,7 @@ use std::sync::Mutex;
use std::thread::JoinHandle;
pub static APP_ID: &str = "com.molivier.airgorah";
-pub static VERSION: &str = "v0.7.2";
+pub static VERSION: &str = "v0.7.3";
pub static LIVE_SCAN_PATH: &str = "/tmp/airgorah_live_scan";
pub static OLD_SCAN_PATH: &str = "/tmp/airgorah_old_scan";
@@ -24,6 +24,7 @@ pub type AttackPool = HashMap<String, (AP, AttackedClients)>;
lazy_static! {
pub static ref IFACE: Mutex<Option<String>> = Mutex::new(None);
+ pub static ref IFACE_WAS_MONITOR: Mutex<bool> = Mutex::new(false);
pub static ref UPDATE_PROC: Mutex<Option<JoinHandle<bool>>> = Mutex::new(None);
pub static ref SCAN_PROC: Mutex<Option<Child>> = Mutex::new(None);
pub static ref APS: Mutex<HashMap<String, AP>> = Mutex::new(HashMap::new());
diff --git a/src/main.rs b/src/main.rs
index c97f14e..74e4458 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,4 @@
+use gtk4::gio::ApplicationFlags;
use gtk4::prelude::*;
use gtk4::{Application, Settings};
@@ -17,6 +18,7 @@ fn main() {
let application = Application::builder()
.application_id(globals::APP_ID)
+ .flags(ApplicationFlags::NON_UNIQUE)
.build();
application.connect_activate(frontend::build_ui);