26 lines
800 B
Python
26 lines
800 B
Python
from utils.utils_drive import Drive
|
||
from utils.globals import *
|
||
|
||
|
||
if OS_TYPE == "Windows":
|
||
import wmi
|
||
c = wmi.WMI()
|
||
drives = []
|
||
if disks := c.Win32_DiskDrive():
|
||
for disk in disks:
|
||
drives.append(Drive(disk.Model, disk.Name, disk.InterfaceType, disk.DefaultBlockSize, int(disk.Size)))
|
||
elif OS_TYPE == "Linux":
|
||
import subprocess
|
||
|
||
# Execute the lsblk command to get information about block devices
|
||
result = subprocess.run(['lsblk', '-o', 'NAME,SIZE,MODEL,VENDOR,TRAN'], capture_output=True, text=True)
|
||
|
||
# Get the output
|
||
output = result.stdout
|
||
|
||
# Вывод информации о дисках
|
||
print(output)
|
||
|
||
# for drive in drives:
|
||
# print(f"{drive.name} | {drive.path} | {drive.disk_type} | {drive.block_size} | {drive.capacity}")
|