コード例 #1
0
ファイル: methods.py プロジェクト: zwd1990/cryptolens-python
 def GetMachineCode():
     
     """
     Get a unique identifier for this device.
     """
     
     if "Windows" in platform.platform():
         return HelperMethods.get_SHA256(HelperMethods.start_process(["cmd.exe", "/C", "wmic","csproduct", "get", "uuid"]))
     elif "Mac" in platform.platform():               
         res = HelperMethods.start_process(["system_profiler","SPHardwareDataType"]).decode('utf-8')
         HelperMethods.get_SHA256(res[res.index("UUID"):].strip())
     elif "Linux" in platform.platform():
         return HelperMethods.get_SHA256(HelperMethods.compute_machine_code())
     else:
         return HelperMethods.get_SHA256(HelperMethods.compute_machine_code())
コード例 #2
0
    def GetMachineCode(v=1):
        """
        Get a unique identifier for this device. If you want the machine code to be the same in .NET on Windows, you
        can set v=2. More information is available here: https://help.cryptolens.io/faq/index#machine-code-generation
        """

        if "windows" in platform.platform().lower():
            return HelperMethods.get_SHA256(
                HelperMethods.start_process(
                    ["cmd.exe", "/C", "wmic", "csproduct", "get", "uuid"], v))
        elif "mac" in platform.platform().lower(
        ) or "darwin" in platform.platform().lower():
            res = HelperMethods.start_process(
                ["system_profiler", "SPHardwareDataType"])
            return HelperMethods.get_SHA256(res[res.index("UUID"):].strip())
        elif "linux" in platform.platform().lower():
            return HelperMethods.get_SHA256(
                HelperMethods.compute_machine_code())
        else:
            return HelperMethods.get_SHA256(
                HelperMethods.compute_machine_code())