On this page
packet.set_byte
Writes one payload byte at a payload-relative offset.
Syntax
Atlas Script
packet.set_byte(offset, value)Parameters
offset- Byte offset into the packet. Payload-relative for packet.* methods, and absolute (whole IP packet) for the raw_* variants.
value- Value written, converted, or evaluated by this method. Its required type and range are described in Remarks.
Return value
See the remarks for the returned value and runtime behavior.
Remarks
Writes one payload byte at a payload-relative offset. The value wraps to 0-255; an offset past the end of the packet does nothing.
Examples
Edit one byte in matching packets.atlas
event on_start() {
if (!network.capture("udp and udp.DstPort == 9000")) {
system.log("Network capture could not start");
}
}
event on_network_send() {
// In this example protocol, payload byte 0 is a message type.
if (packet.payload_length >= 2 && packet.byte(0) == 0x01) {
packet.set_byte(1, 0x7F);
}
}