示例#1
0
 def factory(workload_manager):
     if workload_manager == "SLURM":
         from slurm import Slurm
         return Slurm()
     if workload_manager == "TORQUE":
         from torque import Torque
         return Torque()
     if workload_manager == "BASH":
         from bash import Bash
         return Bash()
     return None
示例#2
0
def setup_enigmapol(stdscr):
    global drawer, screen, bash
    curses.start_color()
    curses.use_default_colors()
    for i in range(0, curses.COLORS):
        curses.init_pair(i + 1, i, -1)
    screen = stdscr
    enigmapol = EnigmaPol()
    bash = Bash()
    drawer = Drawer(screen)
    enigmapol.make_choice()
示例#3
0
    def func_runner(self):
        file_name = self.command[:-2].strip()  # grabs command name !
        file_path = f"{self.base_dir}\\CDF\\{file_name}.dll"  # makes path for command !

        if isfile(file_path):  # checks if command exist !
            my_file = open(file_path, 'rb')  # opens command !
            command_list = load(my_file)  # loads command data in list !
            my_file.close()  # close command !
            Bash(command=command_list)  # returns the command to the main program !
        else:
            print("Command doesn't exist !")

        return True
示例#4
0
    def execute(self):
        bash = Bash()
        logger = logging.getLogger('script')
        for instruction in self.instructions:
            logger.info(" + %s" % instruction)
            command = bash.command(instruction)
            for line in command.output.splitlines():
                logger.info(" %s" % line)

            for line in command.err.splitlines():
                logger.warning(" %s" % line)

            if command.return_code != 0:
                raise ExecutionFailed("%s exited with code %s" %
                                      (instruction, command.return_code))
示例#5
0
 def factory(workload_manager):
     if workload_manager == "SLURM":
         from slurm import Slurm
         return Slurm()
     elif workload_manager == "TORQUE":
         from torque import Torque
         return Torque()
     elif workload_manager == "BASH":
         from bash import Bash
         return Bash()
     elif workload_manager == "SPARK":
         from spark import Spark
         return Spark()
     else:
         return None
示例#6
0
    def __init__(self, ip, port, pwd="", bash=Bash(), extra=[]):
        self.State = "Conectat"
        self.error = ""
        self.lastsent = ""
        self.ip = ip
        self.port = port
        self.bash = bash
        self.pwd = pwd

        self.actions = []
        self.server_fp = ""
        self.id = 0

        self.people = []
        self.connect_to_server()
        self.init_extra(extra)
        self.checkstatus()
示例#7
0
    def execute(self, instructions):
        if not instructions:
            return

        bash = Bash()
        logger = logging.getLogger(self.namespace)
        if isinstance(instructions, str):
            instructions = instructions.splitlines()

        for instruction in instructions:
            logger.info(" + %s" % instruction)
            command = bash.command(instruction)
            for line in command.output.splitlines():
                logger.info(" %s" % line)

            for line in command.err.splitlines():
                logger.warning(" %s" % line)

            if command.return_code != 0:
                raise ExecutionFailed("%s exited with code %s" %
                                      (instruction, command.return_code))
示例#8
0
def bash():
    from bash import Bash

    return Bash()
示例#9
0
def test_environ(environ):
    from bash import Bash

    bash = Bash(environ=environ)
    env_proc = bash.command("env")
    assert env_proc.ok
示例#10
0
def Shell(shell, environ=None):
    if shell == 'bash':
        from bash import Bash
        return Bash(environ=environ)
示例#11
0
        return rand

    def recvall(self, BUFF_SIZE=128):
        data = b''
        while True:
            part = self.request.recv(BUFF_SIZE)
            data += part
            if len(part) < BUFF_SIZE:
                break
        return data


if __name__ == "__main__":
    global bash, people, lstmsgid, our_fp
    __file__ = os.path.dirname(os.path.abspath(__file__))
    bash = Bash(__file__ + "/.server_keypool", __file__ + "/.server_Config")
    #bash.create_private_key(nom="server_" + NAME_SERVER)
    while bash.get_list_prkeys_name() == []:
        print("Generating a private key...")
        server_key = bash.create_private_key(nom="server_" + NAME_SERVER)
        bash.save_data(server_key.fingerprint, "personal private key")

    our_fp = bash.get_list_prkeys_fingerprint()
    our_public_key = bash.export_key(our_fp)

    actions = []
    actions.append({
        "type": "server_key",
        "message": our_public_key,
        "id": 0,
        "name": bash.current_name(),