#!/bin/bash
interface=wlan0mon
echo -n "Create monitor mode interface ${interface}... "
iw phy phy0 interface add ${interface} type monitor 2> /dev/null 1> /dev/null
if [ $? -eq 0 ]; then
  echo "success"
else
  echo "failed, already created ?"
fi

echo -n "Trying to enable ${interface}... "
ifconfig ${interface} up 2> /dev/null
if [ $? -eq 0 ]; then
  echo "success, ${interface} is up"
  exit 0
else
  echo "failed"
  exit 1
fi

