mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 15:08:25 +00:00
Merge pull request #897 from S1DDHEY/fix/replace-deprecated-os.popen
fix: Replaced `os.popen()` with Python's inbuilt file handling
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import hashlib
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
|
||||
from gettext import gettext as _
|
||||
@@ -148,9 +147,12 @@ class ToolsImageEntropyMnemonicLengthView(View):
|
||||
|
||||
# Build in some hardware-level uniqueness via CPU unique Serial num
|
||||
try:
|
||||
stream = os.popen("cat /proc/cpuinfo | grep Serial")
|
||||
output = stream.read()
|
||||
serial_num = output.split(":")[-1].strip().encode('utf-8')
|
||||
serial_num = b''
|
||||
with open("/proc/cpuinfo", "r") as f:
|
||||
for line in f:
|
||||
if "Serial" in line:
|
||||
serial_num = line.split(":")[-1].strip().encode('utf-8')
|
||||
break
|
||||
serial_hash = hashlib.sha256(serial_num)
|
||||
hash_bytes = serial_hash.digest()
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user