[ SEA-GHOST MINI SHELL]

Path : /proc/2/cwd/proc/2/cwd/proc/2/cwd/proc/2/task/2/cwd/var/lib/zabbix/
FILE UPLOADER :
Current File : //proc/2/cwd/proc/2/cwd/proc/2/cwd/proc/2/task/2/cwd/var/lib/zabbix/bareos_job_status.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import subprocess
import sys


def get_opts():
    try:
        return sys.argv[1], sys.argv[2]
    except IndexError:
        print("Please provide job ID and parameter")
        sys.exit(1)

        
def get_job_stat(job_id, stat):
    cmd_list = ('echo', 'llist job={}'.format(job_id))
    cmd_cons = ('bconsole')
    cmd_grep = ('grep', stat)
    cmd_tail = ('tail', '-n1')
    try:
        ps1 = subprocess.Popen(cmd_list, stdout=subprocess.PIPE)
        ps2 = subprocess.Popen(cmd_cons, stdin=ps1.stdout, stdout=subprocess.PIPE)
        ps1.stdout.close()
        ps3 = subprocess.Popen(cmd_grep, stdin=ps2.stdout, stdout=subprocess.PIPE)
        ps2.stdout.close()
        ps4 = subprocess.Popen(cmd_tail, stdin=ps3.stdout, stdout=subprocess.PIPE)
        ps3.stdout.close()
        output, err = ps4.communicate()
        return output.split(':', 1)[1].strip()
    except subprocess.CalledProcessError:
        print "This command requires root privelges and must be run as with sudo"
        sys.exit(1)


if __name__ == "__main__":
    job_id, stat = get_opts()
    result = get_job_stat(job_id, stat)
    print(result)

SEA-GHOST - SHELL CODING BY SEA-GHOST