def patch_scsi_identifiers(self):
types = {
"DiskPeripheral": self.HDD_IDENTIFIERS,
"CdRomPeripheral": self.CDROM_IDENTIFIERS,
}
for row in itertools.product([0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2, 3]):
type_ = query_value(HKEY_LOCAL_MACHINE, "HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port %d\\Scsi Bus %d\\Target Id %d\\Logical Unit Id %d" % row, "Type")
value = query_value(HKEY_LOCAL_MACHINE, "HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port %d\\Scsi Bus %d\\Target Id %d\\Logical Unit Id %d" % row, "Identifier")
if not type_ or not value:
continue
value = value.lower()
if "vbox" in value or "vmware" in value or "qemu" in value or "virtual" in value:
if type_ in types:
new_value = random.choice(types[type_])
else:
log.warning("Unknown SCSI type (%s), disguising it with a random string", type_)
new_value = random_string(len(value))
set_regkey(HKEY_LOCAL_MACHINE, "HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port %d\\Scsi Bus %d\\Target Id %d\\Logical Unit Id %d" % row,
"Identifier", REG_SZ, new_value)
评论列表
文章目录