Adversarial C2 Protocol Implemented in Zig
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: convert MacAddr from vector to int

Still expose a vector / slice API with .fromSlice,

authored by

Robby Zambito and committed by
Tangled
7077aae9 1f500b9b

+15 -4
+2 -2
src/Client.zig
··· 46 46 const rand = io_source.interface(); 47 47 48 48 var headers: EthIpUdp = .{ 49 - .src_mac = self.socket.mac, 49 + .src_mac = .fromSlice(self.socket.mac), 50 50 .ip = .{ 51 51 .id = rand.int(u16), 52 52 .src_addr = 0, //rand.int(u32), ··· 86 86 const rand = io_source.interface(); 87 87 88 88 var headers: EthIpUdp = .{ 89 - .src_mac = self.socket.mac, 89 + .src_mac = .fromSlice(self.socket.mac), 90 90 .ip = .{ 91 91 .id = rand.int(u16), 92 92 .src_addr = 0, //rand.int(u32),
+13 -2
src/EthIpUdp.zig
··· 53 53 54 54 // --- Ethernet --- 55 55 eth_type: u16 = std.os.linux.ETH.P.IP, 56 - src_mac: @Vector(6, u8), 57 - dst_mac: @Vector(6, u8) = @splat(0xff), 56 + src_mac: MacAddr, 57 + dst_mac: MacAddr = .fromSlice(@splat(0xff)), 58 + 59 + pub const MacAddr = packed struct { 60 + int: I, 61 + 62 + pub const V = @Vector(6, u8); 63 + pub const I = @Int(.unsigned, @bitSizeOf(V)); 64 + 65 + pub fn fromSlice(s: V) MacAddr { 66 + return .{ .int = @bitCast(s) }; 67 + } 68 + }; 58 69 59 70 pub fn toBytes(self: @This()) [336 / 8]u8 { 60 71 var res: [336 / 8]u8 = undefined;