Skip to content

Commit cb01bf9

Browse files
committed
init
0 parents  commit cb01bf9

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target

Cargo.lock

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[package]
2+
name = "impact"
3+
version = "0.1.0"
4+
authors = ["Takafumi Hirata <[email protected]>"]

src/main.rs

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#![feature(collections)]
2+
#![feature(convert)]
3+
use std::net::{UdpSocket, SocketAddrV4, Ipv4Addr};
4+
5+
fn main() {
6+
let socket = UdpSocket::bind("192.168.1.1:10099").unwrap();
7+
let mut buf = [0; 1024];
8+
let ip = Ipv4Addr::new(192, 168, 1, 1);
9+
let port = 53;
10+
let addr = SocketAddrV4::new(ip, port);
11+
12+
let ident = [0u8, 0u8];
13+
let flag = [0u8, 0u8];
14+
let q_num = [0u8, 1u8];
15+
let a_num = [0u8, 0u8];
16+
let authorize_pr = [0u8, 0u8];
17+
let additional_pr = [0u8, 0u8];
18+
let question = "8google3com0";
19+
let q_type = [0u8, 1u8];
20+
let q_class = [0u8, 1u8];
21+
22+
let mut vec = Vec::new();
23+
vec.push_all(&ident);
24+
vec.push_all(&flag);
25+
vec.push_all(&q_num);
26+
vec.push_all(&a_num);
27+
vec.push_all(&authorize_pr);
28+
vec.push_all(&additional_pr);
29+
vec.push_all(question.as_bytes());
30+
vec.push_all(&q_type);
31+
vec.push_all(&q_class);
32+
33+
let size = socket.send_to(vec.as_slice(), addr);
34+
println!("send size: {}", size.unwrap());
35+
36+
let res = socket.recv_from(&mut buf);
37+
let (amt, src) = res.unwrap();
38+
39+
}

0 commit comments

Comments
 (0)