Adversarial C2 Protocol Implemented in Zig
0
fork

Configure Feed

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

Complete handshake badly

+13 -7
+13 -7
src/main.zig
··· 192 192 break :blk msg_w.buffered(); 193 193 }; 194 194 195 - std.debug.print("full message = {any}\n", .{full_msg}); 196 - 197 195 try socket.send(full_msg); 198 196 return; 199 197 } ··· 213 211 }, 214 212 }; 215 213 216 - _ = udp_dest_port; 217 - 218 214 var connection_buf: [2048]u8 = undefined; 219 215 const connection_bytes = connection.toBytes(&connection_buf); 220 - std.debug.print("connection: {any}\n", .{connection_bytes}); 221 216 headers.setPayloadLen(connection_bytes.len); 222 217 223 - const full_msg = blk: { 218 + var full_msg = blk: { 224 219 var msg_buf: [2048]u8 = undefined; 225 220 var msg_w: Writer = .fixed(&msg_buf); 226 221 msg_w.writeAll(&headers.toBytes()) catch unreachable; ··· 228 223 break :blk msg_w.buffered(); 229 224 }; 230 225 231 - std.debug.print("full message = {any}\n", .{full_msg}); 226 + try socket.send(full_msg); 232 227 228 + headers.udp.dst_port = udp_dest_port; 229 + try init.io.sleep(.fromSeconds(3), .real); 230 + 231 + full_msg = blk: { 232 + var msg_buf: [2048]u8 = undefined; 233 + var msg_w: Writer = .fixed(&msg_buf); 234 + msg_w.writeAll(&headers.toBytes()) catch unreachable; 235 + msg_w.writeAll(connection_bytes) catch unreachable; 236 + break :blk msg_w.buffered(); 237 + }; 233 238 try socket.send(full_msg); 239 + 234 240 return; 235 241 } 236 242