Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
julesontheroad authored Sep 16, 2018
1 parent 4a76720 commit ded081a
Show file tree
Hide file tree
Showing 55 changed files with 5,219 additions and 0 deletions.
84 changes: 84 additions & 0 deletions English Readme. NUT BATCH CLEANER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
__ __ __ __ __
____ __ __/ /_ / /_ ____ _/ /______/ /_ _____/ /__ ____ _____ ___ _____
/ __ \/ / / / __/ / __ \/ __ `/ __/ ___/ __ \ / ___/ / _ \/ __ `/ __ \/ _ \/ ___/
/ / / / /_/ / /_ / /_/ / /_/ / /_/ /__/ / / / / /__/ / __/ /_/ / / / / __/ /
/_/ /_/\__,_/\__/____/_.___/\__,_/\__/\___/_/ /_/____\___/_/\___/\__,_/_/ /_/\___/_/
/_____/ /_____/
-------------------------------------------------------------------------------------
============================= BY JULESONTHEROAD =============================
-------------------------------------------------------------------------------------
" POWERED WITH NUT BY BLAWAR "

------------------------------------------------------------------------------------------
also check xci_batch_builder at: https://github.com/julesontheroad/
and check blawar's NUT at: https://github.com/blawar/nut
and also check blawar's awesome installer in the works at https://github.com/blawar/sysnut
------------------------------------------------------------------------------------------

ADVICE: FOR ALL TO WORK CORRECTLY DON'T SPECIAL CHARACTER'S IN NSP NAMES, IT WILL GIVE A
FALSE ERROR LOG
---------------
0. Changelog
---------------
v0.1 - First official release

---------------
1. Description
---------------
Nut_batch_cleaner uses the awesome function "REMOVE_TITLE_RIGHTS" from nut by blawar
this function let's you erase the titlerights encryption from nsp files.
Tinfoil and SX installer will install the ticket either way so for it to not stay in
your system you need to erase the ticket and cert from the nsp, this batch will take
care of that.

This batch automates a process you can do yourself with nut and let's make clean nsp
files that you can also pass for XCI-Batch-Builder to generate xci files that don't
need a ticket.

This batch fetures numerous new options that will be implemented in the future version
of XCI-Batch-Builder.

The batch has 2 modes:

- auto mode: you drag nsp files individually or folders with severall nsp files and
you get clean nsp files in "o_clean_nsp" folder
Note: auto mode won't process subfolders yet.
- manual mode: you double click the batch and uou can build a list of nsp files to
clean, you can even erase items via batch or directly in the list before starting.
You can resume the list if you close the window before compleating all the cleanings.
It also fetures a check that will stop the cleaning for a file if the titlerights
can't be stripped from it. In this case it will generate a log.txt with the file name.
If an error is found that file is skipped an the batch continues processing the queue.
---------------
2. Important
---------------
The program incorporates a build of nut.py with only the "REMOVE_TITLE_RIGHTS" function
and required libraries, the reason is to remove the python libraries requirements for
normal nut to facilitate the life of most users and to eliminate the CDNSP functions
so it can be shared in places CDNSP isn't allowed.
You can make it to work with normal nut by changing nut location for your NUT location
in nsp_cleaner_options.txt inside zconfig.
The other options are not enabled yet (sorry about that).
---------------
2. Requirements
---------------
- You'll need to have Python installed for the program to work correctly
- You need to fill the keys.txt file inside the ztools folder.
------------------------
3. Thanks and credits to
------------------------
Nut_batch_cleaner is based on

a.) Nut: Without the work of "blawar" one of the most talented Switch sceners nothing of this would
be possible at this point. Check his awesome projects:
https://github.com/blawar/nut
https://github.com/blawar/sysnut

b.) hactool: Program which function is give information, decrypt and extract a lot of different kind of files us by the NX System.
Hactool was made by SciresM
https://github.com/SciresM/hactool
c.) nspBuild: Program meant to create nsp files from nca files.
nspBuild was made by CVFireDragon
https://github.com/CVFireDragon/nspBuild
Thx to MadScript77 and BigJokker for their great suggestions.
Also thanks to all members from gbatemp, elotrolado.net and my friends at discord ;)
249 changes: 249 additions & 0 deletions NUT_BC.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
@ECHO OFF
color 03
setlocal enabledelayedexpansion

::Set checks
set /a Enclean=0

::Checks if cleaner exist
if exist "%~dp0\nsp_clean.bat" set /a Enclean=1
if exist "%~dp0\ztools\nsp_clean.bat" set /a Enclean=1

::If no program exist go to exit
if %Enclean% EQU 0 ( goto noprograms )

::Set route for programs depending on it's location
set rutaNCLEAN=%~dp0\nsp_clean.bat

if not exist "%~dp0\nsp_clean.bat" ( set rutaNCLEAN=%~dp0\ztools\nsp_clean.bat )

::Check if user is dragging a folder or a file

if exist "%~dp1%~n1\*.nsp" goto folder
goto file


:folder
ECHO __ __ __ __ __
ECHO ____ __ __/ /_ / /_ ____ _/ /______/ /_ _____/ /__ ____ _____ ___ _____
ECHO / __ \/ / / / __/ / __ \/ __ `/ __/ ___/ __ \ / ___/ / _ \/ __ `/ __ \/ _ \/ ___/
ECHO / / / / /_/ / /_ / /_/ / /_/ / /_/ /__/ / / / / /__/ / __/ /_/ / / / / __/ /
ECHO /_/ /_/\__,_/\__/____/_.___/\__,_/\__/\___/_/ /_/____\___/_/\___/\__,_/_/ /_/\___/_/
ECHO /_____/ /_____/
ECHO -------------------------------------------------------------------------------------
ECHO ============================= BY JULESONTHEROAD =============================
ECHO -------------------------------------------------------------------------------------
ECHO " POWERED WITH NUT BY BLAWAR "
ECHO VERSION 0.1
ECHO -------------------------------------------------------------------------------------
ECHO check xci_batch_builder at: https://github.com/julesontheroad/
ECHO and check blawar's NUT at: https://github.com/blawar/nut
ECHO -------------------------------------------------------------------------------------
PING -n 2 127.0.0.1 >NUL 2>&1

for %%f in ("%~dp1%~n1\*.*") do (
if %Enclean% EQU 1 ( "%rutaNCLEAN%" "%%f" )
)
ECHO ---------------------------------------------------
ECHO ************ ALL FILES WERE CLEANED! **************
ECHO ---------------------------------------------------
PING -n 2 127.0.0.1 >NUL 2>&1
ECHO PROGRAM WILL CLOSE NOW
PING -n 2 127.0.0.1 >NUL 2>&1
exit

:file
if "%~x1"==".nsp" ( goto nsp )
if "%~x1"==".*" ( goto other )
goto manual

:nsp
"%rutaNCLEAN%" "%~1"
exit

:noprograms
ECHO ....................................................
echo nsp_clean.bat wasn't found
ECHO ....................................................
echo you can download it from:
ECHO -----------------------------------
echo https://github.com/julesontheroad/
ECHO -----------------------------------
echo Then install them either in ztools or in BatchBuilder
echo root directory.
pause
exit


:manual
setlocal enabledelayedexpansion
::Set checks
set /a Enclean=0

::Checks if cleaner exist
if exist "%~dp0\nsp_clean.bat" set /a Enclean=1
if exist "%~dp0\ztools\nsp_clean.bat" set /a Enclean=1

::If no program exist go to exit
if %Enclean% EQU 0 ( goto noprograms )

::Set route for programs depending on it's location
set rutaNCLEAN=%~dp0\nsp_clean.bat

if not exist "%~dp0\nsp_clean.bat" ( set rutaNCLEAN=%~dp0\ztools\nsp_clean.bat )


ECHO __ __ __ __ __
ECHO ____ __ __/ /_ / /_ ____ _/ /______/ /_ _____/ /__ ____ _____ ___ _____
ECHO / __ \/ / / / __/ / __ \/ __ `/ __/ ___/ __ \ / ___/ / _ \/ __ `/ __ \/ _ \/ ___/
ECHO / / / / /_/ / /_ / /_/ / /_/ / /_/ /__/ / / / / /__/ / __/ /_/ / / / / __/ /
ECHO /_/ /_/\__,_/\__/____/_.___/\__,_/\__/\___/_/ /_/____\___/_/\___/\__,_/_/ /_/\___/_/
ECHO /_____/ /_____/
ECHO -------------------------------------------------------------------------------------
ECHO ============================= BY JULESONTHEROAD =============================
ECHO -------------------------------------------------------------------------------------
ECHO " POWERED NY NUT BY BLAWAR "
ECHO VERSION 0.1
ECHO -------------------------------------------------------------------------------------
ECHO check xci_batch_builder at: https://github.com/julesontheroad/
ECHO and check blawar's NUT at: https://github.com/blawar/nut
ECHO -------------------------------------------------------------------------------------
echo.
echo ********************************
echo YOU'VE ENTERED INTO MANUAL MODE
echo ********************************
if exist "list.txt" goto prevlist
goto manual_INIT
:prevlist
set conta=0
for /f "tokens=*" %%f in (list.txt) do (
echo %%f
set /a conta=!conta! + 1
) >NUL 2>&1
if !conta! LEQ 0 ( del list.txt )
if not exist "list.txt" goto manual_INIT
ECHO .......................................................
ECHO A PREVIOUS LIST WHAS FOUND. WHAT DO YOU WANT TO DO?
:prevlist0
ECHO .......................................................
echo Press "0" to auto-start cleaning from the previous list
echo Press "1" to erase list and make a new one.
echo Press "2" to continue building the previous list
echo .......................................................
echo NOTE: By pressing 2 you'll see the previous list
echo before starting the cleaning process and you will
echo be able to add and delete items to the list
echo.
set /p bs="Enter your choice: "
set bs=%bs:"=%
if /i "%bs%"=="2" goto showlist
if /i "%bs%"=="1" goto delist
if /i "%bs%"=="0" goto start_cleaning
echo.
echo BAD CHOICE
goto prevlist0
:delist
del list.txt
echo YOU'VE DECIDED TO START A NEW LIST
echo ...................................................................
:manual_INIT
set /p bs="PLEASE DRAG A FILE OR FOLDER OVER THE WINDOW AND PRESS ENTER: "
set bs=%bs:"=%
if exist "%bs%\*.nsp" goto checkfolder
goto checkfile
:checkfolder
for %%f in ("%bs%\*.*") do (
echo %%f >>hlist.txt
)
FINDSTR ".nsp" hlist.txt >>list.txt
del hlist.txt
goto checkagain
:checkfile
echo %bs% >>hlist.txt
FINDSTR ".nsp" hlist.txt >>list.txt
del hlist.txt
goto checkagain
echo.
:checkagain
echo What do you want to do?
echo.
echo "DRAG ANOTHER FILE OR FOLDER AND PRESS ENTER TO ADD ITEMS TO THE LIST"
echo.
echo Press "1" to start cleaning
echo Press "e" to exit
echo Press "i" to see list of files to clean
echo Press "r" to remove some files (counting from bottom)
echo ......................................................................
set /p bs="Drag file/folder or set option: "
set bs=%bs:"=%
if /i "%bs%"=="1" goto start_cleaning
if /i "%bs%"=="e" goto salida
if /i "%bs%"=="i" goto showlist
if /i "%bs%"=="r" goto r_files
if exist "%bs%\*.nsp" goto checkfolder
goto checkfile
goto salida
pause

:r_files
set /p bs="Input the number of files you want to remove (from bottom): "
set bs=%bs:"=%
set conta=
for /f "tokens=*" %%f in (list.txt) do (
set /a conta=!conta! + 1
)

set /a pos1=!conta!-!bs!
set /a pos2=!conta!
set string=
:update_list1
if !pos1! GTR !pos2! ( goto :update_list2 ) else ( set /a pos1+=1 )
set string=%string%,%pos1%
goto :update_list1
:update_list2
set string=%string%,
set skiplist=%string%
Set "skip=%skiplist%"
(for /f "tokens=1,*delims=:" %%a in (' findstr /n "^" ^<list.txt'
) do Echo=%skip%|findstr ",%%a," 2>&1>NUL ||Echo=%%b
)>list.txt.new
move /y "list.txt.new" "list.txt" >nul

:showlist
ECHO -------------------------------------------------
ECHO FILES TO CLEAN
ECHO -------------------------------------------------
set conta=
for /f "tokens=*" %%f in (list.txt) do (
echo %%f
set /a conta=!conta! + 1
)
echo .................................................
echo YOU'VE ADDED !conta! FILES TO CLEAN
echo .................................................
goto checkagain

:start_cleaning
set conta=
for /f "tokens=*" %%f in (list.txt) do (
echo %%f
set /a conta=!conta! + 1
)
for /f "tokens=*" %%f in (list.txt) do (
"%rutaNCLEAN%" "%%f"
more +1 "list.txt" >"list.txt.new"
move /y "list.txt.new" "list.txt" >nul
set /a conta=!conta! - 1
echo .................................................
echo STILL !conta! FILES TO CLEAN
echo .................................................
)
ECHO -------------------------------------------------
ECHO *********** ALL FILES WERE CLEANED! *************
ECHO -------------------------------------------------
PING -n 2 127.0.0.1 >NUL 2>&1
ECHO PROGRAM WILL CLOSE NOW
PING -n 2 127.0.0.1 >NUL 2>&1
:salida

exit
5 changes: 5 additions & 0 deletions zconfig/nsp_cleaner_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
nut_location|ztools/nut_RTR.py
working_folder|nspDecrypted
output_folder|o_clean_nsp
replace_original|YES
setting|lines
Loading

0 comments on commit ded081a

Please sign in to comment.