DF-0569 / analyze_oob.sh
#!/bin/sh # Analyze the OOB TCP entries to verify the byte-swap pattern. # Extracts the dst_port (3rd colon-field) and checks if the low byte is 0-3. echo "=== OOB TCP entries count ===" grep " tcp " /tmp/df0569/oob_states.txt | wc -l echo "" echo "=== dst_port values and their low bytes ===" # Format: "1 5 tcp SRC:SPORT ALIAS:APORT DST:DPORT i TTL" # Extract DPORT (field after last colon in 3rd addr:port pair) grep " tcp " /tmp/df0569/oob_states.txt | while read line; do # Get the 3rd addr:port pair (dst) dport=$(echo "$line" | awk '{print $6}' | sed 's/.*://') if [ -n "$dport" ]; then # Compute low byte: dport mod 256 low=$((dport % 256)) high=$((dport / 256)) # After htons, stored value = low*256 + high stored=$((low * 256 + high)) idx=$((stored - 1024)) echo "host_port=$dport low_byte=$low htons=$stored index=$idx $([ $idx -lt 0 ] && echo '*** OOB ***' || echo 'in-bounds')" fi done |