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_network_fingerprint():
    """
    Generate network-related identifiers:
    Hostname (from pre-defined list)
    Username (from pre-defined list)
    MAC address (from pre-defined list)
    """
    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"
    logger.debug("Tcpip\\Parameters NV Hostname={0}".format(random_host))
    registry_helper.write_value(
        key_hive=hive,
        key_path="SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters",
        value_name="NV Hostname",
        value_type=RegistryKeyType.REG_SZ,
        key_value=random_host)

    logger.debug("Tcpip\\Parameters Hostname={0}".format(random_host))
    registry_helper.write_value(
        key_hive=hive,
        key_path="SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters",
        value_name="Hostname",
        value_type=RegistryKeyType.REG_SZ,
        key_value=random_host)

    logger.debug("Tcpip\\Parameters ComputerName={0}".format(random_host))
    registry_helper.write_value(
        key_hive=hive,
        key_path=
        "SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName",
        value_name="ComputerName",
        value_type=RegistryKeyType.REG_SZ,
        key_value=random_host)

    logger.debug("ComputerName\\ActiveComputerName ComputerName={0}".format(
        random_host))
    registry_helper.write_value(
        key_hive=hive,
        key_path=
        "SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName",
        value_name="ComputerName",
        value_type=RegistryKeyType.REG_SZ,
        key_value=random_host)

    logger.debug(
        "Windows NT\\CurrentVersion RegisteredOwner={0}".format(random_user))
    registry_helper.write_value(
        key_hive=hive,
        key_path="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
        value_name="RegisteredOwner",
        value_type=RegistryKeyType.REG_SZ,
        key_value=random_user,
        access_type=Wow64RegistryEntry.KEY_WOW32_64)