Skip to content

Instantly share code, notes, and snippets.

@yangl1996
Last active December 24, 2017 10:12
Show Gist options
  • Select an option

  • Save yangl1996/69e56316efdbef12f6dd15ac7b7666d8 to your computer and use it in GitHub Desktop.

Select an option

Save yangl1996/69e56316efdbef12f6dd15ac7b7666d8 to your computer and use it in GitHub Desktop.
802.11 CSI Tool Injecting Mode
Useage: ./setinj <device name> <channel> <bandwidth>
Example: ./setinj wlan1 3 HT20
#!/usr/bin/sudo /bin/bash
ifconfig $1 2>/dev/null 1>/dev/null
while [ $? -ne 0 ]
do
ifconfig $1 2>/dev/null 1>/dev/null
done
iw $1 set bitrates legacy-2.4 1
iw dev $1 interface add mon0 type monitor
iw mon0 set channel $2 $3 2>/dev/null 1>/dev/null
channel_set=$?
while [ $channel_set -ne 0 ]; do
ip link set $1 down 2>/dev/null 1>/dev/null
iw dev $1 set type monitor 2>/dev/null 1>/dev/null
ip link set $1 up
iw dev mon0 set channel $2 $3
channel_set=$?
if [ $channel_set -eq 0 ]; then
echo "Channel set"
fi
done
ifconfig mon0 up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment