|
| 1 | +# CLI Tool Usage Guide |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +1. **Build the project first**: |
| 6 | + ```bash |
| 7 | + npm run build |
| 8 | + ``` |
| 9 | + |
| 10 | + This creates `dist/cli/index.js` from the TypeScript source. |
| 11 | + |
| 12 | +## Running the CLI |
| 13 | + |
| 14 | +### Method 1: Direct Node Execution (Recommended) |
| 15 | + |
| 16 | +Run the built CLI directly with Node: |
| 17 | + |
| 18 | +```bash |
| 19 | +node dist/cli/index.js <command> [options] |
| 20 | +``` |
| 21 | + |
| 22 | +### Method 2: Using npm link (Global Command) |
| 23 | + |
| 24 | +1. **Link the package**: |
| 25 | + ```bash |
| 26 | + npm link |
| 27 | + ``` |
| 28 | + |
| 29 | +2. **Run using the command name**: |
| 30 | + ```bash |
| 31 | + securegen <command> [options] |
| 32 | + ``` |
| 33 | + |
| 34 | +## Available Commands |
| 35 | + |
| 36 | +### 1. Generate Password (`pwd`) |
| 37 | + |
| 38 | +**Basic usage:** |
| 39 | +```bash |
| 40 | +node dist/cli/index.js pwd --len 16 |
| 41 | +``` |
| 42 | + |
| 43 | +**With options:** |
| 44 | +```bash |
| 45 | +node dist/cli/index.js pwd --len 20 --mode strong --lowercase --uppercase --digits --symbols |
| 46 | +``` |
| 47 | + |
| 48 | +**Options:** |
| 49 | +- `--len <number>` - Password length (required) |
| 50 | +- `--mode <mode>` - Mode: `strong`, `icloud`, `easyWrite`, `easySay`, `passphrase` |
| 51 | +- `--lowercase` - Include lowercase letters |
| 52 | +- `--uppercase` - Include uppercase letters |
| 53 | +- `--digits` - Include digits |
| 54 | +- `--symbols` - Include symbols |
| 55 | +- `--symbols-set <string>` - Custom symbol set |
| 56 | +- `--json` - Output in JSON format |
| 57 | + |
| 58 | +**Examples:** |
| 59 | +```bash |
| 60 | +# Strong password |
| 61 | +node dist/cli/index.js pwd --len 16 --mode strong --lowercase --uppercase --digits --symbols |
| 62 | + |
| 63 | +# iCloud-style password |
| 64 | +node dist/cli/index.js pwd --mode icloud |
| 65 | + |
| 66 | +# Easy to write password |
| 67 | +node dist/cli/index.js pwd --mode easyWrite --len 12 |
| 68 | + |
| 69 | +# Easy to say password |
| 70 | +node dist/cli/index.js pwd --mode easySay --syllables 3 |
| 71 | +``` |
| 72 | + |
| 73 | +### 2. Generate Passphrase (`passphrase`) |
| 74 | + |
| 75 | +**Usage:** |
| 76 | +```bash |
| 77 | +node dist/cli/index.js passphrase --words 6 --sep "-" |
| 78 | +``` |
| 79 | + |
| 80 | +**Options:** |
| 81 | +- `--words <number>` - Number of words (default: 6) |
| 82 | +- `--sep <string>` - Separator (default: " ") |
| 83 | +- `--capitalize` - Capitalize first letter of each word |
| 84 | +- `--add-digits` - Add digits at the end |
| 85 | +- `--json` - Output in JSON format |
| 86 | + |
| 87 | +**Examples:** |
| 88 | +```bash |
| 89 | +# Basic passphrase |
| 90 | +node dist/cli/index.js passphrase --words 6 |
| 91 | + |
| 92 | +# With separator and capitalization |
| 93 | +node dist/cli/index.js passphrase --words 6 --sep "-" --capitalize |
| 94 | + |
| 95 | +# With digits |
| 96 | +node dist/cli/index.js passphrase --words 6 --add-digits |
| 97 | +``` |
| 98 | + |
| 99 | +### 3. Generate iCloud Password (`icloud`) |
| 100 | + |
| 101 | +**Usage:** |
| 102 | +```bash |
| 103 | +node dist/cli/index.js icloud --count 5 |
| 104 | +``` |
| 105 | + |
| 106 | +**Options:** |
| 107 | +- `--count <number>` - Number of passwords to generate (default: 1) |
| 108 | +- `--json` - Output in JSON format |
| 109 | + |
| 110 | +**Example:** |
| 111 | +```bash |
| 112 | +node dist/cli/index.js icloud --count 5 |
| 113 | +``` |
| 114 | + |
| 115 | +### 4. Generate User ID (`userid`) |
| 116 | + |
| 117 | +**CVC Mode:** |
| 118 | +```bash |
| 119 | +node dist/cli/index.js userid --mode cvc --syllables 2 --count 10 |
| 120 | +``` |
| 121 | + |
| 122 | +**Words Mode:** |
| 123 | +```bash |
| 124 | +node dist/cli/index.js userid --mode words --words-count 2 --count 10 |
| 125 | +``` |
| 126 | + |
| 127 | +**Options:** |
| 128 | +- `--mode <mode>` - Mode: `cvc` or `words` (required) |
| 129 | +- `--syllables <number>` - Number of syllables (CVC mode, default: 2) |
| 130 | +- `--words-count <number>` - Number of words (Words mode, default: 2) |
| 131 | +- `--add-digits` - Add digits |
| 132 | +- `--digits-count <number>` - Number of digits (default: 2) |
| 133 | +- `--add-suffix` - Add suffix |
| 134 | +- `--suffix <string>` - Suffix text |
| 135 | +- `--max-length <number>` - Maximum length (default: 20) |
| 136 | +- `--count <number>` - Number of IDs to generate (default: 10) |
| 137 | +- `--json` - Output in JSON format |
| 138 | + |
| 139 | +**Examples:** |
| 140 | +```bash |
| 141 | +# CVC user IDs |
| 142 | +node dist/cli/index.js userid --mode cvc --syllables 2 --count 10 |
| 143 | + |
| 144 | +# Words user IDs |
| 145 | +node dist/cli/index.js userid --mode words --words-count 2 --count 10 |
| 146 | + |
| 147 | +# With digits and suffix |
| 148 | +node dist/cli/index.js userid --mode cvc --syllables 2 --add-digits --digits-count 3 --add-suffix --suffix "dev" --count 5 |
| 149 | +``` |
| 150 | + |
| 151 | +## JSON Output |
| 152 | + |
| 153 | +Add `--json` flag to any command for machine-readable output: |
| 154 | + |
| 155 | +```bash |
| 156 | +node dist/cli/index.js pwd --len 16 --json |
| 157 | +``` |
| 158 | + |
| 159 | +Output: |
| 160 | +```json |
| 161 | +{ |
| 162 | + "value": "xK9#mP2$vL8@nQ4", |
| 163 | + "entropy": 95.3, |
| 164 | + "crackTime": { |
| 165 | + "cpu": 1234567890, |
| 166 | + "rtx4090": 123456, |
| 167 | + "rig8x4090": 12345, |
| 168 | + "datacenter": 1234 |
| 169 | + } |
| 170 | +} |
| 171 | +``` |
| 172 | + |
| 173 | +## Hardware Profile for Crack Time |
| 174 | + |
| 175 | +The CLI uses the default hardware profile for crack time estimation. The output shows crack time for: |
| 176 | +- CPU |
| 177 | +- RTX 4090 |
| 178 | +- Rig (8x RTX 4090) |
| 179 | +- Datacenter |
| 180 | + |
| 181 | +## Quick Test |
| 182 | + |
| 183 | +After building, test the CLI: |
| 184 | + |
| 185 | +```bash |
| 186 | +# Test password generation |
| 187 | +node dist/cli/index.js pwd --len 16 |
| 188 | + |
| 189 | +# Test passphrase |
| 190 | +node dist/cli/index.js passphrase --words 6 |
| 191 | + |
| 192 | +# Test iCloud |
| 193 | +node dist/cli/index.js icloud |
| 194 | + |
| 195 | +# Test user ID |
| 196 | +node dist/cli/index.js userid --mode cvc --count 5 |
| 197 | +``` |
| 198 | + |
| 199 | +## Troubleshooting |
| 200 | + |
| 201 | +### "Cannot find module" error |
| 202 | +- Make sure you've run `npm run build` first |
| 203 | +- Check that `dist/cli/index.js` exists |
| 204 | + |
| 205 | +### "Permission denied" error |
| 206 | +- The CLI file should have execute permissions (added by build script) |
| 207 | +- If not, run: `chmod +x dist/cli/index.js` |
| 208 | + |
| 209 | +### "Command not found" (when using securegen) |
| 210 | +- Make sure you've run `npm link` first |
| 211 | +- Or use `node dist/cli/index.js` directly |
| 212 | + |
| 213 | +## Examples |
| 214 | + |
| 215 | +```bash |
| 216 | +# Generate a strong 20-character password |
| 217 | +node dist/cli/index.js pwd --len 20 --mode strong --lowercase --uppercase --digits --symbols |
| 218 | + |
| 219 | +# Generate 5 passphrases with dashes |
| 220 | +node dist/cli/index.js passphrase --words 6 --sep "-" --count 5 |
| 221 | + |
| 222 | +# Generate 10 CVC user IDs with 3 digits |
| 223 | +node dist/cli/index.js userid --mode cvc --syllables 2 --add-digits --digits-count 3 --count 10 |
| 224 | + |
| 225 | +# Get JSON output |
| 226 | +node dist/cli/index.js pwd --len 16 --json |
| 227 | +``` |
0 commit comments