sergio_educacionit

ranking host

Aug 23rd, 2025
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. log="access_simulado.log"
  4. ranking="ranking.txt"
  5.  
  6. arr=($(cat $log | cut -d "-" -f 1|cut -d "." -f 1,2,3 | sed 's/ *$//'))
  7.  
  8.  
  9.  
  10.  
  11. declare -a checked
  12. declare -a subnet
  13.  
  14.  
  15.  
  16.  
  17.  
  18. for subnet_portion in ${arr[@]};do
  19.  
  20. if echo ${checked[@]} | grep -w $subnet_portion > /dev/null;then
  21.  
  22. continue
  23. fi
  24. counted=$(cat $log | grep $subnet_portion | wc -l)
  25.  
  26. echo "${counted} - ${subnet_portion}.0/24" >> $ranking
  27.  
  28. checked+=($subnet_portion)
  29.  
  30.  
  31. done
  32.  
  33.  
  34. sort -r $ranking
  35.  
Advertisement
Add Comment
Please, Sign In to add comment