Coder Social home page Coder Social logo

wifi-rs's People

Contributors

israel-duff avatar owolabioromidayo avatar phoenix-chen avatar toksdotdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wifi-rs's Issues

build failed on Win 10

Hi there!
I was looking for a multi-platform wifi crate and stumbled upon your work... sadly I am unable to build it due to the following Error:

Compiling wifi-rs v0.2.0
error[E0277]: the size for values of type str cannot be known at compilation time
--> X\Y\Z.cargo\registry\src\github.com-1ecc6299db9ec823\wifi-rs-0.2.0\src\connectivity\providers\windows.rs:48:18
|
48 | &format!("name={}", *self.connection.unwrap().ssid),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait std::marker::Sized is not implemented for str
= note: to learn more, visit https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

sorry for the Inconvenience and thanks for your help! ;)

Error on build (windows)

$ cargo run
    Blocking waiting for file lock on package cache
    Updating git repository `https://github.com/TNkemdilim/wifi-rs`
error: failed to load source for a dependency on `wifi-rs`

Caused by:
  Unable to update https://github.com/TNkemdilim/wifi-rs

Caused by:
  Could not find `Cargo.toml` in `C:\Users\robin\.cargo\git\checkouts\wifi-rs-f335658bb5041c43\wifi-rs`

robin@ROBIN-PC MINGW64 /f/phishing-wifi (master)
$ cargo run
 --> C:\Users\robin\.cargo\registry\src\github.com-1ecc6299db9ec823\wifi-rs-0.1.0\src\lib.rs:3:5
  |                                                                                 c\lib.rs:3:5
3 | mod handler;
  |     ^^^^^^^
  |
  = help: name the file either handler.rs or handler\mod.rs inside the directory "C:\Users\robin\.cargo\registry\src\github.com-1ecc6299db9ec823\wifi-rs-0.1.0\src"     \Users\robin\.cargo\registry\src\github.com-1ecc6299db9ec823\wifi-rs-0.1.0\src"

error: aborting due to previous error

For more information about this error, try `rustc --explain E0583`.
error: could not compile `wifi-rs`.

To learn more, run the command again with --verbose.```

Module does not build with rustc 1.49

When cargo tries to build wifi-rs, it fails with following error:

   Compiling wifi-rs v0.2.1
error[E0599]: no variant or associated item named `CreationFailed` found for enum `WifiHotspotError` in the current scope
  --> /home/jalon/.cargo/registry/src/github.com-1ecc6299db9ec823/wifi-rs-0.2.1/src/hotspot/providers/linux.rs:77:47
   |
77 |             .map_err(|_err| WifiHotspotError::CreationFailed)?;
   |                                               ^^^^^^^^^^^^^^ variant or associated item not found in `WifiHotspotError`
   | 
  ::: /home/jalon/.cargo/registry/src/github.com-1ecc6299db9ec823/wifi-rs-0.2.1/src/hotspot/mod.rs:9:1
   |
9  | pub enum WifiHotspotError {
   | ------------------------- variant or associated item `CreationFailed` not found here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: could not compile `wifi-rs`

To learn more, run the command again with --verbose.

Host is Archlinux with up to date stable Rust compiler version 1.49 (instaled via rustc).

This error happens with versions 0.2.0 and 0.2.1. Version 0.1.0 builds nicely (but unfortunately seems not to work, running the example program I get a "Invalid password" message even though SSID and password are correct).

'ifname' not understood

Hello, I'm trying to create a hotspot on a Raspberry Pi 3b+ running Raspbian 11 (bullseye), the hotspot wouldn't create (returning Ok(false)) and by outputting to console what the running command returns, we see:
https://github.com/tnkemdilim/wifi-rs/blob/3cbe13ef3b9a0f84b03b08abef1b3d6b857cbbcf/src/hotspot/providers/linux.rs#L83-L86 (referenced code)

Error: argument 'ifname' not understood. Try passing --help instead.

(output by printing)
... and I'm not sure whats going here, may this library reference an older version of nmcli?

lib retruns "invalid password" irrespective of what i do

Hello there!

I was hoping to check the stability of this package, the application returns "Invalid password" irrespective of what I do, and this includes running the examples.

My environment

Rust version: rustc 1.77.1
OS type: macOS ( Ventura Version 13.6.4)

The Implementation

use wifi_rs::{prelude::*, WiFi};

fn main() -> Result<(), WifiConnectionError> {
    let config = Some(Config {
        interface: Some("wlo1"),
    });

    let mut wifi = WiFi::new(config);

    match wifi.connect("snowflakes", "@opeolluwa") {
        Ok(result) => println!(
            "{}",
            if result == true {
                "Connection Successful."
            } else {
                "Invalid password."
            }
        ),
        Err(err) => println!("The following error occurred: {:?}", err),
    }

    Ok(())
}

Use of undeclared type 'HotspotConfig', 'HotspotBand', 'Channel'

I tried your example on creating WiFi hotspot and it wasn't able to find 'HotspotConfig', and enums 'HotspotBand' and 'Channel'.
I am using the version "0.2.2" release.

use std::io;
use wifi_rs::{prelude::*, WiFi};

fn main() -> Result<(), io::Error> {
    let config = Some(Config {
        interface: Some("wlo1"),
    });

    let mut wifi = WiFi::new(config);
    let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));

    wifi.create_hotspot("test-hotspot", "password", Some(&config));

    Ok(())
}

error[E0433]: failed to resolve: use of undeclared type HotspotConfig
--> src/main.rs:10:18
|
10 | let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
| ^^^^^^^^^^^^^ use of undeclared type HotspotConfig

error[E0433]: failed to resolve: use of undeclared type HotspotBand
--> src/main.rs:10:42
|
10 | let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
| ^^^^^^^^^^^ use of undeclared type HotspotBand

error[E0433]: failed to resolve: use of undeclared type Channel
--> src/main.rs:10:65
|
10 | let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
| ^^^^^^^ use of undeclared type Channel

error: aborting due to 3 previous errors

Long network interface name causing failure to connect

The network interface name was wlx9cefd5f8f9c0 but when renamed in Ubuntu to wlan0 the connection no longer failed.

Below is a code snippet:

        let config = Some(Config {
            interface: Some(self.net_iface.as_str()),
        });

        ctx.wifi_ctx = WiFi::new(config);
        match ctx.wifi_ctx.connect(ssid.as_str(), psk.as_str()) {

Bug: need support for other lang

Failed to check if the command is success when system is set to use other languages.
For example, in Linux we use this code to disconnect WiFi:

/// Attempts to disconnect from a wireless network currently connected to.
    fn disconnect(&self) -> Result<bool, WifiConnectionError> {
        let output = Command::new("nmcli")
            .args(&["d", "disconnect", "ifname", &self.interface])
            .output()
            .map_err(|err| WifiConnectionError::FailedToDisconnect(format!("{}", err)))?;

        Ok(String::from_utf8_lossy(&output.stdout)
            .as_ref()
            .contains("disconnect"))
    }

But when locale is set to other language, this command's output is look like this:
成功断开设备 "wlan0"(For LANG=zh_CN.UTF-8)
As result, this command always returns Ok(false) even if it did disconnect the WiFi.

WiFi-rs creates a new duplicate connection file every time it connects to an access point

I use Ubuntu's default NetworkManager, and every time I connect to WiFi using WiFi-rs, it creates and saves the same network as a new WiFi access point, leaving lots of duplicates:

$ ll /etc/NetworkManager/system-connections/
total 72
drwxr-xr-x 2 root root 4096 Oct  7 14:52 ./
drwxr-xr-x 7 root root 4096 May 15  2019 ../
-rw------- 1 root root  436 Oct  1 16:59 ATT12345H
-rw------- 1 root root  350 Oct  7 14:38 ATT12345H 12
-rw------- 1 root root  337 Oct  7 14:04 ATT12345H 2
-rw------- 1 root root  337 Oct  7 14:04 ATT12345H 3
⋮

Is it possible to have it use a preexisting saved connection? That would solve this problem along with allowing use of connections saved outside of WiFi-rs, which also have more settings than just SSID and password.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.