A slightly better script.

This script is slightly better in terms of what it does. At the moment it just kills all processes associated with eggdrops.

#!/usr/bin/python
#monitor application
#Author: Shriphani Palakodety
import os
from subprocess import *
process = Popen("ps aux", shell=True, stdout=PIPE)
output = process.communicate()
reqd_output = output[0]
for line in reqd_output.split('n')[1:-1]:
    list = line.split()
    pid = list[1].split(' ')[0]
    for number in pid.split('n'):
        print number
        pro_ass = Popen(["ps", "-p", number], stdout=PIPE)
        outputs = pro_ass.communicate()
        a = outputs[0]
        if a.find('eggdrop')== True:
             os.kill(pid)
             print "All banned applications have been killed."
        else:
             print "No dickface engaging in bs stuff."

Please ignore the last line. It was meant to be there for reasons like testing.

0 comments ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment