Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. Friday, 10 October 2012 13:15:39 +0300|192.168.110.5|rock| - |user has made auth in| -
  2. Friday, 10 October 2012 13:15:39 +0300|192.168.110.5|rock| - |user has changed password| -
  3. Friday, 10 October 2012 13:15:39 +0300|192.168.110.5|rock| - |user has made auth off| -
  4. Friday, 10 October 2012 13:15:42 +0300|192.168.110.5|hogan| - |user has made auth in| -
  5. Friday, 10 October 2012 13:15:49 +0300|172.16.170.180|cena| - |user has made auth in| -
  6. Friday, 10 October 2012 13:15:49 +0300|172.16.170.180|cena| - |user has changed password| -
  7. Friday, 10 October 2012 13:15:49 +0300|172.16.170.180|cena| - |user has made auth off| -
  8. Friday, 10 October 2012 13:15:59 +0300|192.168.107.1|master| - |user has made auth in| -
  9. Friday, 10 October 2012 13:15:59 +0300|192.168.107.1|master| - |user has made auth in| -
  10. Friday, 10 October 2012 13:15:59 +0300|192.168.107.1|master| - |user has changed password| -
  11. Friday, 10 October 2012 13:15:59 +0300|192.168.107.1|master| - |user has made auth off| -
  12. Friday, 10 October 2012 13:17:50 +0300|192.168.107.1|cmpunk| - |user has made auth in| -
  13. Friday, 10 October 2012 13:17:50 +0300|192.168.107.1|cmpunk| - |user has changed password| -
  14. Friday, 10 October 2012 13:17:50 +0300|192.168.107.1|cmpunk| - |user has changed profile| -
  15. Friday, 10 October 2012 13:17:50 +0300|192.168.107.1|cmpunk| - |user has made auth off| -
  16. Friday, 10 October 2012 13:19:19 +0300|10.10.10.25|ziggler| - |user has made auth in| -
  17. Friday, 10 October 2012 13:19:19 +0300|10.10.10.25|ziggler| - |user has changed password| -
  18. Friday, 10 October 2012 13:19:19 +0300|10.10.10.25|ziggler| - |user has made auth off| -
  19. Friday, 10 October 2012 13:20:42 +0300|178.57.67.225|vince| - |user has made auth in| -
  20.  
  21. #!/bin/bash
  22.  
  23. log=/root/auth.log
  24. temp=/root/log.temp
  25. result=/root/bots.result
  26.  
  27. cat /dev/null > $temp
  28. cat /dev/null > $result
  29.  
  30. cat $log | awk '{print $6}' | awk -F "|" '{print $2}' | tail -n 10 > $temp
  31.  
  32. for i in `uniq -c $temp | awk '{print $1}'`; do
  33. if [ $i -gt 4 ]; then
  34. a=`uniq -c $temp | awk '$1 == '$i`
  35. echo "This is a boy: $a" >> $result
  36. fi
  37. done
  38.  
  39. #!/bin/bash
  40. log="/root/auth.log"
  41. result="/root/bots.result"
  42.  
  43. # we probably don't need the intermediate file
  44. # temp=/root/log.temp
  45.  
  46. # a simple redirect can clear the output file
  47. > $result
  48.  
  49. # read every line of the log file
  50. while read line; do
  51. # split fields with 'cut' using whitespace as a delimiter
  52. date=`echo "$line" | cut -d' ' -f1-5`
  53.  
  54. # split using pipe as a delimiter
  55. ip=`echo "$line" | cut -d'|' -f2`
  56. user=`echo "$line" | cut -d'|' -f3`
  57. event=`echo "$line" | cut -d'|' -f5`
  58.  
  59. # report results
  60. echo "date:$date user:$user from ip:$ip $event" >> "$results"
  61. done < "$log"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement