8000 feat: version 0.7.3 by martin-olivier · Pull Request #128 · martin-olivier/airgorah · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: version 0.7.3 #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 12, 2024
Merged
2 changes: 1 addition & 1 deletion .fpm
Original file line number Diff line number Diff line change
@@ -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 <martin.olivier@live.fr>"
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
.vscode/
.DS_Store
*~
\#*#
\#*

# Build Folder

/target

# Build artifacts

*.deb
*.rpm
*.tar.gz
3 changes: 1 addition & 2 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion package/.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions src/backend/app.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::*;
use crate::globals::*;

#[derive(thiserror::Error, Debug)]
pub enum AppError {
Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions src/backend/capture.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::*;
use crate::globals::*;
use crate::types::*;

use regex::Regex;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);

Expand Down
12 changes: 11 additions & 1 deletion src/backend/interface.rs
F438
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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)? {
Expand Down Expand Up @@ -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);
Expand Down
53 changes: 36 additions & 17 deletions src/backend/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
];
Expand Down Expand Up @@ -194,26 +195,26 @@ 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 10000 = 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(());
}

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(());
Expand All @@ -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();

Expand All @@ -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,
Expand Down Expand Up @@ -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())
}
3 changes: 0 additions & 3 deletions src/frontend/connections/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/interfaces/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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());
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use gtk4::gio::ApplicationFlags;
use gtk4::prelude::*;
use gtk4::{Application, Settings};

Expand All @@ -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);
Expand Down
0