parameters: (self, label, field)
docstring: Return False if invoking vboxmanage fails. Otherwise return the
          VM information value, if any.
docstring_summary: Return False if invoking vboxmanage fails. Otherwise return the
          VM information value, if any.
docstring_tokens: Return False if invoking vboxmanage fails . Otherwise return the VM information value if any .
function: def vminfo(self, label, field):
          """Return False if invoking vboxmanage fails. Otherwise return the
          VM information value, if any."""
          try:
              args = [
                  self.options.virtualbox.path,
                  "showvminfo", label, "--machinereadable"
              ]
              proc = Popen(
                  args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                  close_fds=True
              )
              output, err = proc.communicate()
  
              if proc.returncode != 0:
                  if "VBOX_E_OBJECT_NOT_FOUND" in err:
                      raise CuckooMissingMachineError(
                          "The virtual machine '%s' doesn't exist! Please "
                          "create one or more Cuckoo analysis VMs and properly "
                          "fill out the Cuckoo configuration!" % label
                      )
  
                  # It's quite common for virtualbox crap utility to exit with:
                  # VBoxManage: error: Details: code E_ACCESSDENIED (0x80070005)
                  # So we just log to debug this.
                  log.debug(
                      "VBoxManage returns error checking status for "
                      "machine %s: %s", label, err
                  )
                  return False
          except OSError as e:
              log.warning(
                  "VBoxManage failed to check status for machine %s: %s",
                  label, e
              )
              return False
  
          for line in output.split("\n"):
              if not line.startswith("%s=" % field):
                  continue
  
              if line.count('"') == 2:
                  return line.split('"')[1].lower()
              else:
                  return line.split("=", 1)[1]
function_tokens: def vminfo ( self , label , field ) : try : args = [ self . options . virtualbox . path , "showvminfo" , label , "--machinereadable" ] proc = Popen ( args , stdout = subprocess . PIPE , stderr = subprocess . PIPE , close_fds = True ) output , err = proc . communicate ( ) if proc . returncode != 0 : if "VBOX_E_OBJECT_NOT_FOUND" in err : raise CuckooMissingMachineError ( "The virtual machine '%s' doesn't exist! Please " "create one or more Cuckoo analysis VMs and properly " "fill out the Cuckoo configuration!" % label ) # It's quite common for virtualbox crap utility to exit with: # VBoxManage: error: Details: code E_ACCESSDENIED (0x80070005) # So we just log to debug this. log . debug ( "VBoxManage returns error checking status for " "machine %s: %s" , label , err ) return False except OSError as e : log . warning ( "VBoxManage failed to check status for machine %s: %s" , label , e ) return False for line in output . split ( "\n" ) : if not line . startswith ( "%s=" % field ) : continue if line . count ( '"' ) == 2 : return line . split ( '"' ) [ 1 ] . lower ( ) else : return line . split ( "=" , 1 ) [ 1 ]