Advertisement
fenix_of_fire

inspector

Feb 15th, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.95 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ##############################################################################
  4. #                     INSPECTOR OF FIREWALL AND IDS v1.0                     #
  5. #                                                                            #
  6. #                              By: init-0                                    #
  7. ##############################################################################
  8.  
  9. clear="$(which clear)"
  10. sleep="$(which sleep)"
  11. tail="$(which tail)"
  12. snorte="$(which snort)"
  13. ggufw="$(which gufw)"
  14. tableip="$(which iptables)"
  15.  
  16.  
  17. if [ -n "$snorte" ];then
  18. cKsn="yes"
  19. else
  20. cKsn="no"
  21. fi
  22. if [ -n "$ggufw" ]; then
  23. cKgu="yes"
  24. else
  25. cKgu="no"
  26. fi
  27. if [ -n "$tableip" ]; then
  28. cKip="yes"
  29. else
  30. cKip="no"
  31. fi
  32. if [ -z "$snorte" -o -z "$ggufw" -o -z "$tableip" ]; then
  33. clear
  34. echo
  35. echo "Please , install the IDS snort and/or FIREWALL netfilter (iptables AND/or gufw)"
  36. echo; echo
  37. echo "-------------------------------------"
  38. echo -e "apt-get install snort\t$cKsn"
  39. echo -e "apt-get install iptables\t$cKip"
  40. echo -e "apt-get install gufw \t$cKgu"
  41. echo
  42. echo " and return to script "
  43. echo "-------------------------------------"
  44. exit
  45. fi
  46. clear
  47. ufw disable;
  48. iptables --flush
  49. iptables -t nat --flush
  50. iptables -F
  51. echo
  52. sleep 3
  53. ufw enable;
  54. clear
  55. echo
  56. echo "Please open a new terminal in this folder and run the command:   snort -i <interface> -v -c /etc/snort/snort.conf >> log.txt "
  57. echo
  58. echo "start and enter"
  59. read
  60. clear
  61. echo "Please wait ..."
  62. sleep 5
  63. t1m3(){
  64. clear
  65. tail -n24 log*
  66. echo
  67. sleep 15
  68. clear
  69. }
  70. while true; do
  71. ver1f1="$(du -sm log.txt | tr -d "[aA-zZ. ]")"
  72. d1b1=`ls | grep BdS `
  73. if [ "$ver1f1" -gt "1024" ]; then
  74.     if [ "$d1b1" == "" ]; then
  75.         mkdir BdS
  76.     fi
  77. Rlogs="$(date | tr " " "_" | tr ":" "-").tar.gz"
  78. cat log* >> logs
  79. tar -czvf $Rlogs logs*
  80. rm logs*
  81. mv $Rlogs BdS
  82. echo " " > log*
  83. sleep 3
  84. z3r0=`ls BdS | wc -l`
  85.     if [ "$z3r0" == "10" ]; then
  86.         rm -rf BdS
  87.     fi
  88. fi
  89. t1m3
  90. clear
  91. done;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement