File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ import text;
2
+ import ipv4;
3
+ import dns;
4
+ import eth;
5
+ import std;
6
+
7
+ let client = 192.168.238.112;
8
+ let server = 142.250.207.36;
9
+ let google = 8.8.8.8;
10
+
11
+ let dns = ipv4::udp::flow(
12
+ client/13749,
13
+ google/54,
14
+ );
15
+
16
+ let frag = ipv4::frag(
17
+ client,
18
+ google,
19
+ id: 0x2345,
20
+ proto: ipv4::proto::UDP,
21
+ dns.client_raw_dgram(
22
+ dns::hdr(
23
+ id: 0x1234,
24
+ flags: dns::flags(
25
+ opcode: dns::opcode::QUERY,
26
+ rd: 1,
27
+ ),
28
+ qdcount: 1,
29
+ ),
30
+ dns::question(
31
+ qname: dns::name("www", "google", "com"),
32
+ qtype: dns::qtype::A,
33
+ qclass: dns::class::IN,
34
+ )
35
+ )
36
+ );
37
+
38
+ eth::frame(
39
+ eth::from_ip(client),
40
+ eth::from_ip(google),
41
+ ethertype: eth::ethertype::VLAN,
42
+ std::be16(0),
43
+ std::be16(eth::ethertype::IPV4),
44
+ frag.fragment(0, 1, raw: true),
45
+ );
46
+ eth::frame(
47
+ eth::from_ip(client),
48
+ eth::from_ip(google),
49
+ ethertype: eth::ethertype::VLAN,
50
+ std::be16(0),
51
+ std::be16(eth::ethertype::IPV4),
52
+ frag.tail(1, raw: true),
53
+ );
You can’t perform that action at this time.
0 commit comments