4.7 KiB
Rigol setup.stp Crypter
A utility for encrypting, decrypting, and parsing Rigol DG[89]00 Pro Arbitrary Waveform Generator setup.stp.
HF flatness calibration example in hfflat_cal.py, thanks to zrq from EEVBlog.
Command-Line Options
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
-
Install Python 3
-
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
- Linux:
-
Connect your Rigol AFG to your local network and note its IP address
Extracting the Setup File
-
Connect to your device via ADB:
$ adb connect IP:55555Replace
IPwith your device's IP address -
Pull the setup file from the device:
$ adb pull /rigol/data/setup.stp -
Read your CPU serial:
$ adb shell -- /rigol/shell/get_cpu_serial_num.sh -
IMPORTANT: Create a backup of the original file:
$ cp setup.stp setup.stp.backup
Modifying the Setup File
For reference, here's what DG922 setup file could look like after correct modification:
$ ./rigol_setup_crypter.py -p -f ../databackup/data/setup.stp.decrypted
CSV header:
Manufacturer,InstrModel,InstrSN,CalibrationDate,SineMaxFreq,SquareMaxFreq,RampMaxFreq,PulseMaxFreq,ArbMaxFreq,HarmonicMaxFreq,MinFreq,HarmonicMinFreq,ARMSerial,MaxChannels,ArbWaveLenLicense,ArbWaveLenValidTime,DuoChanChannelValidTime
RIGOL TECHNOLOGIES,DG922 Pro,DG8P123456789,2023-11-11,200000000000000,60000000000000,5000000000000,50000000000000,50000000000000,100000000000000,1,1000,4b97ef24e77c4aeb933b,2,MEM,Forever,Forever
Instrument Information:
Manufacturer: RIGOL TECHNOLOGIES
Model: DG922 Pro
Serial Number: DG8P123456789
Calibration Date: 2023-11-11
ARM CPU Serial: 4b97ef24e77c4aeb933b
Max Channels: 2
Frequency Specifications:
Sine Max Frequency: 200000000000000 (200.000000 MHz)
Square Max Frequency: 60000000000000 (60.000000 MHz)
Ramp Max Frequency: 5000000000000 (5.000000 MHz)
Pulse Max Frequency: 50000000000000 (50.000000 MHz)
Arb Max Frequency: 50000000000000 (50.000000 MHz)
Harmonic Max Frequency: 100000000000000 (100.000000 MHz)
Min Frequency: 1 (1.000000e-12 MHz)
Harmonic Min Frequency: 1000 (1.000000e-09 MHz)
Licensing Information:
Arb Wavelength License: MEM (Memory Depth License)
Arb Wavelength Valid Time: Forever (Active (No Expiration))
Duo Channel Valid Time: Forever (Active (No Expiration))
-
Decrypt the setup file:
$ python rigol_setup_crypter.py -d -f setup.stp -k YOUR_CPU_SERIAL -o setup.csvReplace
YOUR_CPU_SERIALwith your device's CPU serial number -
Parse the file to better understand its structure:
$ python rigol_setup_crypter.py -p -f setup.csv -
Edit the CSV file using a text editor of your choice
-
Verify your changes by parsing again:
$ python rigol_setup_crypter.py -p -f setup.csv -
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
-
Push the modified file back to the device:
$ adb push setup.stp.new /rigol/data/setup.stp -
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`.