diff --git a/Cargo.lock b/Cargo.lock index 8afc2e6..0a4e06c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2612,8 +2612,9 @@ dependencies = [ [[package]] name = "tokio-wifiscanner" -version = "0.2.1" -source = "git+https://github.com/Chleba/tokio-wifiscanner.git#6106aa461b0c73e7e2d52aea43fa1dc2aaa5ac91" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7d0f9c65b01c6a6368ac63159de22d07dfd57e4cf811168f75750592087d5f" dependencies = [ "itertools 0.10.5", "os-version", diff --git a/Cargo.toml b/Cargo.toml index 8c384a8..7f6cc4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,8 +86,7 @@ strum = "0.26.3" surge-ping = "0.8.1" tokio = { version = "1.40.0", features = ["full"] } tokio-util = "0.7.12" -# tokio-wifiscanner = { path = "./libs/wifiscanner" } -tokio-wifiscanner = { git = "https://github.com/Chleba/tokio-wifiscanner.git" } +tokio-wifiscanner = "0.2.2" tracing = "0.1.40" tracing-error = "0.2.0" tracing-subscriber = { version = "0.3.18", features = ["env-filter", "serde"] } diff --git a/libs/wifiscanner/.gitignore b/libs/wifiscanner/.gitignore deleted file mode 100644 index 40d9aca..0000000 --- a/libs/wifiscanner/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -/.idea \ No newline at end of file diff --git a/libs/wifiscanner/Cargo.lock b/libs/wifiscanner/Cargo.lock deleted file mode 100644 index c2f9fa8..0000000 --- a/libs/wifiscanner/Cargo.lock +++ /dev/null @@ -1,508 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "addr2line" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "anyhow" -version = "1.0.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" - -[[package]] -name = "backtrace" -version = "0.3.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets", -] - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bytes" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "gimli" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" - -[[package]] -name = "hashbrown" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "indexmap" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" -dependencies = [ - "equivalent", - "hashbrown", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "libc" -version = "0.2.159" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" -dependencies = [ - "hermit-abi", - "libc", - "wasi", - "windows-sys", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "object" -version = "0.36.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" -dependencies = [ - "memchr", -] - -[[package]] -name = "os-version" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a8a1fed76ac765e39058ca106b6229a93c5a60292a1bd4b602ce2be11e1c020" -dependencies = [ - "anyhow", - "plist", - "uname", - "winapi", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "plist" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" -dependencies = [ - "base64", - "indexmap", - "quick-xml", - "serde", - "time", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quick-xml" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d3a6e5838b60e0e8fa7a43f22ade549a37d61f8bdbe636d0d7816191de969c2" -dependencies = [ - "memchr", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "regex" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "serde" -version = "1.0.215" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.215" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - -[[package]] -name = "syn" -version = "2.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tokio" -version = "1.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "pin-project-lite", - "signal-hook-registry", - "tokio-macros", - "windows-sys", -] - -[[package]] -name = "tokio-macros" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-wifiscanner" -version = "0.2.1" -dependencies = [ - "itertools", - "os-version", - "regex", - "tokio", - "version-compare", -] - -[[package]] -name = "uname" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72f89f0ca32e4db1c04e2a72f5345d59796d4866a1ee0609084569f73683dc8" -dependencies = [ - "libc", -] - -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "version-compare" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/libs/wifiscanner/Cargo.toml b/libs/wifiscanner/Cargo.toml deleted file mode 100644 index 14948fd..0000000 --- a/libs/wifiscanner/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "tokio-wifiscanner" -version = "0.2.1" -authors = ["MichaƂ Mania "] -edition = "2018" -description = "List WiFi hotspots in your area" -repository = "https://github.com/mic90/tokio-wifiscanner" -documentation = "https://docs.rs/tokio-wifiscanner" -keywords = ["wifi","hotspots","network","tokio"] -readme = "README.md" -license = "Apache-2.0" - -[[example]] -name = "scan" -path = "src/examples/main.rs" - -[dependencies] -regex = "1" -itertools = "0.10.0" -tokio = { version = "1.40.0", features = ["process"] } -os-version = "0.2.0" -version-compare = "0.2.0" - -[dev-dependencies] -regex = "1" -itertools = "0.10.0" -tokio = { version = "1.40.0", features = ["macros", "rt", "process"] } diff --git a/libs/wifiscanner/README.md b/libs/wifiscanner/README.md deleted file mode 100644 index e3a3e02..0000000 --- a/libs/wifiscanner/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# tokio-wifiscanner - -The project is a simple [tokio](https://tokio.rs) wrapper around [wifiscanner](https://github.com/booyaa/wifiscanner) library. - -# Usage - -This crate is [on crates.io](https://crates.io/crates/tokio-wifiscanner) and can be -used by adding `tokio-wifiscanner` to the dependencies in your project's `Cargo.toml`. - -```toml -[dependencies] -tokio-wifiscanner = "0.2.*" -``` - -and this to your crate root: - -```rust -extern crate tokio_wifiscanner; -``` - -## Example - -```rust -#[tokio::main(flavor = "current_thread")] -async fn main() { - let networks = tokio_wifiscanner::scan().await.expect("Cannot scan network"); - for network in networks { - println!( - "{} {:15} {:10} {:4} {}", - network.mac, network.ssid, network.channel, network.signal_level, network.security - ); - } -} - ``` - -Alternatively if you've cloned the Git repo, you can run the above example -using: `cargo run --example scan`. diff --git a/libs/wifiscanner/src/examples/main.rs b/libs/wifiscanner/src/examples/main.rs deleted file mode 100644 index 62c8a0a..0000000 --- a/libs/wifiscanner/src/examples/main.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[tokio::main(flavor = "current_thread")] -async fn main() { - let networks = tokio_wifiscanner::scan().await.expect("Cannot scan network"); - for network in networks { - println!( - "{} {:15} {:10} {:4} {}", - network.mac, network.ssid, network.channel, network.signal_level, network.security - ); - } -} diff --git a/libs/wifiscanner/src/lib.rs b/libs/wifiscanner/src/lib.rs deleted file mode 100644 index 62a8103..0000000 --- a/libs/wifiscanner/src/lib.rs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2016 Mark Sta Ana. -// Licensed under the Apache License, Version 2.0 , at your option. -// This file may not be copied, modified, or distributed except -// according to those terms. - -// Inspired by Maurice Svay's node-wifiscanner (https://github.com/mauricesvay/node-wifiscanner) - -//! A crate to list WiFi hotspots in your area. -//! -//! As of v0.5.x now supports macOS, Linux and Windows. :tada: -//! -//! # Usage -//! -//! This crate is on [crates.io](https://crates.io/crates/tokio-wifiscanner) and can be -//! used by adding `tokio-wifiscanner` to the dependencies in your project's `Cargo.toml`. -//! -//! ```toml -//! [dependencies] -//! tokio-wifiscanner = "0.2.*" -//! ``` -//! -//! and this to your crate root: -//! -//! ```rust -//! extern crate tokio_wifiscanner; -//! ``` -//! -//! # Example -//! -//! ``` -//!#[tokio::main(flavor = "current_thread")] -//!async fn main() { -//! let networks = tokio_wifiscanner::scan().await.expect("Cannot scan network"); -//! for network in networks { -//! println!( -//! "{} {:15} {:10} {:4} {}", -//! network.mac, network.ssid, network.channel, network.signal_level, network.security -//! ); -//! } -//!} -//! ``` -//! -//! Alternatively if you've cloned the the Git repo, you can run the above examples -//! using: `cargo run --example scan`. - -//TODO need to find a way to move these out of lib and into sys or better still windows module -#[cfg(target_os = "windows")] -#[macro_use] -extern crate itertools; -#[cfg(target_os = "windows")] -extern crate regex; - -mod sys; - -use std::fmt; -use std::process::ExitStatus; - -type Result = std::result::Result; - -#[allow(missing_docs)] -#[derive(Debug, PartialEq, Eq)] -pub enum Error { - SyntaxRegexError, - CommandNotFound, - CommandFailed(ExitStatus, String), - NoMatch, - FailedToParse, - NoValue, - HeaderNotFound(&'static str), -} - -/// Wifi struct used to return information about wifi hotspots -#[derive(Debug, PartialEq, Eq, Default, Clone)] -pub struct Wifi { - /// mac address - pub mac: String, - /// hotspot name - pub ssid: String, - pub channel: String, - /// wifi signal strength in dBm - pub signal_level: String, - /// this field is currently empty in the Linux version of the lib - pub security: String, -} - -impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Error::SyntaxRegexError => write!(f, "An error occured during syntax check"), - Error::CommandNotFound => write!(f, "Couldn't find command"), - Error::CommandFailed(status, reason) => { - write!(f, "Command failed with exit status {}: {}", status, reason) - } - Error::NoMatch => write!(f, "Couldn't match"), - Error::FailedToParse => write!(f, "Failed to parse command"), - Error::NoValue => write!(f, "Value expected but is not present"), - Error::HeaderNotFound(header) => { - write!(f, "Did not find header {} but expected it", header) - } - } - } -} - -impl std::error::Error for Error {} - -/// Returns a list of WiFi hotspots in your area. -/// Uses `airport` on macOS and `iw` on Linux. -pub async fn scan() -> Result> { - crate::sys::scan().await -} diff --git a/libs/wifiscanner/src/sys.rs b/libs/wifiscanner/src/sys.rs deleted file mode 100644 index 058b1d4..0000000 --- a/libs/wifiscanner/src/sys.rs +++ /dev/null @@ -1,17 +0,0 @@ -#[cfg(target_os = "macos")] -mod macos; -#[cfg(target_os = "macos")] -pub(crate) use self::macos::*; - -#[cfg(target_os = "linux")] -mod linux; -#[cfg(target_os = "linux")] -pub(crate) use self::linux::*; - -#[cfg(target_os = "windows")] -mod windows; -#[cfg(target_os = "windows")] -pub(crate) use self::windows::*; - -#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))] -compile_error!("wifiscan doesn't compile for this platform yet"); diff --git a/libs/wifiscanner/src/sys/linux.rs b/libs/wifiscanner/src/sys/linux.rs deleted file mode 100644 index 57c5948..0000000 --- a/libs/wifiscanner/src/sys/linux.rs +++ /dev/null @@ -1,158 +0,0 @@ -use crate::{Error, Result, Wifi}; -use std::env; - -/// Returns a list of WiFi hotspots in your area - (Linux) uses `iw` -pub(crate) async fn scan() -> Result> { - use tokio::process::Command; - const PATH_ENV: &'static str = "PATH"; - let path_system = "/usr/sbin:/sbin"; - let path = env::var_os(PATH_ENV).map_or(path_system.to_string(), |v| { - format!("{}:{}", v.to_string_lossy().into_owned(), path_system) - }); - - let output = Command::new("iw") - .env(PATH_ENV, path.clone()) - .arg("dev") - .output().await - .map_err(|_| Error::CommandNotFound)?; - let data = String::from_utf8_lossy(&output.stdout); - let interface = parse_iw_dev(&data)?; - - let output = Command::new("iw") - .env(PATH_ENV, path) - .arg("dev") - .arg(interface) - .arg("scan") - .output() - .await - .map_err(|_| Error::CommandNotFound)?; - if !output.status.success() { - return Err(Error::CommandFailed( - output.status, - String::from_utf8_lossy(&output.stderr).to_string(), - )); - } - let data = String::from_utf8_lossy(&output.stdout); - parse_iw_dev_scan(&data) -} - -fn parse_iw_dev(interfaces: &str) -> Result { - interfaces - .split("\tInterface ") - .take(2) - .last() - .ok_or(Error::NoValue)? - .split("\n") - .nth(0) - .ok_or(Error::NoValue) - .map(|text| text.to_string()) -} - -fn parse_iw_dev_scan(network_list: &str) -> Result> { - // TODO: implement wifi.security - let mut wifis: Vec = Vec::new(); - let mut wifi = Wifi::default(); - for line in network_list.split("\n") { - if let Ok(mac) = extract_value(line, "BSS ", Some("(")) { - wifi.mac = mac; - } else if let Ok(signal) = extract_value(line, "\tsignal: ", Some(" dBm")) { - wifi.signal_level = signal; - } else if let Ok(channel) = extract_value(line, "\tDS Parameter set: channel ", None) { - wifi.channel = channel; - } else if let Ok(ssid) = extract_value(line, "\tSSID: ", None) { - wifi.ssid = ssid; - } - - if !wifi.mac.is_empty() - && !wifi.signal_level.is_empty() - && !wifi.channel.is_empty() - && !wifi.ssid.is_empty() - { - wifis.push(wifi); - wifi = Wifi::default(); - } - } - - Ok(wifis) -} - -fn extract_value(line: &str, pattern_start: &str, pattern_end: Option<&str>) -> Result { - let start = pattern_start.len(); - if start < line.len() && &line[0..start] == pattern_start { - let end = match pattern_end { - Some(end) => line.find(end).ok_or(Error::NoValue)?, - None => line.len(), - }; - Ok(line[start..end].to_string()) - } else { - Err(Error::NoValue) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use std::fs::File; - use std::io::Read; - use std::path::PathBuf; - - #[test] - fn should_parse_iw_dev() { - let expected = "wlp2s0"; - - // FIXME: should be a better way to create test fixtures - let mut path = PathBuf::new(); - path.push("tests"); - path.push("fixtures"); - path.push("iw"); - path.push("iw_dev_01.txt"); - - let file_path = path.as_os_str(); - - let mut file = File::open(&file_path).unwrap(); - - let mut filestr = String::new(); - let _ = file.read_to_string(&mut filestr).unwrap(); - - let result = parse_iw_dev(&filestr).unwrap(); - assert_eq!(expected, result); - } - - #[test] - fn should_parse_iw_dev_scan() { - let mut expected: Vec = Vec::new(); - expected.push(Wifi { - mac: "11:22:33:44:55:66".to_string(), - ssid: "hello".to_string(), - channel: "10".to_string(), - signal_level: "-67.00".to_string(), - security: "".to_string(), - }); - - expected.push(Wifi { - mac: "66:77:88:99:aa:bb".to_string(), - ssid: "hello-world-foo-bar".to_string(), - channel: "8".to_string(), - signal_level: "-89.00".to_string(), - security: "".to_string(), - }); - - // FIXME: should be a better way to create test fixtures - let mut path = PathBuf::new(); - path.push("tests"); - path.push("fixtures"); - path.push("iw"); - path.push("iw_dev_scan_01.txt"); - - let file_path = path.as_os_str(); - - let mut file = File::open(&file_path).unwrap(); - - let mut filestr = String::new(); - let _ = file.read_to_string(&mut filestr).unwrap(); - - let result = parse_iw_dev_scan(&filestr).unwrap(); - assert_eq!(expected[0], result[0]); - assert_eq!(expected[1], result[5]); - } -} diff --git a/libs/wifiscanner/src/sys/macos.rs b/libs/wifiscanner/src/sys/macos.rs deleted file mode 100644 index 7f829f5..0000000 --- a/libs/wifiscanner/src/sys/macos.rs +++ /dev/null @@ -1,178 +0,0 @@ -use crate::{Error, Result, Wifi}; -use os_version::{self, MacOS}; -use regex::Regex; -use tokio::process::Command; -use version_compare::{compare_to, Cmp}; - -/// Returns a list of WiFi hotspots in your area - (OSX/MacOS) uses `airport` -pub(crate) async fn scan() -> Result> { - let mac_version = match os_version::MacOS::detect() { - Ok(version) => version, - Err(_) => MacOS { - version: "0.0.0".to_string(), - }, - }; - - let r = match compare_to(mac_version.version, "14.4", Cmp::Ge) { - Ok(cmp) => { - if cmp { - scan_system_profile().await - } else { - scan_airport().await - } - } - Err(_) => scan_airport().await, - }; - - return r; -} - -async fn scan_system_profile() -> Result> { - let output = Command::new("system_profiler") - .arg("SPAirPortDataType") - .output() - .await - .map_err(|_| Error::CommandNotFound)?; - let data = String::from_utf8_lossy(&output.stdout); - parse_system_profile(&data) -} - -fn parse_system_profile(network_list: &str) -> Result> { - let mut wifis: Vec = Vec::new(); - - let re = Regex::new(r"(?m)^\s+([^\n]+):\n\s+PHY Mode: [^\n]+\n\s+Channel: ([^\n]+)\n\s+.*?\n\s+Security: ([^\n]+)\n\s+Signal / Noise: ([^\n]+)") - .unwrap(); - for w in re.captures_iter(network_list) { - let ssid = w[1].trim().to_string(); - if !ssid.contains("Other Local Wi-Fi Networks") { - let channel = w[2].split('(').next().unwrap().trim().to_string(); - let security = w[3].trim().to_string(); - let signal = w[4].split('/').next().unwrap().trim().to_string(); - - let wifi = Wifi { - ssid, - channel, - signal_level: signal.split(' ').next().unwrap().trim().to_string(), - security, - mac: String::new(), - }; - wifis.push(wifi); - } - } - - Ok(wifis) -} - -async fn scan_airport() -> Result> { - let output = Command::new( - "/System/Library/PrivateFrameworks/Apple80211.\ - framework/Versions/Current/Resources/airport", - ) - .arg("-s") - .output() - .await - .map_err(|_| Error::CommandNotFound)?; - - let data = String::from_utf8_lossy(&output.stdout); - - parse_airport(&data) -} - -fn parse_airport(network_list: &str) -> Result> { - let mut wifis: Vec = Vec::new(); - let mut lines = network_list.lines(); - let headers = match lines.next() { - Some(v) => v, - // return an empty list of WiFi if the network_list is empty - None => return Ok(vec![]), - }; - - let headers_string = String::from(headers); - let col_headers = ["BSSID", "RSSI", "CHANNEL", "HT", "SECURITY"] - .iter() - .map(|header| { - headers_string - .find(header) - .ok_or(Error::HeaderNotFound(header)) - }) - .collect::>>()?; - let col_mac = col_headers[0]; - let col_rrsi = col_headers[1]; - let col_channel = col_headers[2]; - let col_ht = col_headers[3]; - let col_security = col_headers[4]; - - for line in lines { - let ssid = &line[..col_mac].trim(); - let mac = &line[col_mac..col_rrsi].trim(); - let signal_level = &line[col_rrsi..col_channel].trim(); - let channel = &line[col_channel..col_ht].trim(); - let security = &line[col_security..].trim(); - - wifis.push(Wifi { - mac: mac.to_string(), - ssid: ssid.to_string(), - channel: channel.to_string(), - signal_level: signal_level.to_string(), - security: security.to_string(), - }); - } - - Ok(wifis) -} - -#[cfg(test)] -mod tests { - use super::*; - use std::fs::File; - use std::io::Read; - use std::path::PathBuf; - - #[test] - fn should_parse_airport() { - let mut expected: Vec = Vec::new(); - expected.push(Wifi { - mac: "00:35:1a:90:56:03".to_string(), - ssid: "OurTest".to_string(), - channel: "112".to_string(), - signal_level: "-70".to_string(), - security: "WPA2(PSK/AES/AES)".to_string(), - }); - - expected.push(Wifi { - mac: "00:35:1a:90:56:00".to_string(), - ssid: "TEST-Wifi".to_string(), - channel: "1".to_string(), - signal_level: "-67".to_string(), - security: "WPA2(PSK/AES/AES)".to_string(), - }); - - let path = PathBuf::from("tests/fixtures/airport/airport01.txt"); - - let file_path = path.as_os_str(); - - let mut file = File::open(&file_path).unwrap(); - - let mut filestr = String::new(); - let _ = file.read_to_string(&mut filestr).unwrap(); - - let result = parse_airport(&filestr).unwrap(); - let last = result.len() - 1; - assert_eq!(expected[0], result[0]); - assert_eq!(expected[1], result[last]); - } - - #[test] - fn should_not_parse_other() { - let path = PathBuf::from("tests/fixtures/iw/iw_dev_01.txt"); - let file_path = path.as_os_str(); - let mut file = File::open(&file_path).unwrap(); - let mut filestr = String::new(); - file.read_to_string(&mut filestr).unwrap(); - - assert_eq!( - parse_airport(&filestr).err().unwrap(), - Error::HeaderNotFound("BSSID") - ); - } -} diff --git a/libs/wifiscanner/src/sys/windows.rs b/libs/wifiscanner/src/sys/windows.rs deleted file mode 100644 index 6a70f21..0000000 --- a/libs/wifiscanner/src/sys/windows.rs +++ /dev/null @@ -1,119 +0,0 @@ -use crate::{Error, Result, Wifi}; -use regex::Regex; -use std::vec::Vec; -use tokio::process::Command; - -/// Returns a list of WiFi hotspots in your area - (Windows) uses `netsh` -pub async fn scan() -> Result> { - let output = Command::new("netsh.exe") - .args(&["wlan", "show", "networks", "mode=Bssid"]) - .output() - .await - .map_err(|_| Error::CommandNotFound)?; - let data = String::from_utf8_lossy(&output.stdout); - parse_netsh(&data) -} - -fn parse_netsh(network_list: &str) -> Result> { - let mut wifis = Vec::new(); - - // Regex for matching SSID and MAC (BSSID) - let ssid_regex = Regex::new(r"SSID\s\d+\s:\s(.+)").map_err(|_| Error::SyntaxRegexError)?; - let mac_regex = Regex::new(r"BSSID\s\d+\s+:\s([a-fA-F0-9:]{17})").map_err(|_| Error::SyntaxRegexError)?; - let signal_regex = Regex::new(r"Signal\s+:\s(\d+)%").map_err(|_| Error::SyntaxRegexError)?; - let channel_regex = Regex::new(r"Channel\s+:\s(\d+)").map_err(|_| Error::SyntaxRegexError)?; - let security_regex = Regex::new(r"Authentication\s+:\s(.+)").map_err(|_| Error::SyntaxRegexError)?; - - // Split the output by SSID entries - for block in network_list.split("\r\n\r\n") { - let mut wifi_macs = Vec::new(); - let mut wifi_ssid = String::new(); - let mut wifi_channels = Vec::new(); - let mut wifi_rssi = Vec::new(); - let mut wifi_security = String::new(); - - // Match each line with appropriate regex - for line in block.lines() { - if let Some(captures) = ssid_regex.captures(line) { - wifi_ssid = captures[1].trim().to_string(); - } - if let Some(captures) = mac_regex.captures(line) { - wifi_macs.push(captures[1].trim().to_string()); - } - if let Some(captures) = signal_regex.captures(line) { - let signal_percent = captures[1].trim().parse::().unwrap_or(0); - let rssi = (signal_percent as f32 / 2.0 - 100.0) as i32; // Convert signal % to dBm - wifi_rssi.push(rssi); - } - if let Some(captures) = channel_regex.captures(line) { - wifi_channels.push(captures[1].trim().to_string()); - } - if let Some(captures) = security_regex.captures(line) { - wifi_security = captures[1].trim().to_string(); - } - } - - // Create Wifi struct for each MAC (BSSID) found - for (mac, channel, rssi) in izip!(wifi_macs, wifi_channels, wifi_rssi) { - wifis.push(Wifi { - mac, - ssid: wifi_ssid.clone(), - channel, - signal_level: rssi.to_string(), - security: wifi_security.clone(), - }); - } - } - - Ok(wifis) -} - -#[cfg(test)] -mod tests { - use super::*; - #[test] - fn should_parse_netsh() { - use std::fs; - - // Note: formula for % to dBm is (% / 100) - 100 - let expected = vec![ - Wifi { - mac: "ab:cd:ef:01:23:45".to_string(), - ssid: "Vodafone Hotspot".to_string(), - channel: "6".to_string(), - signal_level: "-92".to_string(), - security: "Open".to_string(), - }, - Wifi { - mac: "ab:cd:ef:01:23:45".to_string(), - ssid: "Vodafone Hotspot".to_string(), - channel: "6".to_string(), - signal_level: "-73".to_string(), - security: "Open".to_string(), - }, - Wifi { - mac: "ab:cd:ef:01:23:45".to_string(), - ssid: "EdaBox".to_string(), - channel: "11".to_string(), - signal_level: "-82".to_string(), - security: "WPA2-Personal".to_string(), - }, - Wifi { - mac: "ab:cd:ef:01:23:45".to_string(), - ssid: "FRITZ!Box 2345 Cable".to_string(), - channel: "1".to_string(), - signal_level: "-50".to_string(), - security: "WPA2-Personal".to_string(), - }, - ]; - - // Load test fixtures - let fixture = fs::read_to_string("tests/fixtures/netsh/netsh01_windows81.txt").unwrap(); - - let result = parse_netsh(&fixture).unwrap(); - assert_eq!(expected[0], result[0]); - assert_eq!(expected[1], result[1]); - assert_eq!(expected[2], result[2]); - assert_eq!(expected[3], result[3]); - } -} diff --git a/libs/wifiscanner/tests/fixtures/airport/airport01.txt b/libs/wifiscanner/tests/fixtures/airport/airport01.txt deleted file mode 100644 index 9fabbe1..0000000 --- a/libs/wifiscanner/tests/fixtures/airport/airport01.txt +++ /dev/null @@ -1,37 +0,0 @@ - SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group) - OurTest 00:35:1a:90:56:03 -70 112 Y CH WPA2(PSK/AES/AES) - OurDev 00:35:1a:90:56:04 -70 112 Y CH WPA2(PSK/AES/AES) - PDANet1 00:35:1a:90:56:09 -70 112 Y CH WPA2(PSK/AES/AES) - TEST-Wifi 00:35:1a:90:56:0f -70 112 Y CH WPA2(PSK/AES/AES) - ExoNet1 00:35:1a:90:56:0a -70 112 Y CH WPA2(PSK/AES/AES) - OurTest 00:35:1a:6f:0f:43 -78 40 Y CH WPA2(PSK/AES/AES) - OurDev 00:35:1a:6f:0f:44 -78 40 Y CH WPA2(PSK/AES/AES) - ExoNet1 00:35:1a:6f:0f:4a -77 40 Y CH WPA2(PSK/AES/AES) - PDANet1 00:35:1a:6f:0f:49 -78 40 Y CH WPA2(PSK/AES/AES) - TEST-Wifi 00:35:1a:6f:0f:4f -78 40 Y CH WPA2(PSK/AES/AES) - ExoNet1 00:f2:8b:8f:58:7a -75 36 Y CH WPA2(PSK/AES/AES) - OurTest 00:f2:8b:8f:58:73 -75 36 Y CH WPA2(PSK/AES/AES) - OurDev 00:f2:8b:8f:58:74 -75 36 Y CH WPA2(PSK/AES/AES) - PDANet1 00:f2:8b:8f:58:79 -75 36 Y CH WPA2(PSK/AES/AES) - TEST-Wifi 00:f2:8b:8f:58:7f -75 36 Y CH WPA2(PSK/AES/AES) - OurDev 00:f2:8b:8f:58:7b -78 11 Y CH WPA2(PSK/AES/AES) - ExoNet1 00:35:1a:5b:45:b5 -78 11 Y CH WPA2(PSK/AES/AES) - OurTest 00:35:1a:5b:45:bc -79 11 Y CH WPA2(PSK/AES/AES) - OurDev 00:35:1a:5b:45:bb -78 11 Y CH WPA2(PSK/AES/AES) - PDANet1 00:35:1a:5b:45:b6 -78 11 Y CH WPA2(PSK/AES/AES) - TEST-Wifi 00:35:1a:5b:45:b0 -78 11 Y CH WPA2(PSK/AES/AES) - ExoNet1 00:f2:8b:8f:58:75 -77 11 Y CH WPA2(PSK/AES/AES) - OurTest 00:f2:8b:8f:58:7c -78 11 Y CH WPA2(PSK/AES/AES) - PDANet1 00:f2:8b:8f:58:76 -78 11 Y CH WPA2(PSK/AES/AES) - TEST-Wifi 00:f2:8b:8f:58:70 -78 11 Y CH WPA2(PSK/AES/AES) - TEST Training 10:bd:18:ab:4d:8f -71 6 N -- WPA(PSK/AES,TKIP/TKIP) - ExoNet1 00:35:1a:6f:0f:45 -77 6 Y CH WPA2(PSK/AES/AES) - OurTest 00:35:1a:6f:0f:4c -77 6 Y CH WPA2(PSK/AES/AES) - OurDev 00:35:1a:6f:0f:4b -77 6 Y CH WPA2(PSK/AES/AES) - PDANet1 00:35:1a:6f:0f:46 -77 6 Y CH WPA2(PSK/AES/AES) - TEST-Wifi 00:35:1a:6f:0f:40 -77 6 Y CH WPA2(PSK/AES/AES) - ExoNet1 00:35:1a:90:56:05 -67 1 Y CH WPA2(PSK/AES/AES) - OurTest 00:35:1a:90:56:0c -67 1 Y CH WPA2(PSK/AES/AES) - OurDev 00:35:1a:90:56:0b -67 1 Y CH WPA2(PSK/AES/AES) - PDANet1 00:35:1a:90:56:06 -67 1 Y CH WPA2(PSK/AES/AES) - TEST-Wifi 00:35:1a:90:56:00 -67 1 Y CH WPA2(PSK/AES/AES) diff --git a/libs/wifiscanner/tests/fixtures/iw/iw_dev_01.txt b/libs/wifiscanner/tests/fixtures/iw/iw_dev_01.txt deleted file mode 100644 index 52533b1..0000000 --- a/libs/wifiscanner/tests/fixtures/iw/iw_dev_01.txt +++ /dev/null @@ -1,9 +0,0 @@ -phy#0 - Interface wlp2s0 - ifindex 4 - wdev 0x1 - addr 11:22:33:44:55:66 - ssid hello - type managed - channel 1 (2412 MHz), width: 20 MHz, center1: 2412 MHz - txpower 20.00 dBm diff --git a/libs/wifiscanner/tests/fixtures/iw/iw_dev_scan_01.txt b/libs/wifiscanner/tests/fixtures/iw/iw_dev_scan_01.txt deleted file mode 100644 index 051cebd..0000000 --- a/libs/wifiscanner/tests/fixtures/iw/iw_dev_scan_01.txt +++ /dev/null @@ -1,354 +0,0 @@ -BSS 11:22:33:44:55:66(on wlp2s0) - TSF: 7031320135454 usec (81d, 09:08:40) - freq: 2457 - beacon interval: 100 TUs - capability: ESS Privacy ShortSlotTime APSD (0x0c11) - signal: -67.00 dBm - last seen: 5939 ms ago - Information elements from Probe Response frame: - SSID: hello - Supported rates: 1.0* 2.0* 5.5* 11.0* 9.0 18.0 36.0 54.0 - DS Parameter set: channel 10 - ERP: Barker_Preamble_Mode - Extended supported rates: 6.0 12.0 24.0 48.0 - HT capabilities: - Capabilities: 0x2c - HT20 - SM Power Save disabled - RX HT20 SGI - No RX STBC - Max AMSDU length: 3839 bytes - No DSSS/CCK HT40 - Maximum RX AMPDU length 65535 bytes (exponent: 0x003) - Minimum RX AMPDU time spacing: 4 usec (0x05) - HT RX MCS rate indexes supported: 0-15 - HT TX MCS rate indexes are undefined - HT operation: - * primary channel: 10 - * secondary channel offset: no secondary - * STA channel width: 20 MHz - * RIFS: 0 - * HT protection: no - * non-GF present: 1 - * OBSS non-GF present: 0 - * dual beacon: 0 - * dual CTS protection: 0 - * STBC beacon: 0 - * L-SIG TXOP Prot: 0 - * PCO active: 0 - * PCO phase: 0 - WPA: * Version: 1 - * Group cipher: TKIP - * Pairwise ciphers: TKIP CCMP - * Authentication suites: PSK - RSN: * Version: 1 - * Group cipher: TKIP - * Pairwise ciphers: TKIP CCMP - * Authentication suites: PSK - * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000) - Extended capabilities: - BSS Load: - * station count: 2 - * channel utilisation: 24/255 - * available admission capacity: 31250 [*32us] - WMM: * Parameter version 1 - * u-APSD - * BE: CW 15-1023, AIFSN 3 - * BK: CW 15-1023, AIFSN 7 - * VI: CW 7-15, AIFSN 2, TXOP 3008 usec - * VO: CW 3-7, AIFSN 2, TXOP 1504 usec - Country: CN Environment: Indoor/Outdoor - Channels [1 - 13] @ 16 dBm - WPS: * Version: 1.0 - * Wi-Fi Protected Setup State: 2 (Configured) - * Response Type: 3 (AP) - * UUID: 28802880-2880-1880-a880-34ce004abe68 - * Manufacturer: xiaomi - * Model: R3L - * Model Number: 0002 - * Serial Number: 12345678 - * Primary Device Type: 6-0050f204-1 - * Device name: XiaoMiRouter - * Config methods: Label, Display, Keypad - * RF Bands: 0x1 - * Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20 -BSS 22:33:44:55:66:77(on wlp2s0) -- associated - TSF: 1108770076259 usec (12d, 19:59:30) - freq: 2412 - beacon interval: 100 TUs - capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431) - signal: -42.00 dBm - last seen: 3725 ms ago - Information elements from Probe Response frame: - SSID: world - Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 - DS Parameter set: channel 1 - ERP: - Extended supported rates: 24.0 36.0 48.0 54.0 - RSN: * Version: 1 - * Group cipher: CCMP - * Pairwise ciphers: CCMP - * Authentication suites: PSK - * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c) - HT capabilities: - Capabilities: 0x11ec - HT20 - SM Power Save disabled - RX HT20 SGI - RX HT40 SGI - TX STBC - RX STBC 1-stream - Max AMSDU length: 3839 bytes - DSSS/CCK HT40 - Maximum RX AMPDU length 65535 bytes (exponent: 0x003) - Minimum RX AMPDU time spacing: 8 usec (0x06) - HT TX/RX MCS rate indexes supported: 0-15 - HT operation: - * primary channel: 1 - * secondary channel offset: no secondary - * STA channel width: 20 MHz - * RIFS: 0 - * HT protection: no - * non-GF present: 1 - * OBSS non-GF present: 0 - * dual beacon: 0 - * dual CTS protection: 0 - * STBC beacon: 0 - * L-SIG TXOP Prot: 0 - * PCO active: 0 - * PCO phase: 0 - Extended capabilities: 6 - WMM: * Parameter version 1 - * BE: CW 15-1023, AIFSN 3 - * BK: CW 15-1023, AIFSN 7 - * VI: CW 7-15, AIFSN 2, TXOP 3008 usec - * VO: CW 3-7, AIFSN 2, TXOP 1504 usec -BSS 33:44:55:66:77:88(on wlp2s0) - TSF: 396666266749 usec (4d, 14:11:06) - freq: 2417 - beacon interval: 100 TUs - capability: ESS Privacy ShortSlotTime (0x0411) - signal: -75.00 dBm - last seen: 6956 ms ago - Information elements from Probe Response frame: - SSID: foo - Supported rates: 1.0* 2.0* 5.5* 11.0* 9.0 18.0 36.0 54.0 - DS Parameter set: channel 2 - Extended supported rates: 6.0 12.0 24.0 48.0 - TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x2 - RSN: * Version: 1 - * Group cipher: CCMP - * Pairwise ciphers: CCMP - * Authentication suites: PSK - * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000) - WPS: * Version: 1.0 - * Wi-Fi Protected Setup State: 2 (Configured) - * UUID: 38833092-3092-1883-9c77-b0be761c94c4 - * RF Bands: 0x1 - * Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20 - ERP: Barker_Preamble_Mode - HT capabilities: - Capabilities: 0x106e - HT20/HT40 - SM Power Save disabled - RX HT20 SGI - RX HT40 SGI - No RX STBC - Max AMSDU length: 3839 bytes - DSSS/CCK HT40 - Maximum RX AMPDU length 65535 bytes (exponent: 0x003) - Minimum RX AMPDU time spacing: 4 usec (0x05) - HT RX MCS rate indexes supported: 0-15, 32 - HT TX MCS rate indexes are undefined - HT operation: - * primary channel: 2 - * secondary channel offset: above - * STA channel width: any - * RIFS: 0 - * HT protection: no - * non-GF present: 0 - * OBSS non-GF present: 0 - * dual beacon: 0 - * dual CTS protection: 0 - * STBC beacon: 0 - * L-SIG TXOP Prot: 0 - * PCO active: 0 - * PCO phase: 0 - Overlapping BSS scan params: - * passive dwell: 20 TUs - * active dwell: 10 TUs - * channel width trigger scan interval: 300 s - * scan passive total per channel: 200 TUs - * scan active total per channel: 20 TUs - * BSS width channel transition delay factor: 5 - * OBSS Scan Activity Threshold: 0.25 % - WMM: * Parameter version 1 - * BE: CW 15-1023, AIFSN 3 - * BK: CW 15-1023, AIFSN 7 - * VI: CW 7-15, AIFSN 2, TXOP 3008 usec - * VO: CW 3-7, AIFSN 2, TXOP 1504 usec - BSS Load: - * station count: 0 - * channel utilisation: 0/255 - * available admission capacity: 31250 [*32us] -BSS 44:55:66:77:88:99(on wlp2s0) - TSF: 108728525152 usec (1d, 06:12:08) - freq: 2457 - beacon interval: 100 TUs - capability: ESS Privacy ShortSlotTime (0x0411) - signal: -73.00 dBm - last seen: 5948 ms ago - Information elements from Probe Response frame: - SSID: bar - Supported rates: 1.0* 2.0* 5.5* 11.0* 9.0 18.0 36.0 54.0 - DS Parameter set: channel 10 - Extended supported rates: 6.0 12.0 24.0 48.0 - Country: GB Environment: Indoor/Outdoor - Channels [1 - 13] @ 20 dBm - TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0 - ERP: Barker_Preamble_Mode - WPA: * Version: 1 - * Group cipher: TKIP - * Pairwise ciphers: TKIP - * Authentication suites: PSK - WMM: * Parameter version 1 - * BE: CW 15-1023, AIFSN 3 - * BK: CW 15-1023, AIFSN 7 - * VI: CW 7-15, AIFSN 2, TXOP 3008 usec - * VO: CW 3-7, AIFSN 2, TXOP 1504 usec - BSS Load: - * station count: 0 - * channel utilisation: 23/255 - * available admission capacity: 31250 [*32us] -BSS 55:66:77:88:99:aa(on wlp2s0) - TSF: 761408955949 usec (8d, 19:30:08) - freq: 2417 - beacon interval: 100 TUs - capability: ESS Privacy ShortSlotTime (0x0411) - signal: -84.00 dBm - last seen: 6838 ms ago - SSID: one-more - Supported rates: 1.0* 2.0* 5.5* 11.0* 9.0 18.0 36.0 54.0 - DS Parameter set: channel 2 - ERP: Barker_Preamble_Mode - Extended supported rates: 6.0 12.0 24.0 48.0 - HT capabilities: - Capabilities: 0x106e - HT20/HT40 - SM Power Save disabled - RX HT20 SGI - RX HT40 SGI - No RX STBC - Max AMSDU length: 3839 bytes - DSSS/CCK HT40 - Maximum RX AMPDU length 65535 bytes (exponent: 0x003) - Minimum RX AMPDU time spacing: 4 usec (0x05) - HT RX MCS rate indexes supported: 0-15, 32 - HT TX MCS rate indexes are undefined - HT operation: - * primary channel: 2 - * secondary channel offset: above - * STA channel width: any - * RIFS: 0 - * HT protection: 20 MHz - * non-GF present: 1 - * OBSS non-GF present: 0 - * dual beacon: 0 - * dual CTS protection: 0 - * STBC beacon: 0 - * L-SIG TXOP Prot: 0 - * PCO active: 0 - * PCO phase: 0 - RSN: * Version: 1 - * Group cipher: CCMP - * Pairwise ciphers: CCMP - * Authentication suites: PSK - * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000) - Extended capabilities: - BSS Load: - * station count: 4 - * channel utilisation: 0/255 - * available admission capacity: 31250 [*32us] - WMM: * Parameter version 1 - * BE: CW 15-1023, AIFSN 3 - * BK: CW 15-1023, AIFSN 7 - * VI: CW 7-15, AIFSN 2, TXOP 3008 usec - * VO: CW 3-7, AIFSN 2, TXOP 1504 usec - Overlapping BSS scan params: - * passive dwell: 20 TUs - * active dwell: 10 TUs - * channel width trigger scan interval: 300 s - * scan passive total per channel: 200 TUs - * scan active total per channel: 20 TUs - * BSS width channel transition delay factor: 5 - * OBSS Scan Activity Threshold: 0.25 % - WPS: * Version: 1.0 - * Wi-Fi Protected Setup State: 2 (Configured) - * Response Type: 3 (AP) - * UUID: 38833092-3092-1883-9c77-b0be76ccbfc4 - * Manufacturer: TP-Link - * Model: TL-WR840N - * Model Number: 6.0 - * Serial Number: 1.0 - * Primary Device Type: 6-0050f204-1 - * Device name: Wireless N Router TL-WR840N - * Config methods: Label, Display, Keypad - * RF Bands: 0x1 - * Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20 -BSS 66:77:88:99:aa:bb(on wlp2s0) - TSF: 2181790617990 usec (25d, 06:03:10) - freq: 2447 - beacon interval: 100 TUs - capability: ESS Privacy ShortSlotTime (0x0411) - signal: -89.00 dBm - last seen: 6248 ms ago - Information elements from Probe Response frame: - SSID: hello-world-foo-bar - Supported rates: 1.0* 2.0* 5.5* 6.0* 9.0 11.0* 12.0* 18.0 24.0* 36.0 48.0 54.0 - DS Parameter set: channel 8 - TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0 - ERP: - ERP D4.0: - RSN: * Version: 1 - * Group cipher: TKIP - * Pairwise ciphers: CCMP TKIP - * Authentication suites: PSK - * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c) - HT capabilities: - Capabilities: 0x187e - HT20/HT40 - SM Power Save disabled - RX Greenfield - RX HT20 SGI - RX HT40 SGI - No RX STBC - Max AMSDU length: 7935 bytes - DSSS/CCK HT40 - Maximum RX AMPDU length 65535 bytes (exponent: 0x003) - Minimum RX AMPDU time spacing: 8 usec (0x06) - HT RX MCS rate indexes supported: 0-15, 32 - HT TX MCS rate indexes are undefined - HT operation: - * primary channel: 8 - * secondary channel offset: below - * STA channel width: any - * RIFS: 1 - * HT protection: no - * non-GF present: 0 - * OBSS non-GF present: 0 - * dual beacon: 0 - * dual CTS protection: 0 - * STBC beacon: 0 - * L-SIG TXOP Prot: 0 - * PCO active: 0 - * PCO phase: 0 - WPA: * Version: 1 - * Group cipher: TKIP - * Pairwise ciphers: CCMP TKIP - * Authentication suites: PSK - * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c) - WMM: * Parameter version 1 - * BE: CW 15-63, AIFSN 3 - * BK: CW 15-1023, AIFSN 7 - * VI: CW 7-15, AIFSN 2, TXOP 3008 usec - * VO: CW 3-7, AIFSN 2, TXOP 1504 usec diff --git a/libs/wifiscanner/tests/fixtures/netsh/netsh01_windows81.txt b/libs/wifiscanner/tests/fixtures/netsh/netsh01_windows81.txt deleted file mode 100644 index 4b725ff..0000000 --- a/libs/wifiscanner/tests/fixtures/netsh/netsh01_windows81.txt +++ /dev/null @@ -1,45 +0,0 @@ - -Interface name : Wi-Fi -There are 2 networks currently visible. - -SSID 1 : Vodafone Hotspot - Network type : Infrastructure - Authentication : Open - Encryption : None - BSSID 1 : ab:cd:ef:01:23:45 - Signal : 16% - Radio type : 802.11n - Channel : 6 - Basic rates (Mbps) : 6.5 16 19.5 117 - Other rates (Mbps) : 18 19.5 24 36 39 48 54 156 - BSSID 2 : ab:cd:ef:01:23:45 - Signal : 55% - Radio type : 802.11n - Channel : 6 - Basic rates (Mbps) : 6.5 16 19.5 117 - Other rates (Mbps) : 18 19.5 24 36 39 48 54 156 - -SSID 2 : EdaBox - Network type : Infrastructure - Authentication : WPA2-Personal - Encryption : CCMP - BSSID 1 : ab:cd:ef:01:23:45 - Signal : 37% - Radio type : 802.11n - Channel : 11 - Basic rates (Mbps) : 6.5 16 19.5 24 39 117 156 - Other rates (Mbps) : 18 19.5 36 48 54 - -Interface name : Wi-Fi 2 -There are 1 networks currently visible. - -SSID 1 : FRITZ!Box 2345 Cable - Network type : Infrastructure - Authentication : WPA2-Personal - Encryption : CCMP - BSSID 1 : ab:cd:ef:01:23:45 - Signal : 100% - Radio type : 802.11n - Channel : 1 - Basic rates (Mbps) : 1 2 5.5 6 11 12 24 - Other rates (Mbps) : 9 18 36 48 54