Skip to content

Commit

Permalink
Fix Compiler Warnings + Channel arg updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragnt committed Jan 31, 2024
1 parent fa2b9c6 commit e427a6d
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 64 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
members = ["libs/libwifi", "libs/libwifi_macros", "libs/pcap-file"]

[workspace.package]
version = "0.8.0"
version = "0.8.2"
authors = ["Ryan Butler"]
description = "80211 Attack Tool"
license = "MIT"
Expand Down
1 change: 0 additions & 1 deletion libs/libwifi/src/frame/components/mac_address.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::fmt;
use std::hash::{Hash, Hasher};

use nom::AsBytes;
use rand::{thread_rng, Rng, RngCore};

/// This is our representation of a MAC-address
Expand Down
3 changes: 3 additions & 0 deletions libs/libwifi/src/parsers/components/station_info.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(dead_code)]
use nom::bytes::complete::take;
use nom::number::complete::u8 as get_u8;
use nom::sequence::tuple;
Expand All @@ -10,6 +11,8 @@ use crate::frame::components::{
WpaAkmSuite, WpaCipherSuite, WpaInformation, WpsInformation, WpsSetupState,
};



/// Parse variable length and variable field information.
/// The general structure of the data looks like this:
///
Expand Down
7 changes: 0 additions & 7 deletions libs/pcap-file/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,3 @@ thiserror = "1.0.35"
criterion = "0.4.0"
glob = "0.3.0"
hex = "0.4.3"

[[bench]]
name = "benches"
harness = false

[profile.bench]
lto = "fat"
2 changes: 1 addition & 1 deletion src/advancedtable/advtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::iter;

use itertools::Itertools;
use ratatui::{layout::Constraint, style::Style, text::Text, widgets::Paragraph};
use ratatui::{layout::Constraint, style::Style, text::Text};
use strum::{Display, EnumString};
use unicode_width::UnicodeWidthStr;

Expand Down
6 changes: 2 additions & 4 deletions src/attack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use std::{
os::fd::AsRawFd,
sync::mpsc::channel,
time::{Duration, SystemTime},
};

Expand All @@ -13,16 +12,15 @@ use libwifi::{
},
parse_frame, Addresses, Frame,
};
use nl80211_ng::channels::{WiFiBand, WiFiChannel};
use rand::seq::SliceRandom;
use nl80211_ng::channels::WiFiBand;

use crate::{
status::{MessageType, StatusMessage},
tx::{
build_association_request_rg, build_authentication_frame_noack, build_csa_beacon,
build_deauthentication_fm_ap, build_deauthentication_fm_client,
build_disassocation_from_ap, build_disassocation_from_client,
build_probe_request_undirected, build_probe_response, build_reassociation_request,
build_probe_response, build_reassociation_request,
},
write_packet, OxideRuntime,
};
Expand Down
13 changes: 5 additions & 8 deletions src/auth.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
use std::{
collections::HashMap,
fmt,
time::{Duration, SystemTime, UNIX_EPOCH},
time::{Duration, SystemTime},
};

use chrono::{DateTime, Local};

use libwifi::frame::{components::MacAddress, EapolKey, KeyInformation, MessageType, Pmkid};
use libwifi::frame::{components::MacAddress, EapolKey, MessageType, Pmkid};

use crate::{
util::{
eapol_to_json_str, epoch_to_iso_string, epoch_to_string, key_info_to_json_str,
use crate::util::{
eapol_to_json_str,
slice_to_hex_string, system_time_to_iso8601,
},
OxideRuntime,
};
};

