mirror of
https://github.com/apprenticeharper/DeDRM_tools
synced 2025-01-18 10:26:35 +01:00
Update obok.py
Changed MAC address fetching code to address possibile regression
This commit is contained in:
parent
73af5d355d
commit
491ad3d714
1 changed files with 12 additions and 5 deletions
|
@ -471,11 +471,18 @@ class KoboLibrary(object):
|
|||
macaddrs = []
|
||||
if sys.platform.startswith('win'):
|
||||
c = re.compile('\s?(' + '[0-9a-f]{2}[:\-]' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
|
||||
output = subprocess.Popen('wmic nic where PhysicalAdapter=True get MACAddress', shell=True, stdout=subprocess.PIPE, text=True).stdout
|
||||
for line in output:
|
||||
m = c.search(line)
|
||||
if m:
|
||||
macaddrs.append(re.sub("-", ":", m.group(1)).upper())
|
||||
try:
|
||||
output = subprocess.Popen('ipconfig /all', shell=True, stdout=subprocess.PIPE, text=True).stdout
|
||||
for line in output:
|
||||
m = c.search(line)
|
||||
if m:
|
||||
macaddrs.append(re.sub("-", ":", m.group(1)).upper())
|
||||
except:
|
||||
output = subprocess.Popen('wmic nic where PhysicalAdapter=True get MACAddress', shell=True, stdout=subprocess.PIPE, text=True).stdout
|
||||
for line in output:
|
||||
m = c.search(line)
|
||||
if m:
|
||||
macaddrs.append(re.sub("-", ":", m.group(1)).upper())
|
||||
elif sys.platform.startswith('darwin'):
|
||||
c = re.compile('\s(' + '[0-9a-f]{2}:' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
|
||||
output = subprocess.check_output('/sbin/ifconfig -a', shell=True, encoding='utf-8')
|
||||
|
|
Loading…
Reference in a new issue