imalse / scenario / keylogger /

Full commit

This file contains the BotMaster Command Meta Description for the file
exfiltration scenario.

import jsonpickle 

from core.nodes.botmaster import BotMasterOneCMD
from scenario.keylogger.config import Botmaster as BotmasterDescription

class BotMaster(BotMasterOneCMD):
    """This class is a subclass of BotMasterOneCMD."""
    def __init__(self, desc=None):
        if desc == None:
            desc = BotmasterDescription()
        BotMasterOneCMD.__init__(self, desc )
    def recv_ack(self):
        After receiving the ack from the server, the BotMaster will send 
        the master password to verify itself with the server. After that, 
        the server will send out commands periodically.
        self.logger.debug('Botmaster one command recv_ack has been recorded')
        self.node.send(self.sock, jsonpickle.encode(self.verification_command))

        # Sleep for a while to make sure it has been verified
        self.node.send(self.sock, jsonpickle.encode(self.desc.command))
        self.node.recv(self.sock, 512, self.dispatcher)