[ SEA-GHOST MINI SHELL]

Path : /proc/2/root/var/lib/zabbix/
FILE UPLOADER :
Current File : //proc/2/root/var/lib/zabbix/check_rocket.py.save

#!/usr/bin/env python
import json
import requests
from argparse import ArgumentParser

API_URL = 'https://chat.ds.network/api/v1/'


def get_opts():
    parser = ArgumentParser(
        usage='%(prog)s -u <user> -p <password> -c <channel> -t <text>',
        description='This program is used to connect to Rocket Chat API and send test message'
    )
    parser.add_argument(
        "-u", "--user",
        action="store",
        dest="user",
        help="User name.",
        required=True,
    )
    parser.add_argument(
        "-p", "--pass",
        action="store",
        dest="passwd",
        help="Password for the user.",
        required=True,
    )
    parser.add_argument(
        "-c", "--channel",
        action="store",
        dest="channel",
        help="The channel name with the prefix in front of it.",
        required=True,
    )
    parser.add_argument(
        "-t", "--text",
        action="store",
        dest="text",
        help="The text of the message to send.",
        required=True,
    )
    args = parser.parse_args()
    return args


def main():
    args = get_opts()
    data = {'username': args.user, 'password': args.passwd}
    login = requests.post(API_URL + 'login', data=data).json()
    if login['status'] == 'success':
        token = login['data']['authToken']
        uid = login['data']['userId']
        headers = {
            'X-Auth-Token': token,
            'X-User-Id': uid,
            'Content-type': 'application/json'
        }
        data = {'channel': args.channel, 'text': args.text}
        send_message = requests.post(API_URL + 'chat.postMessage', headers=headers, data=json.dumps(data)).json()
        print send_message['success']
    else:
        print login['message']
    logout = requests.post(API_URL + 'logout', headers=headers).json()


if __name__ == "__main__":
    main()


SEA-GHOST - SHELL CODING BY SEA-GHOST