From dacad5c88eddb27c60d1c8b73f4e9a8fafa1f2b2 Mon Sep 17 00:00:00 2001 From: kosta-dev <100292907+virtkot@users.noreply.github.com> Date: Tue, 27 May 2025 18:24:57 -0400 Subject: [PATCH] Create create_data_set.sh changed create_data_set.sh from py to sh --- examples/ransomware/create_data_set.sh | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 examples/ransomware/create_data_set.sh diff --git a/examples/ransomware/create_data_set.sh b/examples/ransomware/create_data_set.sh new file mode 100644 index 0000000..5f37100 --- /dev/null +++ b/examples/ransomware/create_data_set.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Usage: ./generate_random_files.sh + +set -e + +# Validate arguments +if [ $# -ne 3 ]; then + echo "Usage: $0 " + echo "Example: $0 1G 5 /tmp/output" + exit 1 +fi + +FILE_SIZE=$1 +COPY_COUNT=$2 +TARGET_DIR=$3 +SOURCE_FILE="${TARGET_DIR}/random_file_${FILE_SIZE}.txt" + +# Create target directory if it doesn't exist +mkdir -p "$TARGET_DIR" + +# Create base file with random characters +echo "Creating random file of size $FILE_SIZE at $SOURCE_FILE..." +< /dev/urandom tr -dc 'A-Za-z0-9!@#$%^&*()_+=-[]{}|:;<>,.?/~' | head -c "$FILE_SIZE" > "$SOURCE_FILE" + +# Copy file specified number of times +echo "Copying file $COPY_COUNT times to $TARGET_DIR..." + +for i in $(seq 1 "$COPY_COUNT"); do + cp "$SOURCE_FILE" "${TARGET_DIR}/copy_${i}.txt" + echo "Created copy_${i}.txt" +done + +echo "✅ Done: $COPY_COUNT files of size $FILE_SIZE each in $TARGET_DIR."