mirror of
https://git.robbyzambito.me/zaprus/
synced 2026-02-04 03:34:48 +00:00
Set don't fragment, and use random id
This commit is contained in:
@@ -120,7 +120,7 @@ pub fn main(init: std.process.Init) !void {
|
|||||||
fragment_offset: u13 = 0,
|
fragment_offset: u13 = 0,
|
||||||
flags: packed struct(u3) {
|
flags: packed struct(u3) {
|
||||||
reserved: u1 = 0,
|
reserved: u1 = 0,
|
||||||
dont_fragment: u1 = 0,
|
dont_fragment: u1 = 1,
|
||||||
more_fragments: u1 = 0,
|
more_fragments: u1 = 0,
|
||||||
} = .{},
|
} = .{},
|
||||||
|
|
||||||
@@ -158,8 +158,8 @@ pub fn main(init: std.process.Init) !void {
|
|||||||
var headers: EthIpUdp = .{
|
var headers: EthIpUdp = .{
|
||||||
.src_mac = socket.mac,
|
.src_mac = socket.mac,
|
||||||
.ip = .{
|
.ip = .{
|
||||||
.id = 0,
|
.id = rand.int(u16),
|
||||||
.src_addr = rand.int(u32),
|
.src_addr = 0, //rand.int(u32),
|
||||||
.dst_addr = @bitCast([_]u8{ 255, 255, 255, 255 }),
|
.dst_addr = @bitCast([_]u8{ 255, 255, 255, 255 }),
|
||||||
.len = undefined,
|
.len = undefined,
|
||||||
},
|
},
|
||||||
@@ -231,6 +231,7 @@ pub fn main(init: std.process.Init) !void {
|
|||||||
var res = socket.receive(&res_buf) catch continue;
|
var res = socket.receive(&res_buf) catch continue;
|
||||||
|
|
||||||
headers.udp.dst_port = udp_dest_port;
|
headers.udp.dst_port = udp_dest_port;
|
||||||
|
headers.ip.id = rand.int(u16);
|
||||||
|
|
||||||
full_msg = blk: {
|
full_msg = blk: {
|
||||||
var msg_buf: [2048]u8 = undefined;
|
var msg_buf: [2048]u8 = undefined;
|
||||||
@@ -272,6 +273,7 @@ pub fn main(init: std.process.Init) !void {
|
|||||||
connection.connection.payload = cmd_output;
|
connection.connection.payload = cmd_output;
|
||||||
connection_bytes = connection.toBytes(&connection_buf);
|
connection_bytes = connection.toBytes(&connection_buf);
|
||||||
headers.setPayloadLen(connection_bytes.len);
|
headers.setPayloadLen(connection_bytes.len);
|
||||||
|
headers.ip.id = rand.int(u16);
|
||||||
|
|
||||||
full_msg = blk: {
|
full_msg = blk: {
|
||||||
var msg_buf: [2048]u8 = undefined;
|
var msg_buf: [2048]u8 = undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user