[ SEA-GHOST MINI SHELL]
#!/usr/bin/env python
# coding: utf-8
from jira import JIRA
import config
import sys
import requests
import re
import os
import sqlite3
# PARAMS RECEIVED FROM ZABBIX SERVER:
# sys.argv[1] = TO
# sys.argv[2] = SUBJECT
# sys.argv[3] = BODY
def jira_login():
jira_server = {'server': config.jira_server}
return JIRA(options=jira_server, basic_auth=(config.jira_user, config.jira_pass))
def create_issue(to, tittle, body, project, issuetype, priority):
jira = jira_login()
issue_params = {
'project': {'key': project},
'summary': tittle,
'description': body,
'issuetype': {'name': issuetype},
'assignee': {'name': to},
'priority': {'id': priority}
}
return jira.create_issue(fields=issue_params).key
def add_attachment(issue, attachment):
jira = jira_login()
jira.add_attachment(issue, attachment)
def print_message(string):
string = str(string) + "\n"
filename = sys.argv[0].split("/")[-1]
sys.stderr.write(filename + ": " + string)
def main():
# zbx_body = open('entry.txt', 'r').read()
# zbx_body = sys.argv[3]
zbx_body = open('entry.txt','r').read()
zbx_body = zbx_body.splitlines()
zbx_body_text = []
for line in zbx_body:
zbx_body_text.append(line)
trigger_ok = int(settings['zbx_ok'])
trigger_id = int(settings['zbx_triggerid'])
# print(result)
priority = "5"
create_issue(sys.argv[1], sys.argv[2], '\n'.join(zbx_body_text), config.jira_project,
config.jira_issue_type, priority)
if __name__ == '__main__':
main()
SEA-GHOST - SHELL CODING BY SEA-GHOST