u0xpsec

is_conneted.sh

Dec 1st, 2018
418
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/zsh
  2. #
  3. # Author: u0xpsec 2018
  4. #
  5. if [[ `nmcli -t device show wlp3s0 | grep "GENERAL.STATE"` == *"(connected)"* ]] || [[ `nmcli -t device show enp0s25 | grep "GENERAL.STATE"` == *"(connected)"* ]];then
  6. if [[ `nmcli -t device show wlp3s0 | grep "GENERAL.STATE"` == *"(connected)"* ]];then
  7. echo "< wifi connected:" `nmcli -t device show wlp3s0 | grep "GENERAL.CONNECTION" | cut -d":" -f2-` ">"
  8. elif [[ `nmcli -t device show enp0s25 | grep "GENERAL.STATE"` == *"(connected)"* ]];then
  9. echo "───────- < Cable connected:" `nmcli -t device show enp0s25 | grep "GENERAL.CONNECTION" | cut -d":" -f2-` ">"
  10. fi
  11. else
  12. echo "< not connected >"
  13. fi
RAW Paste Data