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
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"))
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
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)))
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)))
def ip(self): vm = Vmrun(self.vmx) return vm.ip()
def ip(self): vm = Vmrun(self.vmx) print self.vmx ip = vm.ip() puts(colored.green(ip)) return ip