136 lines
3.1 KiB
Markdown
136 lines
3.1 KiB
Markdown
# Rigol setup.stp Crypter
|
|
|
|
A utility for encrypting, decrypting, and parsing Rigol DG[89]00 Pro Arbitrary Waveform Generator `setup.stp`.
|
|
|
|
## Command-Line Options
|
|
|
|
```sh
|
|
usage: rigol_setup_crypter.py [-h] (-e | -d | -p) (-t INPUT_TEXT | -f INPUT_FILE) [-k CPU_SERIAL] [-o FILEPATH]
|
|
|
|
Encrypt or Decrypt Rigol DG[89]00 Pro setup.stp using the CPU SN.
|
|
|
|
options:
|
|
-h, --help show this help message and exit
|
|
-e, --encrypt Encrypt plain text data
|
|
-d, --decrypt Decrypt hex string data
|
|
-p, --parse Parse Rigol CSV data string
|
|
-t, --text INPUT_TEXT
|
|
Input data as text (Plain for Encrypt/Parse, Hex for Decrypt)
|
|
-f, --file INPUT_FILE
|
|
Path to read input data from file
|
|
-k, --key CPU_SERIAL CPU Serial Number (Required for -e/-d modes)
|
|
-o, --output FILEPATH
|
|
Optional path to save output. Console if omitted
|
|
```
|
|
|
|
## Setup and Workflow
|
|
|
|
### Prerequisites
|
|
|
|
1. Install ADB (Android Debug Bridge) on your system:
|
|
|
|
- **Linux**: `sudo apt install adb` (or equivalent for your distribution)
|
|
- **Windows**: Download and install [Android Platform Tools](https://developer.android.com/studio/releases/platform-tools)
|
|
|
|
2. Connect your Rigol AFG to your local network and note its IP address
|
|
|
|
### Extracting the Setup File
|
|
|
|
1. Connect to your device via ADB:
|
|
|
|
```
|
|
adb connect IP:55555
|
|
```
|
|
|
|
Replace `IP` with your device's IP address
|
|
|
|
2. Pull the setup file from the device:
|
|
|
|
```
|
|
adb pull /rigol/data/setup.stp
|
|
```
|
|
|
|
3. Read your CPU serial:
|
|
|
|
```
|
|
adb shell -- /rigol/shell/get_cpu_serial_num.sh
|
|
```
|
|
|
|
4. **IMPORTANT**: Create a backup of the original file:
|
|
```
|
|
cp setup.stp setup.stp.backup
|
|
```
|
|
|
|
### Modifying the Setup File
|
|
|
|
1. Decrypt the setup file:
|
|
|
|
```
|
|
python rigol_setup_crypter.py -d -f setup.stp -k YOUR_CPU_SERIAL -o setup.csv
|
|
```
|
|
|
|
Replace `YOUR_CPU_SERIAL` with your device's CPU serial number
|
|
|
|
2. Parse the file to better understand its structure:
|
|
|
|
```
|
|
python rigol_setup_crypter.py -p -f setup.csv
|
|
```
|
|
|
|
3. Edit the CSV file using a text editor of your choice
|
|
|
|
4. Verify your changes by parsing again:
|
|
|
|
```
|
|
python rigol_setup_crypter.py -p -f setup.csv
|
|
```
|
|
|
|
5. Encrypt the modified file:
|
|
```
|
|
python rigol_setup_crypter.py -e -f setup.csv -k YOUR_CPU_SERIAL -o setup.stp.new
|
|
```
|
|
|
|
### Uploading the Modified File
|
|
|
|
1. Push the modified file back to the device:
|
|
|
|
```
|
|
adb push setup.stp.new /rigol/data/setup.stp
|
|
```
|
|
|
|
2. Restart your device to apply the changes
|
|
|
|
```
|
|
adb shell -- reboot
|
|
```
|
|
|
|
## Examples
|
|
|
|
### Decrypt a setup file
|
|
|
|
```
|
|
python rigol_setup_crypter.py -d -f setup.stp -k d95ebe35672e20c2fc08 -o decrypted.csv
|
|
```
|
|
|
|
### Decrypt a text string and output to console
|
|
|
|
```
|
|
python rigol_setup_crypter.py -d -t "FBC6BDDB0E..." -k d95ebe35672e20c2fc08
|
|
```
|
|
|
|
### Parse a decrypted CSV
|
|
|
|
```
|
|
python rigol_setup_crypter.py -p -f decrypted.csv
|
|
```
|
|
|
|
### Encrypt a modified CSV
|
|
|
|
```
|
|
python rigol_setup_crypter.py -e -f modified.csv -k d95ebe35672e20c2fc08 -o new_setup.stp
|
|
```
|
|
|
|
## Warning
|
|
|
|
Keep a backup of the original `setup.csv`.
|