#[derive(Clone, Debug, Default)]
pub struct FourWayHandshake {
Expand Down
11 changes: 2 additions & 9 deletions src/database.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
use byteorder::{ByteOrder, LE};
use libwifi::frame::components::MacAddress;
use nl80211_ng::Interface;

use rusqlite::{params, Connection, Result};
use std::borrow::Cow;
use std::fs::File;
use std::time::{Duration, UNIX_EPOCH};
use std::time::Duration;
use std::{
sync::{
self,
Expand All @@ -14,11 +10,8 @@ use std::{
Arc, Mutex,
},
thread,
time::SystemTime,
};
use uuid::{uuid, Uuid};

use crate::gps::{self, GpsData};
use crate::pcapng::FrameData;

pub struct DatabaseWriter {
Expand Down Expand Up @@ -156,7 +149,7 @@ pub fn setup_database(conn: &Connection, datasource: String, interface: Interfac

fn add_frame(conn: &Connection, frx: &FrameData) {
let packet_data = PacketData::new(frx);
let result = conn.execute(
let _result = conn.execute(
"INSERT INTO packets (ts_sec, ts_usec, phyname, sourcemac, destmac, transmac, frequency, devkey, lat, lon, alt, speed, heading, packet_len, signal, datasource, dlt, packet, error, tags, datarate, hash, packetid) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23)",
params![
packet_data.ts_sec,
Expand Down
5 changes: 3 additions & 2 deletions src/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const CONST_T1_TIMEOUT: Duration = Duration::from_secs(5); // Do not change stat
const CONST_T2_TIMEOUT: Duration = Duration::from_millis(200); // Still need a purpose for this.

//////////////////////////////////////////////////////////////////////
///
#[derive(Clone, Debug)]
pub struct AuthSequence {
pub t1: SystemTime,
Expand Down Expand Up @@ -76,7 +77,7 @@ impl AuthSequence {
// Trait to restrict WiFiDeviceList
pub trait WiFiDeviceType {}

trait HasSSID {
pub trait HasSSID {
fn ssid(&self) -> &Option<String>;
}

Expand Down Expand Up @@ -767,7 +768,7 @@ impl WiFiDeviceList<AccessPoint> {

let mut rows: Vec<(Vec<String>, u16)> = Vec::new();
for (idx, ap) in access_points.iter().enumerate() {
let mut ap_row = vec![
let ap_row = vec![
format!(
"{}",
if ap.is_target() {
Expand Down
14 changes: 6 additions & 8 deletions src/eventhandler.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
use byteorder::{ByteOrder, LE};

use crossterm::event::{poll, Event, KeyCode, KeyEventKind, MouseEventKind};

use std::time::{Duration, UNIX_EPOCH};
use std::time::Duration;
use std::{
sync::{
self,
atomic::{AtomicBool, Ordering},
mpsc::{self, Receiver, Sender},
Arc, Mutex,
Arc,
},
thread,
time::SystemTime,
};
use uuid::Uuid;

pub enum EventType {
Key(Event),
Expand Down Expand Up @@ -60,7 +58,7 @@ impl EventHandler {
let event = crossterm::event::read().unwrap();
if let Event::Key(key) = event {
if key.kind == KeyEventKind::Press {
match key.code {
let _ = match key.code {
KeyCode::Char('d') => tx.send(EventType::Key(event)),
KeyCode::Char('a') => tx.send(EventType::Key(event)),
KeyCode::Char('W') => tx.send(EventType::Key(event)),
Expand Down Expand Up @@ -88,14 +86,14 @@ impl EventHandler {
};
}
} else if let Event::Mouse(mouse) = event {
match mouse.kind {
let _ = match mouse.kind {
MouseEventKind::ScrollDown => tx.send(EventType::Key(event)),
MouseEventKind::ScrollUp => tx.send(EventType::Key(event)),
_ => Ok({}),
};
}
}
tx.send(EventType::Tick);
let _ = tx.send(EventType::Tick);
}
}));
}
Expand Down
9 changes: 3 additions & 6 deletions src/gps.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use chrono::prelude::*;
use gpsd_proto::{get_data, handshake, GpsdError, ResponseData};
use itertools::Itertools;

use std::io::{self, BufReader, BufWriter};
use gpsd_proto::{get_data, handshake, ResponseData};
use std::io::{self, BufReader};
use std::net::TcpStream;
use std::os::unix::thread::JoinHandleExt;

use std::time::{Duration, UNIX_EPOCH};
use std::{
Expand Down Expand Up @@ -383,7 +380,7 @@ impl Fixed3_7 {
if self.value > 3600000000 {
panic!("Value too much");
}
let remapped = (self.value as i64 - (180 * 10000000));
let remapped = self.value as i64 - (180 * 10000000);
remapped as f64 / 10000000.0
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(dead_code)]
mod advancedtable;
mod ascii;
mod attack;
Expand Down Expand Up @@ -109,8 +110,8 @@ struct Arguments {
#[arg(short, long)]
/// Interface to use.
interface: String,
#[arg(short, long)]
/// Optional - Channel to scan. Will use "-c 1 -c 6 -c 11" if none specified.
#[arg(short, long, use_value_delimiter = true, value_parser, num_args = 1, action = clap::ArgAction::Append)]
/// Optional - Channel to scan. Will use "-c 1,6,11" if none specified.
channel: Vec<String>,
#[arg(short, long)]
/// Optional - Entire band to scan - will include all channels interface can support.
Expand Down Expand Up @@ -335,7 +336,7 @@ impl OxideRuntime {

let mut netlink = Nl80211::new().expect("Cannot open Nl80211");

let mut iface = if let Some(interface) = netlink
let iface = if let Some(interface) = netlink
.get_interfaces()
.iter()
.find(|&(_, iface)| iface.name_as_string() == interface_name)
Expand Down Expand Up @@ -985,7 +986,6 @@ fn process_frame(oxide: &mut OxideRuntime, packet: &[u8]) -> Result<(), String>
.unwrap();
oxide.if_hardware.current_channel = current_channel.clone();
let band: WiFiBand = current_channel.get_band();
let channel_u8: u8 = current_channel.get_channel_number();

let payload = &packet[radiotap.header.length..];

Expand Down
1 change: 0 additions & 1 deletion src/oui.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::collections::HashMap;

use libwifi::frame::components::MacAddress;

Expand Down
7 changes: 3 additions & 4 deletions src/pcapng.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use byteorder::{ByteOrder, LE};
use byteorder::LE;
use crc32fast::Hasher;
use libwifi::frame::components::MacAddress;
use nl80211_ng::Interface;
Expand All @@ -8,7 +8,7 @@ use pcap_file::pcapng::blocks::interface_description::{
};
use pcap_file::pcapng::blocks::opt_common::CustomBinaryOption;
use pcap_file::pcapng::blocks::section_header::{SectionHeaderBlock, SectionHeaderOption};
use pcap_file::pcapng::{PcapNgBlock, PcapNgWriter};
use pcap_file::pcapng::PcapNgWriter;
use pcap_file::{DataLink, Endianness};
use std::borrow::Cow;
use std::fs::File;
Expand All @@ -26,8 +26,7 @@ use std::{
use uname::uname;
use uuid::Uuid;

use crate::gps::{self, GpsData};
use crate::status::{self, MessageType, StatusMessage};
use crate::gps::GpsData;

#[derive(Clone, Debug)]
pub struct FrameData {
Expand Down
2 changes: 1 addition & 1 deletion src/status.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use chrono::{DateTime, Utc};
use std::{collections::VecDeque, fmt};
use std::fmt;

// Define an enum for message types

Expand Down
4 changes: 2 additions & 2 deletions src/tabbedblock/tabbedblock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use super::tab::{Position, Tab};
use ratatui::{
buffer::Buffer,
layout::{Alignment, Rect},
style::{Color, Style, Styled},
style::{Style, Styled},
symbols::line,
text::{Line, Span},
text::Line,
widgets::{Borders, Clear, Widget},
};

Expand Down
2 changes: 1 addition & 1 deletion src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ pub fn build_disassocation_from_ap(
ap_mac: &MacAddress,
client_mac: &MacAddress,
sequence: u16,
reason_code: DeauthenticationReason,
_reason_code: DeauthenticationReason,
) -> Vec<u8> {
let mut rth: Vec<u8> = RTH_NO_ACK.to_vec();

Expand Down
3 changes: 0 additions & 3 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use copypasta_ext::osc52::Osc52ClipboardContext;
use copypasta_ext::prelude::*;
use copypasta_ext::x11_bin::X11BinClipboardContext;
use derive_setters::Setters;
use gpsd_proto::Mode;
use libwifi::frame::components::MacAddress;
use rand::Rng;
use std::{io::Result, time::Instant};

use crate::{
Expand All @@ -23,7 +21,6 @@ use crate::{
OxideRuntime,
};

use nl80211_ng::get_interface_info_idx;

// Ratatui imports:
use ratatui::{
Expand Down

0 comments on commit e427a6d

Please sign in to comment.