KWAJ Commands Reference
Purpose
Complete command-line reference for all KWAJ (Installation File) format operations. This document provides detailed syntax, options, and examples for the 3 KWAJ commands.
Concepts
KWAJ commands operate on installation file archives with support for multiple compression methods (none, XOR, SZDD, MSZIP). Each command handles filename embedding and metadata storage.
Command Overview
| Command | Purpose |
|---|---|
Extract KWAJ compressed file | |
Compress file to KWAJ format | |
Show KWAJ file information |
kwaj-extract - Extract KWAJ File
Extract (decompress) a KWAJ compressed file.
Parameters
FILE-
(required) Path to the KWAJ file to extract
OUTPUT-
(optional) Output file path (auto-detected from embedded filename if not specified)
Options
--output, -o-
Output file path (alternative to positional argument)
--verbose, -v-
Show extraction progress
Returns
-
Exit code 0 on success
-
Exit code 1 on error
-
Exit code 3 if file not found
-
Exit code 4 if permission denied
Description
The kwaj-extract command decompresses KWAJ files using the compression method stored in the header. If the KWAJ file contains an embedded filename, it will be used as the output filename when not explicitly specified.
Examples
cabriolet kwaj-extract setup.kwjExtracted setup.kwj to setup.exe (1,048,576 bytes)cabriolet kwaj-extract setup.kwj output.execabriolet kwaj-extract --verbose setup.kwjExtracting setup.kwj -> setup.exe
Compression: MSZIP
Data offset: 64 bytes
Uncompressed size: 1,048,576 bytes
Original filename: setup.exe
Decompressing...
Progress: 100%
Extracted setup.kwj to setup.exe (1,048,576 bytes)cabriolet kwaj-extract -o extracted.exe data.kwjfor file in *.kwj; do
cabriolet kwaj-extract "$file"
doneCommon Errors
-
Invalid KWAJ signature: File is not a valid KWAJ file
-
Unsupported compression type: Unknown compression method
-
Decompression failed: Compressed data is corrupted
-
Missing filename in header: Output filename must be specified
kwaj-compress - Compress to KWAJ Format
Compress a file to KWAJ format with configurable compression method.
Parameters
FILE-
(required) Path to the file to compress
OUTPUT-
(optional) Output file path (default:
<filename>.kwj)
Options
--output, -o-
Output file path (alternative to positional argument)
--compression=METHOD-
Compression method:
none,xor,szdd,mszip(default:szdd) --include-length-
Include uncompressed length in header
--filename=NAME-
Original filename to embed in header
--extra-data=DATA-
Extra metadata to include in header
--verbose, -v-
Show compression progress
Returns
-
Exit code 0 on success
-
Exit code 1 on error
-
Exit code 3 if source file not found
-
Exit code 4 if permission denied
Description
The kwaj-compress command creates KWAJ compressed files with configurable compression method and optional metadata embedding.
Examples
cabriolet kwaj-compress setup.exe setup.kwjCompressed setup.exe to setup.kwj (524,288 bytes, szdd compression)cabriolet kwaj-compress --compression=mszip setup.exe setup.kwjcabriolet kwaj-compress --filename=setup.exe --include-length data.bin data.kwjcabriolet kwaj-compress --compression=none data.bin data.kwjcabriolet kwaj-compress --extra-data="Version: 1.0.0" setup.exe setup.kwjcabriolet kwaj-compress --verbose --compression=mszip setup.exe setup.kwjCompressing setup.exe -> setup.kwj (mszip compression)
Original size: 1,048,576 bytes
Including filename: setup.exe
Including length: yes
Compressing with MSZIP...
Progress: 100%
Compressed: 524,288 bytes
Ratio: 50.0%
Compressed setup.exe to setup.kwj (524,288 bytes, mszip compression)for file in dist/*.exe; do
base=$(basename "$file")
cabriolet kwaj-compress \
--compression=mszip \
--filename="$base" \
--include-length \
"$file" \
"compressed/${base}.kwj"
doneCommon Errors
-
Source file not found: Verify input file path
-
Cannot create output file: Check write permissions and disk space
-
Compression failed: Input file may be unreadable
-
Invalid compression method: Use none, xor, szdd, or mszip
kwaj-info - Show KWAJ Information
Display detailed information about a KWAJ file.
Description
The kwaj-info command displays metadata about a KWAJ file, including compression method, data offset, embedded filename, and extra data.
Examples
cabriolet kwaj-info setup.kwjKWAJ File Information
==================================================
Filename: setup.kwj
Compression: MSZIP
Data offset: 64 bytes
Uncompressed size: 1,048,576 bytes
Original filename: setup.exe
Extra data: 16 bytes
Version: 1.0.0.0cabriolet kwaj-info data.kwjKWAJ File Information
==================================================
Filename: data.kwj
Compression: SZDD
Data offset: 12 bytes
Uncompressed size: unknowncabriolet kwaj-info --verbose setup.kwjKWAJ File Information
==================================================
Filename: setup.kwj
File size: 524,288 bytes
Header:
Signature: KWAJ (0x4B 0x57 0x41 0x4A)
Compression type: 3 (MSZIP)
Data offset: 64 bytes
Flags: filename, length
Compression: MSZIP (DEFLATE-based)
Uncompressed size: 1,048,576 bytes
Original filename: setup.exe (9 bytes)
Extra data: 16 bytes
Hex: 56 65 72 73 69 6F 6E 3A 20 31 2E 30 2E 30 2E 30
Text: Version: 1.0.0.0
Compression Statistics:
Compressed size: 524,288 bytes
Uncompressed size: 1,048,576 bytes
Compression ratio: 50.0%
Space saved: 524,288 bytes (50.0%)for file in *.kwj; do
echo "=== $file ==="
cabriolet kwaj-info "$file"
echo
doneGlobal Options
All KWAJ commands support these global options:
--verbose, -v-
Enable verbose output with detailed progress
--help, -h-
Display command help
--version-
Show Cabriolet version
See Global Options for complete details.
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | General error |
2 | Invalid arguments |
3 | File not found |
4 | Permission denied |
5 | Corrupt file |
6 | Unsupported format |
Compression Methods
| Method | Description | Use Case |
|---|---|---|
none | No compression | Pre-compressed files, testing |
xor | Simple XOR obfuscation | Minimal obfuscation, very fast |
szdd | LZSS compression | Good for text files, balanced |
mszip | DEFLATE compression | Best ratio, general purpose |
Common Workflows
Extract Installation Files
# Extract all KWAJ files from installer
mkdir -p extracted
for file in installer/*.kwj; do
cabriolet kwaj-extract "$file" "extracted/$(basename "$file" .kwj)"
doneCreate Installer Package
# Compress installation files with metadata
version="2.1.0"
for file in dist/*; do
base=$(basename "$file")
cabriolet kwaj-compress \
--compression=mszip \
--filename="$base" \
--include-length \
--extra-data="Version: $version" \
"$file" \
"installer/${base}.kwj"
doneVerify Package Integrity
# Check all KWAJ files before distribution
echo "Verifying KWAJ package..."
for file in package/*.kwj; do
if ! cabriolet kwaj-info "$file" > /dev/null 2>&1; then
echo "ERROR: Invalid file: $file"
exit 1
fi
done
echo "All files verified successfully"Convert Between Compression Methods
# Convert SZDD to MSZIP for better compression
for file in *.kwj; do
# Extract
cabriolet kwaj-extract "$file" temp.dat
# Re-compress with MSZIP
cabriolet kwaj-compress \
--compression=mszip \
--filename="$(basename "$file" .kwj)" \
temp.dat \
"optimized/$file"
rm temp.dat
doneNext steps
-
Review Basic Usage Guide for usage examples
-
Study Ruby API Reference for Ruby integration
-
Learn about compression algorithms