-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e90b19d
commit 1e22cc9
Showing
7 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from jnius import autoclass, cast | ||
from plyer.platforms.android import activity | ||
from plyer.facades import UniqueID | ||
|
||
TelephonyManager = autoclass('android.telephony.TelephonyManager') | ||
Context = autoclass('android.content.Context') | ||
|
||
class AndroidUniqueID(UniqueID): | ||
|
||
def _get_uid(self): | ||
manager = cast('android.telephony.TelephonyManager', | ||
activity.getSystemService(Context.TELEPHONY_SERVICE)) | ||
return manager.getDeviceId() | ||
|
||
def instance(): | ||
return AndroidUniqueID() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from subprocess import Popen, PIPE | ||
from plyer.facades import UniqueID | ||
|
||
class LinuxUniqueID(UniqueID): | ||
def _get_uid(self): | ||
lshw_process = Popen(["lshw", "-quiet"], stdout=PIPE, stderr=PIPE) | ||
grep_process = Popen(["grep", "-m1" ,"serial:"], | ||
stdin=lshw_process.stdout, stdout=PIPE) | ||
lshw_process.stdout.close() | ||
output = grep_process.communicate()[0] | ||
|
||
if output: | ||
return output.split()[1] | ||
else: | ||
return None | ||
|
||
def instance(): | ||
return LinuxUniqueID() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from subprocess import Popen, PIPE | ||
from plyer.facades import UniqueID | ||
|
||
class OSXUniqueID(UniqueID): | ||
def _get_uid(self): | ||
ioreg_process = Popen(["ioreg", "-l"], stdout=PIPE) | ||
grep_process = Popen(["grep", "IOPlatformSerialNumber"], | ||
stdin=ioreg_process.stdout, stdout=PIPE) | ||
ioreg_process.stdout.close() | ||
output = grep_process.communicate()[0] | ||
|
||
if output: | ||
return output.split()[3][1:-1] | ||
else: | ||
return None | ||
|
||
def instance(): | ||
return OSXUniqueID() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
try: | ||
import _winreg as regedit | ||
except: | ||
try: | ||
import winreg as regedit | ||
except: | ||
raise NotImplemented() | ||
|
||
from plyer.facades import UniqueID | ||
|
||
class WinUniqueID(UniqueID): | ||
|
||
def _get_uid(self): | ||
hKey = regedit.OpenKey(regedit.HKEY_LOCAL_MACHINE, | ||
r"SOFTWARE\\Microsoft\\Cryptography") | ||
value, _ = regedit.QueryValueEx (hKey, "MachineGuid") | ||
return value | ||
|
||
def instance(): | ||
return WinUniqueID() |