Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.20 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo
  4. echo
  5. echo "Enter the WNIC you wish to test the quality of:"
  6. read nic    
  7. echo
  8. if [ "$nic" == 'exit' ]
  9.     then
  10.         break
  11. fi
  12.  
  13. if [ "$nic" == 'quit' ]
  14.     then
  15.         break
  16. fi
  17.  
  18. echo "Please be patient, script working..."
  19. sudo iwlist $nic scanning > wireless_network_list
  20.    
  21.  
  22. if [ -n "$nic" ]
  23.     then
  24.         echo
  25.         total=0
  26.         echo "How many times would you like to test the wireless quality?"
  27.         read count
  28.         current=0
  29.  
  30.         while [ $current -le $count ]
  31.         do
  32.             sudo iwconfig $nic > wireless_details
  33.             quality=$(grep "Quality" wireless_details)
  34.             let total += $(quality:32:2)
  35.             let current += 1
  36.         done
  37.  
  38.         let total /= $count
  39.  
  40.         echo "The average signal strength was $total and the signal level is $(quality:43}"
  41.        
  42.         string=$(grep "ESSID:" wireless_details)
  43.         echo "$nic is connected to the network ${string:31}"
  44.        
  45.         count=$(grep -c "ESSID" wireless_network_list)
  46.         echo "There are $count networks within range"
  47.         echo
  48.     else
  49.         echo "You did not enter a NIC"
  50.     fi
  51. fi
  52.  
  53. rm wireless_network_list
  54. rm wireless_details
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement