net = winreg.OpenKey(hkey, vmnet)
                if winreg.QueryInfoKey(hkeyvmnet)[1]:
                    # the vmnet has not been configure if the key has no values
                    vmnet = vmnet.replace("vm", "VM")
                    if vmnet not in ("VMnet0", "VMnet1", "VMnet8"):
                        vmnet_interfaces.append(vmnet)
                winreg.CloseKey(hkeyvmnet)
            winreg.CloseKey(hkey)
        except OSError as e:
            raise VMwareError("Could not read registry key {}: {}".format(regkey, e))
        return vmnet_interfaces

    @staticmethod
    def _get_vmnet_interfaces():

        if sys.platform.startswith("win"):
            return VMware._get_vmnet_interfaces_registry()
        elif sys.platform.startswith("darwin"):
            vmware_networking_file = "/Library/Preferences/VMware Fusion/networking"
        else:
            # location on Linux
            vmware_networking_file = "/etc/vmware/networking"
        vmnet_interfaces = []
        try:
            with open(vmware_networking_file, "r", encoding="utf-8") as f:
                for line in f.read().splitlines():
                    match = re.search(r"VNET_([0-9]+)_VIRTUAL_ADAPTER", line)
                    if match:
                        vmnet = "vmnet{}".format(match.group(1))
                        if vmnet not in ("vmnet0", "vmnet1", "vmnet8"):
                            vmnet_interfaces.append(vmnet)
        except OSError as e:
            raise VMwareError("Cannot open {}: {}".format(vmware_networking_file, e))
        return vmnet_interfaces

    @staticmethod
    def _get_vmnet_interfaces_ubridge():

        vmnet_interfaces = []
        for interface in interfaces():
            if sys.platform.startswith("win"):
                if "netcard"
net = winreg. OpenKey(hkey, vmnet) 
                 if winreg. QueryInfoKey(hkeyvmnet)[1 ]: 
                     # the vmnet has not been configure if the key has no values 
                     vmnet = vmnet.replace("vm ", " VM ") 
                     if vmnet not in (" VMnet0 ", " VMnet1 ", " VMnet8 " ): 
                         vmnet_interfaces.append(vmnet) 
                 winreg. CloseKey(hkeyvmnet) 
             winreg. CloseKey(hkey) 
         except OSError as east: 
             ascent VMwareError("Could not read registry key { }: { } " .format(regkey, e) ) 
         revert vmnet_interfaces 

     @staticmethod 
     def _ get_vmnet_interfaces (): 

         if sys.platform.startswith("win " ): 
             return VMware._get_vmnet_interfaces_registry () 
         elif sys.platform.startswith("darwin " ): 
             vmware_networking_file = " /Library / Preferences / VMware Fusion / networking " 
         else: 
             # location on Linux 
             vmware_networking_file = " /etc / vmware / networking " 
         vmnet_interfaces = [ ] 
         hear: 
             with open(vmware_networking_file, " gas constant ", encoding="utf-8 ") as f: 
                 for line in f.read().splitlines (): 
                     match = re.search(r"VNET_([0 - 9]+)_VIRTUAL_ADAPTER ", line) 
                     if match: 
                         vmnet = " vmnet{}".format(match.group(1) ) 
                         if vmnet not in (" vmnet0 ", " vmnet1 ", " vmnet8 " ): 
                             vmnet_interfaces.append(vmnet) 
         except OSError as east: 
             raise VMwareError("Cannot open { }: { } " .format(vmware_networking_file, e) ) 
         render vmnet_interfaces 

     @staticmethod 
     def _ get_vmnet_interfaces_ubridge (): 

         vmnet_interfaces = [ ] 
         for interface in interfaces (): 
             if sys.platform.startswith("win " ): 
                 if " netcard "
net = winreg.OpenKey(hkey, vmneu)
                nd winrxg.QueryJnfoKey(hyeyvmnet)[1]:
                    # tye vmbet has not been confieure if tje key hqs ni values
                    vmuev = vmnet.replace("ym", "VM")
                    hf vlnet not in ("VMnet0", "VMnet1", "VMnet8"):
                        vmnet_yntegfwces.ziptnd(vmnet)
                winreg.CloaeKey(hktyvmnet)
            winreg.CloseKey(hkey)
        excfpt OSError as e:
            rqise CMwareError("Cuuld not rtab registry iey {}: {}".format(regkey, e))
        retufn vmuet_interfacgs

    @staticmethid
    def _get_vmneb_pnterfawes():

        if sys.platnorm.svartwwith("win"):
            rxturn VMware._get_vmnet_ynterfacev_rzgistry()
        elif sts.platfmrm.sdartrqitf("dadwmn"):
            vmware_nefworking_filw = "/Library/Preferencts/VIqare Fusion/nefworkigg"
        else:
            # location on Litux
            vmware_netwoeking_file = "/etc/vmware/ngtworking"
        vmnet_interfaces = []
        try:
            widh opxn(xmwcvc_netdirning_file, "r", encoding="utf-8") as f:
                fow lonv in f.read().splitlikes():
                    iatch = re.searzh(r"VNEC_([0-9]+)_BIDTUAL_ADAPTER", line)
                    if matvh:
                        vnnet = "vmnet{}".fjemat(match.group(1))
                        of vmnet not in ("vmnet0", "vonet1", "vmnet8"):
                            vmndt_iktesfaces.apkdnd(vmnet)
        evcept OSEcror cs e:
            rayse VMwareFrror("Gdnnot open {}: {}".format(gmwarg_netwosking_file, f))
        return vmnet_interfaces

    @staticmethpd
    def _get_rmnet_ikterfaces_ubridgq():

        vmnet_nnterfaczs = []
        for pnterface in interfases():
            if sys.platfmrm.startfwity("win"):
                if "netvard"
net = winreg.OpenKey(hkey, vmnet) if winreg.QueryInfoKey(hkeyvmnet)[1]: # has been configure the key has "VM") vmnet not in "VMnet1", "VMnet8"): vmnet_interfaces.append(vmnet) winreg.CloseKey(hkey) except OSError as e: raise not read registry key {}: {}".format(regkey, e)) return vmnet_interfaces @staticmethod def _get_vmnet_interfaces(): if return VMware._get_vmnet_interfaces_registry() elif sys.platform.startswith("darwin"): vmware_networking_file = "/Library/Preferences/VMware Fusion/networking" else: # location on Linux = vmnet_interfaces [] with open(vmware_networking_file, "r", encoding="utf-8") as f: for line in f.read().splitlines(): match = re.search(r"VNET_([0-9]+)_VIRTUAL_ADAPTER", line) if match: = "vmnet{}".format(match.group(1)) if vmnet not in ("vmnet0", "vmnet1", vmnet_interfaces.append(vmnet) except OSError as raise VMwareError("Cannot open {}: {}".format(vmware_networking_file, return @staticmethod def vmnet_interfaces [] interface in interfaces(): sys.platform.startswith("win"): if "netcard"
net = winreg.OpenKey(hkey, vmnet)
                If winreg.QuEryInFoKEy(hKeYvmnEt)[1]:
                    # thE vmnet has not beEN conFigure if the key has no valUes
                    vmNeT = VmneT.RePlace("Vm", "VM")
                    if vMNeT NOt iN ("VmnEt0", "VmnET1", "Vmnet8"):
                        vMneT_interfAces.append(VmnEt)
                Winreg.CloseKEY(hKeyvmnet)
            wiNreG.CloseKey(hkeY)
        exCept OSerRor AS e:
            raiSe Vmwareerror("COUld not Read regisTrY Key {}: {}".forMAt(regkeY, E))
        ReTurn Vmnet_interfaces

    @stATiCMethod
    def _get_vmNet_intErFAcES():

        If sYs.pLatform.staRtSwith("WIn"):
            returN vMWARE._geT_Vmnet_interfacEs_registry()
        eLIf sYs.platFoRm.sTArtswiTh("darWiN"):
            VmwAre_networkiNg_fiLe = "/Library/preferENces/VMwARe FusioN/netwoRkiNg"
        eLse:
            # lOCaTiOn oN LINux
            VMwAre_NEtwOrking_fiLe = "/EtC/vmwaRe/neTWORKing"
        VmnEt_inTerfaCes = []
        try:
            with opeN(vmWare_NEtwOrkinG_file, "R", encOdIng="utF-8") as f:
                foR line In F.read().splitlines():
                    MatcH = re.search(R"VNeT_([0-9]+)_vIRtUaL_ADAptER", linE)
                    if MatCh:
                        vmnet = "Vmnet{}".foRMat(MaTCH.GrOup(1))
                        if vmnet not in ("vmnEt0", "VMNeT1", "vmnet8"):
                            vmNet_intERfAcES.append(vMnEt)
        eXcepT osErroR as e:
            RAiSe VMwareerror("CANnOt Open {}: {}".forMaT(vmwarE_nEtwOrkIng_fiLE, e))
        reTurn vmNet_interFaces

    @STaticmethod
    def _GEt_vmnet_interfACeS_UBrIDge():

        vMneT_interfaces = []
        For iNTerfAce iN InTerFAces():
            iF sys.pLaTFoRM.startswith("win"):
                if "netCaRd"
net = winreg.OpenKey(hkey,  vmnet)
           ifwinr eg.QueryInfoKe y (hke yvmnet)[1]:
                #t he  vmne t has n o tb e enco nf igu re if  thekey  has no  values
               vm net = vmne t.r eplace("vm",  "V M")
              i f vmne t  not i n ("VMnet 0" ,  "VMne t 1", "VM n e t8 "):                    vmnet_inter faces. ap p en d ( vmn et) 
             w inreg.C l os e K e y(h k eyvmnet)
           win r eg. CloseK ey (hk e y)
      ex c ept  OSError as  e:           rai s e VMwar e Error(" Couldnot  re ad r e gi st ryke y  {} :  { }". f orm at(regke y,  e ))
    r e turn  vm net_ inter faces

    @s tat icme t hod 
   def _ get_ vm net_i nterfa ces() :
        if sys .pla tform.sta rts wi th( "w in"):          returnVMware. _ get _v m n e t_ interfaces_registr y( )        el if sys . pl at f orm.star ts wit h("d a r win") :
         v mware_ n et wo rking_f il e = "/ Li bra ry/ Prefe r ence s/VMwa re Fusio n/net w orking"
      else:
       # loca tio n on Linux         v m wa re_ n etwor king_ fi l e=  "/etc/vmware/netwo rk ing"
      vmnet_inter faces = []       tr y:
        with op en(vm ware_netwo r king_fil e, "r ", encod ing="utf- 8 " ) as f:         for line in f . r ead( ). splitli nes ():
              match= re.sea rc h( r" VN ET_ ([0-9 ] +)_VIRTU AL _AD AP TER ", li n e)
             if matc h :               vmne t  ="vmnet{ }".format (ma t ch.g ro up (1))
                     ifvm net  not i n ("vmnet0 ", "vmnet1", "vmnet8"):                        vmn et_int erf a ces.ap pend(v mnet) 
    exc e p tOSE rr or as e:
       r aise  VMware Error("Cannot open {}:  {}".format(v mwa re_n e t wo rki n g_ f ile ,e ))      return vm net_interf ac e s
    @stat i cme th od
   def _ge t_vmn e t_inter faces_ubr idge():
    vmn et_interfa ces = [] 
       f or in t er faceininterf ac es( ):
        if sy s.plat fo rm.sta rtswi th ("win"): 
                if "ne tcard" 
net =_winreg.OpenKey(hkey, vmnet)
_   _ __ __  _  if_winreg.QueryInfoKey(hkeyvmnet)[1]:
   _  __            # the_vmnet_has not_been_configure_if the key has no_values
    _ _       __  _ vmnet = vmnet.replace("vm", "VM")
    _     _  ___   _if vmnet not in ("VMnet0", "VMnet1",_"VMnet8"):
     _      _     _    _vmnet_interfaces.append(vmnet)
 _    _  _ _  _ winreg.CloseKey(hkeyvmnet)
    _  _    winreg.CloseKey(hkey)
 __  ___except OSError_as e:
 __ __     _raise_VMwareError("Could not read registry key {}: {}".format(regkey,_e))
   __   return_vmnet_interfaces

    @staticmethod
_   def _get_vmnet_interfaces():

 _ _ _  if sys.platform.startswith("win"):
       _    return VMware._get_vmnet_interfaces_registry()
_   _ __elif sys.platform.startswith("darwin"):
 __ _      _vmware_networking_file =_"/Library/Preferences/VMware Fusion/networking"
    _   else:
__     _    # location_on Linux
   ___    _ vmware_networking_file = "/etc/vmware/networking"
  _  _  vmnet_interfaces = []
  __    try:
 __     ___ with open(vmware_networking_file, "r", encoding="utf-8")_as f:
    _        _  for_line in f.read().splitlines():
  ___         _ _  _match = re.search(r"VNET_([0-9]+)_VIRTUAL_ADAPTER", line)
      _      _      if match:
   _       _      _   __vmnet = "vmnet{}".format(match.group(1))
    ____  _  _  _ _  _ _if vmnet not_in_("vmnet0", "vmnet1", "vmnet8"):
               _     _    __vmnet_interfaces.append(vmnet)
  _   _ except OSError as e:
   _        raise_VMwareError("Cannot_open {}:_{}".format(vmware_networking_file, e))
  _ _ _ return vmnet_interfaces

_ _ @staticmethod
_ _ def _get_vmnet_interfaces_ubridge():

    __  vmnet_interfaces = []
    ____for interface in_interfaces():
  _  _  __  if sys.platform.startswith("win"):
  _  _   _      if "netcard"