Advertisement
Guest User

Process Killer Bot [Python]

a guest
Aug 4th, 2015
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.78 KB | None | 0 0
  1. """
  2. -> Task Killer Program | Written By : Tanmay
  3. Email : tanmay4035266@gmail.com
  4.  
  5.  
  6.  
  7. Automate Process killer script | :)
  8. """
  9. import os
  10. import sys
  11. import time
  12. from colorama import Fore
  13.  
  14. banner = """
  15.  
  16. \tTaskkill Script | For Linux
  17. \tWritten By: Tanmay Upadhyay
  18. \tEmail : tanmay4035266@gmail.com
  19. \n
  20. \tSimple AutoMate Process Killer
  21.  
  22. """;
  23. print banner;
  24.  
  25. class taskkiller(object):
  26.     def __init__(self):
  27.         filename = raw_input('[*] Tasklist : ');
  28.         sec = raw_input('[*] Time To Kill : ');
  29.         self.filename = filename;
  30.         self.sec = sec;
  31.         if(filename == "" or sec == ""):
  32.             print "\n";
  33.             print "\n\t[!] Error : Empty Input Detected.";
  34.             print "\n";
  35.             raw_input('Press Enter To Exit.');
  36.             sys.exit(1);
  37.     def __readfile__(self,filename,time_wait):
  38.         f = open(filename,'r');
  39.         data = f.readlines();
  40.         if(len(data) == 0):
  41.             print "\n\t[-] Error : list cannot be empty.";
  42.             raw_input();
  43.             sys.exit(1);
  44.         else:
  45.             while True:
  46.                 for process in data:
  47.                     process = process.replace("\n","").strip();
  48.                     try:
  49.                         if(os.system('pkill %s'%process) == 0):
  50.                             print(Fore.GREEN+"[SUCCESS] Process { %s } Killed."%process+Fore.RESET);
  51.                             else:
  52.                                     print(Fore.RED+"[ERROR] Process { %s } Not Killed."%process+Fore.RESET);
  53.                     except:
  54.                         print "[-] Error : Unable to Start Auto-Killer [ Unknown - Error ]";
  55.                         time.sleep(2);
  56.                         sys.exit(1);
  57.                 time.sleep(int(time_wait));
  58.  
  59. try:
  60.     start = taskkiller();
  61.     start.__readfile__(start.filename,start.sec);
  62. except KeyboardInterrupt:
  63.     print "\n\n\t[+] Operation Aborted by User.";
  64.     time.sleep(1);
  65.     sys.exit(1);
  66. except IOError:
  67.     print "\n\n\t[-] Error : Unable to open processlist file : ",start.filename
  68.     print "\n";
  69.     time.sleep(5);
  70.     sys.exit(1);
  71.    
  72.    
  73.    
  74. #!IndID3m0n_AutoMation
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement