Skip to content

Commit

Permalink
update grep pattern to be more strict
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Oct 5, 2023
1 parent 004e3a1 commit ad809a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions machineid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ def id(winregistry: bool = True) -> str:
mountinfo = __read__('/proc/self/mountinfo')
if mountinfo:
if 'docker' in mountinfo:
id = __exec__("grep '/var/lib/docker/containers' /proc/self/mountinfo | cut -d/ -f6")
id = __exec__("grep '/var/lib/docker/containers/.*/hostname' /proc/self/mountinfo | cut -d/ -f6")
if not id:
id = __exec__("grep '/data/docker/containers' /proc/self/mountinfo | cut -d/ -f5")
id = __exec__("grep '/data/docker/containers/.*/hostname' /proc/self/mountinfo | cut -d/ -f5")
if not id:
id = __exec__("grep '/@docker/containers' /proc/self/mountinfo | cut -d/ -f4")
id = __exec__("grep '/@docker/containers/.*/hostname' /proc/self/mountinfo | cut -d/ -f4")
if not id:
if 'microsoft' in uname().release: # wsl
id = __exec__("powershell.exe -ExecutionPolicy bypass -command '(Get-CimInstance -Class Win32_ComputerSystemProduct).UUID'")
Expand Down

0 comments on commit ad809a6

Please sign in to comment.