在python代码中包含可执行文件

2024-09-26 17:43:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用DmiDecode for Windows(link)保护我的python文件+py2exe ,bat我想创建独立文件

是否可以在python代码中包含DmiDecode(在ram内存中运行以获取uuid),而不在hdd上进行写操作

我的实际代码是:

def lic():
    try:
        if hashlib.md5(open('c:\dmidecode.exe', 'rb').read()).hexdigest() != 'bca173dc4758676dd812c7632017d0ae':
            sys.exit(1)
        out = os.popen("c:\dmidecode.exe -s system-uuid").read().strip()
        if out not in licente_valide:
            sys.exit(1)
    except:
        sys.exit(1)

lic()

Tags: 文件代码forreadifuuidwindowssys

热门问题