Skip to content

Instantly share code, notes, and snippets.

@ryo
Last active December 28, 2015 02:49
Show Gist options
  • Save ryo/7430945 to your computer and use it in GitHub Desktop.
Save ryo/7430945 to your computer and use it in GitHub Desktop.
send udp packet that cksum 0xffff.
#!/bin/sh
DST=192.168.2.123
SRC=192.168.0.2
DSTPORT=11111
SRCPORT=12345
perl -e '
sub xip{ pack("C4",map(~(0+$_),split("\\.",shift))) }
sub xn{ pack("n",map(~(0+$_),shift)) }
print xip(shift),xip(shift),xn(shift),xn(shift),xn(0x3175)
' $DST $SRC $DSTPORT $SRCPORT | socat - UDP:$DST:$DSTPORT,sourceport=$SRCPORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment