Author Topic: Siglent ADS Firmware Toolkit  (Read 734 times)

0 Members and 1 Guest are viewing this topic.

Offline optotesterTopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: be
Siglent ADS Firmware Toolkit
« on: June 25, 2024, 03:39:11 pm »
Hi everyone,

A lot of information is available on this forum on the Siglent ADS firmware format. However, most of the information is highly technical and there is no ready-made solution to analyze ADS files. At first, I wanted to do a very basic tool but at the end I decided to go one step further and provide a tool to analyze, extract and rebuild ADS files. It is not universal, but it should help customize most ADS files.

Important information:
- If the tool reports a checksum mismatch do not even try to run the ADS file, it is not compatible.
- If you are not super-expert, do not even try to alter the filesystem of the device
- The decryption key is not provided (but the tool should be able to retrieve it using the -f flag. It is shared between several devices, so if it cannot be extracted from your file (e.g. for SDS800X HD), you can extract it from the ADS of another device).

ADS toolkit works even for recent scope like SDS2000X HD and SDS3000X HD.
This should allow people interested in modding these great scopes to build new customizations (e.g. developing a new PHP Web UI).
For now, it is Windows only but I may compile a Linux version later.

Disclaimer: I am not responsible/liable for any issue caused by the use of this software (e.g. devices bricked). Please note that this tool is compatible with most recent ADS file, but not necessarily all of them. You should not use this tool blindly, you should see this tool as an helper and you should be able to verify if the output matches your expectations.
In addition, If you gain access to terminal (e.g. through a custom update.sh script), please perform a full backup first (although you may never be able to restore it if you brick your device !).


Credits: this tool has been inspired by the huge work performed by janekivi and tv84.

Regards

Code: [Select]
usage: ADS Toolkit [-h] [-v] [-o OUTPUT] [-s SECTION] [-p PAYLOAD] [-u] [-k KEY] [-x | -r | -f] filename

Extract and rebuild ADS file. By default, zip files are reprocessed to ensure best compatibility. Reprocessing a .zip
does not retain UNIX permissions, if required, use the -u flag.

positional arguments:
  filename              ADS file

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -o OUTPUT, --output OUTPUT
                        output file
  -s SECTION, --section SECTION
                        ID of the section to be extracted/replaced. In extract mode, all sections are extracted if
                        omitted.
  -p PAYLOAD, --payload PAYLOAD
                        new payload (replace mode only)
  -u, --unaltered       do not reprocess .zip payloads (replace mode only). Default is to reprocess replaced .zip
                        sections to maximize compatibility.
  -k KEY, --key KEY     key used for 3DES encryption/decryption (string of 32 hex characters)
  -x, --extract         extract section
  -r, --replace         replace section
  -f, --findkey         try find 3DES key - this is only possible if the main app is in the unencrypted area of the
                        ADS file

Disclaimer: The author of this tool discharges of any liability/responsibility in regards to the usage of this tool.
This tool is an helper, manual check of the output shall still be performed. This tool can cause devices to be
permanently bricked.

Changelog
- 25 Jun 2024 - clarified scope of use and risks
- 26 Jun 2024 - update to version 1.1.0 adding the find key option. Source is now provided (Python 3.10+ required) as the packaged versions did trigger false-positive warnings on Virustotal
- 26 Jun 2024 - removed (https://www.eevblog.com/forum/testgear/siglent-ads-firmware-toolkit/msg5554955/#msg5554955)
« Last Edit: June 26, 2024, 03:16:24 pm by optotester »
 
The following users thanked this post: egonotto

Offline egonotto

  • Frequent Contributor
  • **
  • Posts: 810
Re: Siglent ADS Firmware Toolkit
« Reply #1 on: June 25, 2024, 03:51:43 pm »
Virus warning?
 

Offline optotesterTopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: be
Re: Siglent ADS Firmware Toolkit
« Reply #2 on: June 25, 2024, 04:02:31 pm »
You are getting a virus warning or is it a question ?
I do not see any behaviour in the tool that could trigger a virus warning.
It is python compiled with nuitka and it only uses very basic libraries (no os/network library).
If you have any doubt you can still run it in a VM.
 
The following users thanked this post: egonotto

Offline egonotto

  • Frequent Contributor
  • **
  • Posts: 810
Re: Siglent ADS Firmware Toolkit
« Reply #3 on: June 25, 2024, 04:16:51 pm »
Hello,

thanks.

I was not allowed to download the file with Edge with firefox I got the file, but when unzipping I got a virus warning again.

At Virustotal I got the following information:
"4/72 security vendors and no sandboxes flagged this file as malicious"

Best regards
egonotto
 

Offline egonotto

  • Frequent Contributor
  • **
  • Posts: 810
Re: Siglent ADS Firmware Toolkit
« Reply #4 on: June 25, 2024, 04:31:16 pm »
Hello,

I tried, but there were errors:

E:\>adstoolkit -x 9999.ADS
Python path configuration:
  PYTHONHOME = 'C:\ProgramData\miniconda3'
  PYTHONPATH = (not set)
  program name = 'adstoolkit.exe'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 0
  is in build tree = 0
  stdlib dir = 'C:\ProgramData\miniconda3\Lib'
  sys._base_executable = 'E:\\adstoolkit.exe'
  sys.base_prefix = 'C:\\ProgramData\\miniconda3'
  sys.base_exec_prefix = 'C:\\ProgramData\\miniconda3'
  sys.platlibdir = 'DLLs'
  sys.executable = 'E:\\adstoolkit.exe'
  sys.prefix = 'C:\\ProgramData\\miniconda3'
  sys.exec_prefix = 'C:\\ProgramData\\miniconda3'
  sys.path = [
    'C:\\Users\\m\\AppData\\Local\\Programs\\Python\\Python311\\python311.zip',
    'C:\\ProgramData\\miniconda3\\Lib',
    'C:\\ProgramData\\miniconda3\\DLLs',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00002340 (most recent call first):
  <no Python frame>

Best regards
egonotto
 

Offline optotesterTopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: be
Re: Siglent ADS Firmware Toolkit
« Reply #5 on: June 25, 2024, 04:34:22 pm »
Thanks for reporting, apparently it is "normal" when using nuitka as a packer:
https://github.com/Nuitka/Nuitka/issues/2163#issuecomment-1504683673

To be honest, this is a first time I use nuitka as a packer, i used pyinstaller before but the output file was huge in comparison, as it embeds Python + the libraries. Nuitka convert to C which makes it much more efficient. I can promise that I did not add any malicious code on purpose, but at the same time, as I have no idea about what nuitka do as a compiler, I can only advise to run it in a VM to be 100% safe.

For now, I am not sharing the code to avoid triggering a complete change of the format used, as occurred when the Siglent keygen was shared and triggered a change to a new licensing system.
 
The following users thanked this post: egonotto

Offline optotesterTopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: be
Re: Siglent ADS Firmware Toolkit
« Reply #6 on: June 25, 2024, 04:39:41 pm »
Regarding the error above, indeed the version initially posted required Miniconda 3.11 as I did not use the --standalone option in nuitka :).
Just recompiled it as standalone, it should work now.
« Last Edit: June 25, 2024, 04:41:50 pm by optotester »
 
The following users thanked this post: egonotto

Offline egonotto

  • Frequent Contributor
  • **
  • Posts: 810
Re: Siglent ADS Firmware Toolkit
« Reply #7 on: June 25, 2024, 05:01:11 pm »
Hello,

thanks, I installed Miniconda but that also gave errors.
Downloading adstoolkit_standalone.zip was also difficult. Also the execution was prevented at the beginning.
At the end there was an error message:
"SUCCESS: ADS file successfully extracted.
Traceback (most recent call last):
  File "C:\Users\m\AppData\Local\Temp\ONEFIL~1\adstoolkit.py", line 157, in <module>
NameError: name 'exit' is not defined"

Here is the opinion of VirusTotal.

Best regards
egonotto

 

Offline tv84

  • Super Contributor
  • ***
  • Posts: 3254
  • Country: pt
Re: Siglent ADS Firmware Toolkit
« Reply #8 on: June 25, 2024, 05:34:41 pm »
A lot of information is available on this forum on the Siglent ADS firmware format. However, most of the information is highly technical and there is no ready-made solution to analyze ADS files. At first, I wanted to do a very basic tool but at the end I decided to go one step further and provide a tool to analyze, extract and rebuild ADS files.

You didn't read some important info: there are a lot of subtypes of .ADS files. You are dealing with just one of them.

Please make this info clear to the users.

Providing such a tool, with an explicit warranty disclaimer, will inevitably lead some people into trouble.

IMO, more quickly will a guy brick his scope than anyone will ever introduce a new PHP feature...
 
The following users thanked this post: rf-loop, egonotto, tautech, 2N3055, Martin72, dibro, hip

Offline optotesterTopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: be
Re: Siglent ADS Firmware Toolkit
« Reply #9 on: June 25, 2024, 06:36:28 pm »
You didn't read some important info: there are a lot of subtypes of .ADS files. You are dealing with just one of them.

Please make this info clear to the users.

Providing such a tool, with an explicit warranty disclaimer, will inevitably lead some people into trouble.

IMO, more quickly will a guy brick his scope than anyone will ever introduce a new PHP feature...

I think it is a good point, I did already put a disclaimer but just made it more clear after your comment :). I tried to add as many safeguards I could in the tool itself, if you try using it on an unsupported file, it will report a checksum error. It is not a magic tool either, more a helper.

I do agree that there is a high chance people may brick their scope, but at the same time, I think that everyone is responsible for their choices. I have been hesitating a bit if I should or should not release it, but at the end, I thought it was better to work as a community to try bringing more features, even if people will for sure do mistakes.
 
The following users thanked this post: egonotto

Offline tv84

  • Super Contributor
  • ***
  • Posts: 3254
  • Country: pt
Re: Siglent ADS Firmware Toolkit
« Reply #10 on: June 25, 2024, 08:50:44 pm »
I do agree that there is a high chance people may brick their scope, but at the same time, I think that everyone is responsible for their choices. I have been hesitating a bit if I should or should not release it, but at the end, I thought it was better to work as a community to try bringing more features, even if people will for sure do mistakes.

I understand but that's where I disagree.

As you most probably know, I've been doing (all subtypes of) .ADS packages for many years, some of them at the request of users in the forum. All were supervised or filtered by me. I try my very best to not let people (un)willingly brick their devices in all the things I share.
 
The following users thanked this post: rf-loop, KeBeNe, egonotto, tautech, KungFuJosh, Martin72, dibro, dexar, hip

Offline Martin72

  • Super Contributor
  • ***
  • Posts: 6138
  • Country: de
  • Testfield Technician
Re: Siglent ADS Firmware Toolkit
« Reply #11 on: June 25, 2024, 10:19:27 pm »
Quote
I try my very best to not let people (un)willingly brick their devices in all the things I share.

This cannot be emphasized enough to pay tribute to it. :-+

 
The following users thanked this post: egonotto, KungFuJosh

Offline optotesterTopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: be
Re: Siglent ADS Firmware Toolkit
« Reply #12 on: June 26, 2024, 11:00:56 am »
Hello,

thanks, I installed Miniconda but that also gave errors.
Downloading adstoolkit_standalone.zip was also difficult. Also the execution was prevented at the beginning.
At the end there was an error message:
"SUCCESS: ADS file successfully extracted.
Traceback (most recent call last):
  File "C:\Users\m\AppData\Local\Temp\ONEFIL~1\adstoolkit.py", line 157, in <module>
NameError: name 'exit' is not defined"

Here is the opinion of VirusTotal.

Best regards
egonotto
I removed the packaged version and released the python source code at the end. The 3 files must be extracted in the same folder. It seems that all Python packager (pyinstaller or nuitka) will trigger tons of false-positive on VirusTotal as it is extensively used to pack malware too.

You will see that even now, 7za.exe is detected as a malware by some random antivirus, even if it is the official version downloaded from https://www.7-zip.org/a/7z2407-extra.7z (you can compare checksums).
 
The following users thanked this post: egonotto

Offline Bicurico

  • Super Contributor
  • ***
  • Posts: 1734
  • Country: pt
    • VMA's Satellite Blog
Re: Siglent ADS Firmware Toolkit
« Reply #13 on: June 26, 2024, 01:34:18 pm »
I agree with tv84.

There are (non-public) *.ADS tools, as well as, keygens for Siglent.

Two reasons they were not published:

1) To not harm Siglent: their products are actively being sold and Siglent makes money from activating the options.
2) To prevent users from bricking their devices.

A keygen was, meanwhile, published by someone and so far Siglent did not complain - this can change in future (i.e. new devices using a new key mechanism).
Now a *.ADS file was published - let's wait if people come asking for advise to unbrick their devices.
 
The following users thanked this post: egonotto

Offline TomKatt

  • Frequent Contributor
  • **
  • Posts: 441
  • Country: us
Re: Siglent ADS Firmware Toolkit
« Reply #14 on: June 26, 2024, 01:52:26 pm »
I agree with tv84.

There are (non-public) *.ADS tools, as well as, keygens for Siglent.

Two reasons they were not published:

1) To not harm Siglent: their products are actively being sold and Siglent makes money from activating the options.
2) To prevent users from bricking their devices.

A keygen was, meanwhile, published by someone and so far Siglent did not complain - this can change in future (i.e. new devices using a new key mechanism).
Now a *.ADS file was published - let's wait if people come asking for advise to unbrick their devices.
This is the same reason I did not repeat the Utility->Debug pw when I inquired about the Debug menu options on my SDS800X HD...  There's nothing in that menu that's useful for the average user and a lot of potential to either brick the scope or delete it's calibration data (rendering it useless).  I'm sure that many others here are just as curious as I am, but when it's suggested to me to leave something alone by people I respect then I figure it's in my best interest to do so.  The minute Siglent incurs a massive increase in support requests by people who accidentally damaged their scope because they were in locked service menus is probably the time Siglent rethinks their stance on the whole 'hacking' topic.  And I for one am grateful that they continue to allow this as they do.
Several Species of Small Furry Animals Gathered Together in a Cave and Grooving with a PIC
 
The following users thanked this post: egonotto

Offline egonotto

  • Frequent Contributor
  • **
  • Posts: 810
Re: Siglent ADS Firmware Toolkit
« Reply #15 on: June 26, 2024, 02:41:02 pm »
Hello,

when I try to download adstoolkit_1.1.0.zip I get the follow error message:
"
An Error Has Occurred!
You are not allowed to access this section
"

Best regards
egonotto
 

Offline optotesterTopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: be
Re: Siglent ADS Firmware Toolkit
« Reply #16 on: June 26, 2024, 02:50:59 pm »
Contrarily to a keygen, which indeed allows to enable paid options, the idea was more to provide ability to really develop new features for these scope (mostly on the Web UI side, as for sure nobody will ever mod a binary app). I think the Web UI of Siglent devices has (a lot) of room for improvement.

I truly thought it would have been beneficial to allow the community to have full control over their devices, but I do get your points. Since there is a consensus in saying that this tool is too dangerous, I am removing it.

@egonotto, most probably file was already removed when you clicked the link.
 
The following users thanked this post: egonotto, tv84


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf