Generate an Unlimited Amount of VeraCrypt Containers

Introduction

This software will generate 100 VeraCrypt containers using a randomly generated 4 digit passcode. These passwords are then saved to the same folder in a file named passwords.lst.

The major goal of this software is to frustrate a digital forensics examination by overwhelming an investigator with encrypted containers. Even with the password.lst, each container will need to be mounted to check its contents and this will require trying passwords from the password list file.

The Code

Examine the parameters for the creation of the containers.

def create_veracrypt_image() -> None:
    """Creates a VeraCrypt hard drive image with a random name, size, and password.
    """
    image_path = get_container_name()
    size = get_random_size()
    password = get_password()

    command = [
        "c:\\Program Files\\VeraCrypt\\VeraCrypt Format.exe",
        "/create",
        image_path,
        "/size", size,
        "/password", password,
        "/hash", "sha512",
        "/encryption", "AES",
        "/filesystem", "EXFAT",
        "/silent"
    ]

    try:
        subprocess.run(command, check=True, capture_output=True, text=True)
        print("VeraCrypt image created successfully.")
        with open("passwords.lst", "a") as file:
            file.write(password + '\n')
            file.close()

    except subprocess.CalledProcessError as e:
        print(f"Error creating image: {e.stderr}")
  • This code constructs a list of instructions (command) that would tell VeraCrypt how to create the encrypted image. This includes:
    • The path to the VeraCrypt program itself.
    • The command to make a new image (/create).
    • Where to put the image file (image_path).
    • How big it should be (/size).
    • The password to lock it with (/password).
    • Technical details about encryption and file format (/hash/encryption/filesystem).
    • An instruction to be quiet (/silent).

In the next bit of code, see that the software will generate a random size.

def get_random_size() -> str:
    """Generates a random image size between 1M and 10M.

    Returns:
        str: Size with the 'M' suffix for megabytes (e.g., "7M").
    """
    size = str(random.randint(1, 10))
    return size + "M"

This code returns a random size string like “2M” or “8M” that could be used to tell another program how big a file should be.


The next function generates a random container name and appends .hc as the file extension, from lowercase alpha characters.

def get_container_name() -> str:
    """Generates a random container name ending in '.hc'.

    Returns:
        str: A 10-character random lowercase name with the '.hc' extension.
    """
    name_choices = "abcdefghijklmnopqrstuvwxyz"
    container_name = ""

    for i in range(0, 10):
        container_name += random.choice(name_choices)

    return container_name + ".hc"

The final function simply generates a 4-digit passcode.

def get_password() -> str:
    """Generates a random 4-digit numeric password.

    Returns:
        str: A 4-digit string representing the password.
    """
    return f"{random.randint(0000, 9999):04d}"

Downloads

GitHub

GitHub – Release x86_64 for Windows exe

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest article