[Tool] Samloader (SamFirm / Frija replacement)

Search This thread

raakaysh

Senior Member
Jan 15, 2009
398
449
Nowhere in India
Hi OP, I installed Python and PIP3 but when I try 'samloader checkupdate SM-G980F BTU', I get this:

The term 'samloader' is not recognized as the name of a cmdlet...

How to fix it?
 
Last edited:
Hi OP, I installed Python and PIP3 but when I try 'samloader checkupdate SM-G980F BTU', I get this:

PS C:\Users\Rakesh Shukla\Desktop\samloader-master> samloader checkupdate SM-G980F BTU
samloader : The term 'samloader' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ samloader checkupdate SM-G980F BTU
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (samloader:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

How to fix it?

Add it to your command search path.
 

RKSTN

Member
Dec 2, 2020
12
2
When I tried to check for update I am getting not a recognized message in cmd. I have already installed Python and Pip. Help?
 

Sprotznock

New member
Mar 25, 2017
2
0
Thanks for this tool. Downloading worked well, but unfortunately decryption fails for me.

It looks that samloader sends a bad request to get the decryption key (http response code is 400). I added debug output of the response XML file and got this:

% python3 -m samloader -m SM-G975F -r DBT decrypt -v G973FXXU9DTJA/G973FOXM9DTJB/G973FXXU9DTJA/G973FXXU9DTJA -V 4 -i SM-G973F_1_20201028155733_c2t0wwhgfn_fac.zip.enc4 -o SM-G973F_1_20201028155733_c2t0wwhgfn_fac.zip

<?xml version="1.0" encoding="utf-8" ?>
<FUSMsg>
<FUSHdr>
<ProtoVer>1.0</ProtoVer>
<SessionID></SessionID>
<MsgID>1</MsgID>
</FUSHdr>
<FUSBody>
<Results>
<CmdRef>2</CmdRef>
<Status>400</Status>
</Results>
</FUSBody>
</FUSMsg>

Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/joern/.local/lib/python3.6/site-packages/samloader/__main__.py", line 6, in <module>
main()
File "/home/joern/.local/lib/python3.6/site-packages/samloader/main.py", line 58, in main
key = getkey(args.fw_ver, args.dev_model, args.dev_region)
File "/home/joern/.local/lib/python3.6/site-packages/samloader/crypt.py", line 23, in getv4key
fwver = root.find("./FUSBody/Results/LATEST_FW_VERSION/Data").text
AttributeError: 'NoneType' object has no attribute 'text'


Any idea what I can do here?

Thanks!
 

RKSTN

Member
Dec 2, 2020
12
2
Also works with Termux!

How to:
First enable the storage permission for Termux in "Settings > Apps > Termux > Permissions > Storage".
Now set up Termux to install Samloader with commands below.
Code:
pkg upgrade
pkg install git
pkg install python
pip install --upgrade pip
Now you can install Samloader
Code:
pip3 install git+https://github.com/nlscc/samloader.git
To update Samloader
Code:
pip3 install --upgrade git+https://github.com/nlscc/samloader.git

Example:
Check update
Code:
samloader -m SM-G975F -r NZC checkupdate
Download
Code:
samloader -m SM-G975F -r NZC download -v G975FXXS9DTI8/G975FOXM9DTI8/G975FXXS9DTI8/G975FXXS9DTI8 -O /storage/emulated/0/Download/
Decrypt
Code:
samloader -m SM-G975F -r NZC decrypt -v G975FXXS9DTI8/G975FOXM9DTI8/G975FXXS9DTI8/G975FXXS9DTI8 -V 4 -i /storage/emulated/0/Download/SM-G975F_1_20200921075534_uii8oafhih_fac.zip.enc4 -o /storage/emulated/0/Download/SM-G975F_1_20200921075534_uii8oafhih_fac.zip

Great info! I tried these steps but was getting a problem installing Python in Termux. Just found a tutorial and fixed the issue.


Thanks a lot for these instructions. :)
 

RKSTN

Member
Dec 2, 2020
12
2
Thanks for this tool. Downloading worked well, but unfortunately decryption fails for me.

It looks that samloader sends a bad request to get the decryption key (http response code is 400). I added debug output of the response XML file and got this:

% python3 -m samloader -m SM-G975F -r DBT decrypt -v G973FXXU9DTJA/G973FOXM9DTJB/G973FXXU9DTJA/G973FXXU9DTJA -V 4 -i SM-G973F_1_20201028155733_c2t0wwhgfn_fac.zip.enc4 -o SM-G973F_1_20201028155733_c2t0wwhgfn_fac.zip

<?xml version="1.0" encoding="utf-8" ?>
<FUSMsg>
<FUSHdr>
<ProtoVer>1.0</ProtoVer>
<SessionID></SessionID>
<MsgID>1</MsgID>
</FUSHdr>
<FUSBody>
<Results>
<CmdRef>2</CmdRef>
<Status>400</Status>
</Results>
</FUSBody>
</FUSMsg>

Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/joern/.local/lib/python3.6/site-packages/samloader/__main__.py", line 6, in <module>
main()
File "/home/joern/.local/lib/python3.6/site-packages/samloader/main.py", line 58, in main
key = getkey(args.fw_ver, args.dev_model, args.dev_region)
File "/home/joern/.local/lib/python3.6/site-packages/samloader/crypt.py", line 23, in getv4key
fwver = root.find("./FUSBody/Results/LATEST_FW_VERSION/Data").text
AttributeError: 'NoneType' object has no attribute 'text'


Any idea what I can do here?

Thanks!
Was the firmware download interrupted? This might be because the file is broken.
 
Jan 22, 2020
24
13
Moto E6s
Moto G Play
FKN AWESOMEEEEE :cool: :cool: :cool: working on mint GENIUS WORK!!!!!
Captura de pantalla de 2021-02-09 19-59-26.png
 

vanquish28

Member
Sep 26, 2019
5
1
Working, but you have to change the decript version flag in the py command from 2 to 4, also for the model use XX-XXXX characters instead of XX-XXXX. I opened the issue at https://github.com/nlscc/samloader/issues/43.


/usr/bin/python3.8 /home/vanquish/.local/bin/samloader -m SM-T970 -r XAR checkupdate
T970XXU1BUAA/T970OXM1BUAA/T970XXU1BUAA/T970XXU1BUAA

/usr/bin/python3.8 /home/vanquish/.local/bin/samloader -m SM-T970 -r XAR download -v T970XXU1BUAA/T970OXM1BUAA/T970XXU1BUAA/T970XXU1BUAA -O .

downloading SM-T970_1_20210121210134_84ml313a23_fac.zip.enc4
[################################] 109073/109073 - 00:10:04



/usr/bin/python3.8 /home/vanquish/.local/bin/samloader -m SM-T970 -r XAR decrypt -v T970XXU1BUAA/T970OXM1BUAA/T970XXU1BUAA/T970XXU1BUAA -V 4 -i SM-T970_1_20210121210134_84ml313a23_fac.zip.enc4 -o SM-T970_1_20210121210134_84ml313a23_fac.zip

[################################] 1745162/1745162 - 00:00:27


unzip SM-T970_1_20210121210134_84ml313a23_fac.zip
Archive: SM-T970_1_20210121210134_84ml313a23_fac.zip
inflating: BL_T970XXU1BUAA_CL20748183_QB37638525_REV00_user_low_ship_MULTI_CERT.tar.md5
inflating: AP_T970XXU1BUAA_CL20748183_QB37638525_REV00_user_low_ship_MULTI_CERT_meta_OS11.tar.md5
inflating: HOME_CSC_OMC_OXM_T970OXM1BUAA_CL20748183_QB37638525_REV00_user_low_ship_MULTI_CERT.tar.md5
inflating: CSC_OMC_OXM_T970OXM1BUAA_CL20748183_QB37638525_REV00_user_low_ship_MULTI_CERT.tar.md5
 
  • Like
Reactions: Pasio47DBG

geronimoge

Senior Member
Aug 4, 2016
516
129
I tried installing with the command found in the readme file
Code:
pip3 install git+https://github.com/nlscc/samloader.git
But when I type
Code:
$ samloader --help
It says "samloader: command not found"
Problems with "samloader: command not found" and Linux?
Try
$ python3 -m samloader
instead of using
$ samloader
as written here.
For me it helped.
So for example
$ python3 -m samloader --help
 
  • Like
Reactions: Primokorn
Hey, what is "region" ? I'm guessing it a "country" -region ?
In the Github readme page it's using "BTU" as an example, but what is BTU ? How do I define this variable ? Is there a list ?
I'm using Samsung Japanese version btw.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 35
    Hello,
    I recently wanted to download some firmware for my Samsung device, but I realized that there is no 100% open source program to do so. In fact, all the tools that claim to do so require a library that is packed by Themida (so it is difficult to check what this might be doing), in order to authenticate to the server. This is a native DLL, meaning that it is only compatible with Windows x86. Additionally, many of these tools are actually using stolen decompiled code from SamFirm, which, apart from being possibly illegal, means they would be difficult to maintain and run slowly.
    So, I decided to reverse engineer Smart Switch to figure out exactly how the download is taking place, and wrote a cross-platform tool that does this without using the Windows DLL that the other tools have, making it compatible with Linux and MacOS. I also realized that the newer versions are actually using a new version of the authentication algorithm, meaning possibly at some point the old tools might stop working as Samsung drops support for it.
    You can find it at:
    Code:
    https://github.com/nlscc/samloader
    To install, go to the downloaded repository and run:
    Code:
    pip3 install .
    See the README or look at the code for usage. You might want to know that my old github account, nm111, was unfortunately deleted, and I lost access to my old XDA account. You can see the verified email is the same however.
    Feel free to use the algorithms I figured out in your own code, so long as you don't use it in proprietary programs. It is licensed under GNU GPLv3 or later.
    This works for all phones, not just S10+, but I couldn't find a better forum and this is where Frija posted.
    5
    Hey team.
    Forgive my ignorance as I am a bit of an android/linux rookie.
    I'm not sure if it is a problem my end or if the server is down. No matter what region or model. This is the output I get:

    Code:
    samloader -m SM-G975F -r NZC checkupdate                                                       ✔
    Traceback (most recent call last):
    File "/home/fred/.local/bin/samloader", line 8, in <module>
    sys.exit(main())
    File "/home/fred/.local/lib/python3.10/site-packages/samloader/main.py", line 71, in main
    print(versionfetch.getlatestver(args.dev_model, args.dev_region))
    File "/home/fred/.local/lib/python3.10/site-packages/samloader/versionfetch.py", line 24, in getlatestv
    er
    req.raise_for_status()
    File "/usr/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://fota-cloud-dn.ospserver.net/firm
    ware/NZC/SM-G975F/version.xml


    URL spits out:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.

    Code:
    <versioninfo>
    <url>https://fota-cloud-dn.ospserver.net/firmware/</url>
    <firmware>
    <model>SM-G975F</model>
    <cc>NZC</cc>
    <version>
    <latest o="12">G975FXXSGHWC1/G975FOXMGHWA3/G975FXXSGHWB3</latest>
    <upgrade>
    <value rcount="3" fwsize="1381041546">G975FXXS9EUB1/G975FOXM9EUA4/G975FXXU9EUA4</value>
    <value rcount="3" fwsize="180498937">G975FXXSDFUI5/G975FOXMDFUI5/G975FXXSDFUI5</value>
    <value rcount="3" fwsize="1381145998">G975FXXU9EUA4/G975FOXM9EUA4/G975FXXU9EUA4</value>
    <value rcount="1" fwsize="1426646688">G975FXXSEGVA9/G975FOXMEGVA4/G975FXXUEGVA2</value>
    <value rcount="2" fwsize="2336048019">G975FXXSEFUL1/G975FOXMEFUJ2/G975FXXSEFUJ2</value>
    <value rcount="3" fwsize="772897097">G975FXXSBFUE6/G975FOXMBFUE6/G975FXXSBFUE6</value>
    <value rcount="1" fwsize="1204728996">G975FXXUFHVE1/G975FOXMFHVE1/G975FXXUFHVE1</value>
    <value rcount="1" fwsize="1143932490">G975FXXUFHVG4/G975FOXMFHVG4/G975FXXUFHVG4</value>
    <value rcount="3" fwsize="188634912">G975FXXSCFUH5/G975FOXMCFUH3/G975FXXUCFUH3</value>
    <value rcount="1" fwsize="1425361119">G975FXXUEGVA4/G975FOXMEGVA4/G975FXXUEGVA2</value>
    <value rcount="3" fwsize="167765605">G975FXXSEFUJ2/G975FOXMEFUJ2/G975FXXSEFUJ2</value>
    <value rcount="3" fwsize="773038481">G975FXXUAFUE3/G975FOXMAFUE3/G975FXXUAFUE1</value>
    <value rcount="1" fwsize="1227792606">G975FXXUEHVC6/G975FOXMEHVC6/G975FXXUEHVB9</value>
    <value rcount="3" fwsize="889430710">G975FXXU9FUBD/G975FOXM9FUBD/G975FXXU9FUBD</value>
    <value rcount="1" fwsize="247596015">G975FXXUGHVJ5/G975FOXMGHVJ5/G975FXXUGHVJ1</value>
    <value rcount="1" fwsize="219369124">G975FXXSGHWA3/G975FOXMGHWA3/G975FXXSGHWA1</value>
    <value rcount="3" fwsize="188340961">G975FXXUCFUH3/G975FOXMCFUH3/G975FXXUCFUH3</value>
    <value rcount="3" fwsize="771988420">G975FXXSBFUF3/G975FOXMBFUE6/G975FXXSBFUE6</value>
    </upgrade>
    </version>
    </firmware>
    <polling>
    <period>1</period>
    <time>15</time>
    <range>23</range>
    </polling>
    <ActiveDeviceInfo>
    <CycleOfDeviceHeartbeat>0</CycleOfDeviceHeartbeat>
    <ServiceURL/>
    </ActiveDeviceInfo>
    <WiFiConnectedPollingInfo>
    <Cycle/>
    <Activated>FALSE</Activated>
    </WiFiConnectedPollingInfo>
    </versioninfo>

    Any help would be greatly appreciated
    ✌️
    Hello
    It's seem now USERAGENT is mandatory
    add it on file site-packages/samloader/versionfetch.py
    example:
    [arch@archLinux A52S]$ grep -B4 User-Agent /home/arch/.local/lib/python3.11/site-packages/samloader/versionfetch.py def getlatestver(model: str, region: str) -> str: """ Get the latest firmware version code for a model and region. """ req = requests.get("https://fota-cloud-dn.ospserver.net/firmware/" \ + region + "/" + model + "/version.xml", headers={"User-Agent": "Kies2.0_FUS"})

    it should works
    [arch@archLinux A52S]$ samloader -m SM-G975F -r NZC checkupdate G975FXXSGHWC1/G975FOXMGHWA3/G975FXXSGHWB3/G975FXXSGHWC1 [arch@archLinux A52S]$ samloader -m SM-A528B -r XEF checkupdate A528BXXU3EWC6/A528BOXM3EWC6/A528BXXU3EWC6/A528BXXU3EWC6 [arch@archLinux A52S]$
    3
    Also works with Termux!

    How to:
    First enable the storage permission for Termux in "Settings > Apps > Termux > Permissions > Storage".
    Now set up Termux to install Samloader with commands below.
    Code:
    pkg upgrade
    pkg install git
    pkg install python
    pip install --upgrade pip
    Now you can install Samloader
    Code:
    pip3 install git+https://github.com/nlscc/samloader.git
    To update Samloader
    Code:
    pip3 install --upgrade git+https://github.com/nlscc/samloader.git

    Example:
    Check update
    Code:
    samloader -m SM-G975F -r NZC checkupdate
    Download
    Code:
    samloader -m SM-G975F -r NZC download -v G975FXXS9DTI8/G975FOXM9DTI8/G975FXXS9DTI8/G975FXXS9DTI8 -O /storage/emulated/0/Download/
    Decrypt
    Code:
    samloader -m SM-G975F -r NZC decrypt -v G975FXXS9DTI8/G975FOXM9DTI8/G975FXXS9DTI8/G975FXXS9DTI8 -V 4 -i /storage/emulated/0/Download/SM-G975F_1_20200921075534_uii8oafhih_fac.zip.enc4 -o /storage/emulated/0/Download/SM-G975F_1_20200921075534_uii8oafhih_fac.zip
    2
    I made a bash script to use with Termux which automates everything directly on your device.

    It even offers to install samloader and its dependencies if they are not already installed.

    You can check it out here:
    https://github.com/lekron42/samloader_termux
    2
    FKN AWESOMEEEEE :cool: :cool: :cool: working on mint GENIUS WORK!!!!!
    Captura de pantalla de 2021-02-09 19-59-26.png