POSIX_Scripts/netsh

60 lines
1.3 KiB
Plaintext
Raw Normal View History

2021-06-29 23:22:57 -04:00
#!/usr/bin/env sh
#This is a poorly-written script and should be ignored.
printf "\nWhat do you want to do?\n1. Configure\n2. Scan\n3. View\n>: "
read choice
case $choice in
1)
printf "Not ready yet.\n"
;;
2)
printf "\nScan with which interface?\n"
ifconfig -l | tr ' ' '\n' | grep wl | nl | awk '{printf $1 ". " $2 "\n"}'
printf ">: "
read choice
dev=`ifconfig -l | tr ' ' '\n' | grep wl | sed $choice!d`
iw dev $dev scan | grep SSID | $PAGER
;;
3)
printf "\nView what?\n1. Interface information\n2. Routing table\n>: "
read choice
case $choice in
1)
x=1
i=$((`ifconfig -l | tr ' ' '\n' | wc -l`+1))
printf "\nWhich interface?\n"
while [ $x -lt $i ]
do ifconfig -l | tr ' ' '\n' | nl | sed $x!d | awk '{printf $1 ". " $2 "\n"}'
x=$(($x+1))
done
printf ">: "
read choice
printf "\n" ; ifconfig -l | tr ' ' '\n' | sed $choice!d | awk '{printf "ifconfig " $1 "\n"}' | sh -e --
;;
2)
printf "\n" ; route ; printf "\n"
;;
*)
printf "Illegal input. Aborting.\n"
;;
esac
;;
*)
printf "Illegal input. Aborting.\n"
;;
esac
exit