Exemplo n.º 1
0
    def scp(self, src, dst):
        vm = Vmrun(self.vmx)
        ip = vm.ip()
        user = self.user
        if ip:
            src_is_host = src.startswith(":")
            dst_is_host = dst.startswith(":")

            if src_is_host and dst_is_host:
                puts(colored.red("Both src and host are host destinations"))
                exit()

            if dst_is_host:
                dst = dst[1:]
                puts("Sending {src} to {user}@{ip}:{dst}".format(
                    user=colored.green(user),
                    ip=colored.green(ip),
                    src=src,
                    dst=dst,
                ))
                os.system('scp {} {}@{}:{}'.format(src, user, ip, dst))
            else:
                src = src[1:]
                puts("Getting {user}@{ip}:{src} and saving in {dst}".format(
                    user=colored.green(user),
                    ip=colored.green(ip),
                    src=src,
                    dst=dst,
                ))
                os.system('scp {}@{}:{} {}'.format(user, ip, src, dst))
        else:
            puts(colored.red("IP not found"))
            return
Exemplo n.º 2
0
    def scp(self, src, dst):
        vm = Vmrun(self.vmx)
        ip = vm.ip()
        user = self.user
        if ip:
            src_is_host = src.startswith(":")
            dst_is_host = dst.startswith(":")

            if src_is_host and dst_is_host:
                puts(colored.red("Both src and host are host destinations"))
                exit()

            if dst_is_host:
                dst = dst[1:]
                puts("Sending {src} to {user}@{ip}:{dst}".format(
                    user=colored.green(user),
                    ip=colored.green(ip),
                    src=src,
                    dst=dst,
                ))
                os.system('scp {} {}@{}:{}'.format(src, user, ip, dst))
            else:
                src = src[1:]
                puts("Getting {user}@{ip}:{src} and saving in {dst}".format(
                    user=colored.green(user),
                    ip=colored.green(ip),
                    src=src,
                    dst=dst,
                ))
                os.system('scp {}@{}:{} {}'.format(user, ip, src, dst))
        else:
            puts(colored.red("IP not found"))
            return
Exemplo n.º 3
0
 def ssh(self):
     vm = Vmrun(self.vmx)
     ip = vm.ip()
     if ip:
         puts("Connecting to {}".format(colored.green(ip)))
         os.system('ssh {}@{}'.format(self.user, ip))
     else:
         puts(colored.red("IP not found"))
Exemplo n.º 4
0
 def ssh(self):
     vm = Vmrun(self.vmx)
     ip = vm.ip()
     if ip:
         puts("Connecting to {}".format(colored.green(ip)))
         os.system('ssh {}@{}'.format(self.user, ip))
     else:
         puts(colored.red("IP not found"))
Exemplo n.º 5
0
 def ip(self):
     vm = Vmrun(self.vmx)
     print self.vmx
     ip = vm.ip()
     if ip:
         puts(colored.green(ip))
     else:
         puts(colored.red("IP not found"))
     return ip
Exemplo n.º 6
0
 def ip(self):
     vm = Vmrun(self.vmx)
     print self.vmx
     ip = vm.ip()
     if ip:
         puts(colored.green(ip))
     else:
         puts(colored.red("IP not found"))
     return ip
Exemplo n.º 7
0
def mech_start(filename=False, gui=False):
    if filename:
        vm = Vmrun(filename)
    else:
        vm = get_vm()
    if gui:
        vm.start(gui=True)
    else:
        vm.start()
    ip = vm.ip()
    puts(colored.green("VM started on {}".format(ip)))
Exemplo n.º 8
0
 def start(self):
     vm = Vmrun(self.vmx)
     if self.gui:
         vm.start(gui=True)
     else:
         vm.start()
     puts(colored.yellow("Getting IP address..."))
     ip = vm.ip()
     puts(colored.green("VM started on {}".format(ip)))
     puts(colored.yellow("Sharing current folder..."))
     vm.enableSharedFolders()
     vm.addSharedFolder('mech', os.getcwd())
     puts(colored.green("VM started on {}".format(ip)))
Exemplo n.º 9
0
 def start(self):
     vm = Vmrun(self.vmx)
     if self.gui:
         vm.start(gui=True)
     else:
         vm.start()
     puts(colored.yellow("Getting IP address..."))
     ip = vm.ip()
     puts(colored.green("VM started on {}".format(ip)))
     puts(colored.yellow("Sharing current folder..."))
     vm.enableSharedFolders()
     vm.addSharedFolder('mech', os.getcwd())
     puts(colored.green("VM started on {}".format(ip)))
Exemplo n.º 10
0
 def ip(self):
     vm = Vmrun(self.vmx)
     return vm.ip()
Exemplo n.º 11
0
 def ip(self):
     vm = Vmrun(self.vmx)
     return vm.ip()
Exemplo n.º 12
0
 def ip(self):
     vm = Vmrun(self.vmx)
     print self.vmx
     ip = vm.ip()
     puts(colored.green(ip))
     return ip