GithubHelp home page GithubHelp logo

jtomschroeder / ether Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 1.0 58 KB

Library for parsing and manipulating network data, packet captures.

License: MIT License

Shell 0.67% Rust 99.33%
networking rust

ether's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

shengnian

ether's Issues

expected u8, found i8

I'm having trouble compiling this:

   Compiling ether v0.1.4
error[E0308]: mismatched types
   --> /some/path/.cargo/registry/src/github.com-1ecc6299db9ec823/ether-0.1.4/src/tap/tap.rs:106:37
    |
106 |                 iface.ifr_name[i] = c as i8;
    |                                     ^^^^^^^ expected u8, found i8

error: aborting due to previous error(s)

error: Could not compile `ether`.

This is rust 1.19, could you have a look into this?

/dev/bpf* doesn't exist, Error success

I ran into another issue:

let mut tap = tap::Tap::new("eth0").unwrap();

is failing with this error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 0, message: "Success" } }', src/libcore/result.rs:860

This is the code of open():

pub fn new(interface: &str) -> io::Result<Self> {
    fn open() -> io::Result<File> {
        // On macOS: bpf exposed as /dev/bpf###
        for entry in glob("/dev/bpf*").expect("Failed to read glob pattern") {
            if let Some(file) = entry
                   .ok()
                   .and_then(|path| {
                                 OpenOptions::new()
                                     .read(true)
                                     .write(true)
                                     .open(&path)
                                     .ok()
                             }) {
                return Ok(file);
            }
        }

        Err(io::Error::last_os_error())
    }

    let file = try!(open()); // this returns Err(io::Error::last_os_error())
    let config = Config::default();
    // [...]

It appears linux doesn't support berkley packet filter so it doesn't have /dev/bpf*, falls through the loop and returns last_os_error() which was unrelated and successful. :)

You might want to look into the pcap crate, I managed to dump traffic successfully using it, but I didn't feel like decoding ethernet, ip and tcp manually.

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.