Ejemplo n.º 1
0
def randoms_from_lists():
    random_host = random_utils.random_hostname()
    random_user = random_utils.random_username()
    random_mac = random_utils.random_mac_address()
    logger.info("Random hostname value is {0}".format(random_host))
    logger.info("Random username value is {0}".format(random_user))
    logger.info("Random MAC addresses value is {0}".format(random_mac))

    hive = "HKEY_LOCAL_MACHINE"
    registry_helper.write_registry(
        hive, "SYSTEM\CurrentControlSet\services\Tcpip\Parameters",
        "NV Hostname", RegistryKeyType.REG_SZ, random_host)
    registry_helper.write_registry(
        hive, "SYSTEM\CurrentControlSet\services\Tcpip\Parameters", "Hostname",
        RegistryKeyType.REG_SZ, random_host)
    registry_helper.write_registry(
        hive, "SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName",
        "ComputerName", RegistryKeyType.REG_SZ, random_host)
    registry_helper.write_registry(
        hive,
        "SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName",
        "ComputerName", RegistryKeyType.REG_SZ, random_host)
    registry_helper.write_registry(
        hive, "SOFTWARE\Microsoft\Windows NT\CurrentVersion",
        "RegisteredOwner", RegistryKeyType.REG_SZ, random_user,
        Wow64RegistryEntry.KEY_WOW32_64)
    dirname = os.path.join(os.path.dirname(__file__), "bin")
    print(dirname)
    volumeid_path = os.path.join(
        dirname,
        "VolumeID{0}.exe {1}".format("64" if random_utils.is_x64os() else "",
                                     random_utils.random_volume_id()))
    print(volumeid_path)
    os.system(volumeid_path)
Ejemplo n.º 2
0
def generate_hardware_fingerprint():
    """
    Generate hardware-related identifiers:
    HwProfileGuid
    MachineGuid
    Volume ID
    SusClientId
    SusClientIDValidation
    """

    hardware_fp = hardware_fingerprint.HardwareFingerprint()

    hive = "HKEY_LOCAL_MACHINE"
    # Hardware profile GUID

    logger.debug("Hardware Profiles\\0001 HwProfileGuid")
    registry_helper.write_value(
        key_hive=hive,
        key_path=
        "SYSTEM\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles\\0001",
        value_name="HwProfileGuid",
        value_type=RegistryKeyType.REG_SZ,
        key_value=hardware_fp.random_hw_profile_guid())

    # Machine GUID
    logger.debug("Microsoft\\Cryptography MachineGuid")
    registry_helper.write_value(key_hive=hive,
                                key_path="SOFTWARE\\Microsoft\\Cryptography",
                                value_name="MachineGuid",
                                value_type=RegistryKeyType.REG_SZ,
                                key_value=hardware_fp.random_machine_guid())

    # Windows Update GUID
    logger.debug("CurrentVersion\\WindowsUpdate SusClientId")
    registry_helper.write_value(
        key_hive=hive,
        key_path="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate",
        value_name="SusClientId",
        value_type=RegistryKeyType.REG_SZ,
        key_value=hardware_fp.random_win_update_guid())

    logger.debug("CurrentVersion\\WindowsUpdate SusClientIDValidation")
    registry_helper.write_value(
        key_hive=hive,
        key_path="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate",
        value_name="SusClientIDValidation",
        value_type=RegistryKeyType.REG_BINARY,
        key_value=random_utils.bytes_list_to_array(
            hardware_fp.random_client_id_validation()))

    dir_name = os.path.join(os.path.dirname(__file__), "bin")
    volume_id = random_utils.random_volume_id()
    logger.info("VolumeID={0}".format(volume_id))
    volume_id_path = os.path.join(
        dir_name, "VolumeID{0}.exe C: {1}".format("64" if is_x64os() else "",
                                                  volume_id))
    os.system(volume_id_path)

    logger.info("Random Hardware profile GUID {0}".format(
        hardware_fp.random_hw_profile_guid()))
    logger.info("Random Hardware CKCL GUID {0}".format(
        hardware_fp.random_performance_guid()))
    logger.info("Random Machine GUID {0}".format(
        hardware_fp.random_machine_guid()))
    logger.info("Random Windows Update GUID {0}".format(
        hardware_fp.random_win_update_guid()))
    logger.debug("Random Windows Update Validation ID {0}".format(
        hardware_fp.random_win_update_guid()))