Ejemplo n.º 1
0
 def execute():
     subprocess.call([
         'sshpass', '-p', settings['password'], 'ssh',
         'robot@{}'.format(settings['ip']), '-t',
         tmuxify.build_call(settings['password'])
     ])
     print('Done')
Ejemplo n.º 2
0
    def __init__(self, settings):
        self.ip = settings['ip']
        self.password = settings['password']
        self.pscp = os.path.join(bin_path, 'pscp.exe')
        self.putty = os.path.join(bin_path, 'putty.exe')

        # check for pscp
        if not os.path.exists(self.pscp):
            url = ROBOLAB_SERVER + 'pscp.exe'
            with urllib.request.urlopen(url) as download,\
                    open(self.pscp, 'wb') as file:
                file.write(download.read())

        # check for putty
        if not os.path.exists(self.putty):
            url = ROBOLAB_SERVER + 'putty.exe'
            with urllib.request.urlopen(url) as download,\
                    open(self.putty, 'wb') as file:
                file.write(download.read())

        # check for the backup command
        self.backupfile = os.path.join(bin_path, 'backup.txt')
        if not os.path.exists(self.backupfile):
            with open(self.backupfile, 'w') as new_backup:
                new_backup.write(raw_backup.format(''))

        # check the file containing the command that will be executed
        self.execfile = os.path.join(bin_path, 'exec.txt')
        with open(self.execfile, 'w') as new_exec:
            new_exec.write(tmuxify.build_call(settings['password']))
Ejemplo n.º 3
0
    def __init__(self, settings):
        self.ip = settings['ip']
        self.password = settings['password']
        self.pscp = os.path.join(BIN_PATH, 'pscp.exe')
        self.putty = os.path.join(BIN_PATH, 'putty.exe')

        # check for the backup command
        self.backupfile = os.path.join(BIN_PATH, 'backup.txt')
        if not os.path.exists(self.backupfile):
            with open(self.backupfile, 'w') as new_backup:
                new_backup.write(raw_backup.format(''))

        # check the file containing the command that will be executed
        self.execfile = os.path.join(BIN_PATH, 'exec.txt')
        with open(self.execfile, 'w') as new_exec:
            new_exec.write(tmuxify.build_call(settings['password']))