# extract the source IP addr into dotted quad form my($source) = sprintf("%d.%d.%d.%d", ord( substr($packet, $src_ip, 1) ), ord( substr($packet, $src_ip+1, 1) ), ord( substr($packet, $src_ip+2, 1) ), ord( substr($packet, $src_ip+3, 1) )); # extract the destination IP addr into dotted quad form my($destination) = sprintf("%d.%d.%d.%d", ord( substr($packet, $dst_ip, 1) ), ord( substr($packet, $dst_ip+1, 1) ), ord( substr($packet, $dst_ip+2, 1) ), ord( substr($packet, $dst_ip+3, 1) )); #the above part is directly taken from "hacking linux exposed" (sorry but couldn't figure out this part)