Advertisement
xzlui

[BATCH] R3D Apple Resigner Source Code

Jun 28th, 2025
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 12.05 KB | Source Code | 0 0
  1. REM This is the source code for a resigning tool used for for Playstation selfs (eboot files) based on True Ancestor Self Resigner
  2.  
  3. @shift /0
  4. @shift
  5. @echo off
  6. call data\config
  7. setlocal enabledelayedexpansion
  8. ::pushd %temp%
  9. color 0c
  10. set mode=%fw%
  11. title R3D Apple Resigner 2.1.1 [%mode% Mode]
  12. goto globals
  13.  
  14. :globals
  15. cls
  16. set sid=%random%
  17. set user=%usr%
  18. set curdir=%cd%
  19. set selfctrlflags=4000000000000000000000000000000000000000000000000000000000000002
  20. set selfcapflags=00000000000000000000000000000000000000000000003B0000000100040000
  21. set output=4xxstd
  22. set outputmsg=[4.XX STD]
  23. set elfsdk=41
  24. set keyrev=1C
  25. set fwver=0004002000000000
  26. set ctrlflagswitch=FALSE
  27. set capflagswitch=FALSE
  28. set compress=TRUE
  29. set compressmsg=[ON]
  30. goto init
  31.  
  32. :init
  33. cls
  34. set selfctrlflags=4000000000000000000000000000000000000000000000000000000000000002
  35. set selfcapflags=00000000000000000000000000000000000000000000003B0000000100040000
  36. set output=4xxstd
  37. set outputmsg=[4.XX STD]
  38. set elfsdk=41
  39. set keyrev=1C
  40. set fwver=0004002000000000
  41. set ctrlflagswitch=FALSE
  42. set capflagswitch=FALSE
  43. set compress=TRUE
  44. set compressmsg=[ON]
  45. goto default_mode
  46.  
  47. :default_mode
  48. cls
  49. if %mode%==DEX goto dex_menu
  50. if %mode%==CEX goto cex_menu
  51.  
  52. :dex_menu
  53. if %mode%==CEX goto cex_menu
  54. set mode=DEX
  55. title R3D Apple Resigner 2.1.1 [%mode% Mode]
  56. set opt=NULL
  57. cls
  58. echo WARNING: Be sure that your BIN/ELF is in %cd%
  59. echo.
  60. echo Mode: %mode% // Output: %outputmsg%
  61. echo Type "/cex" to change to CEX mode.
  62. echo.
  63. echo ^+================================^+
  64. ::echo ^|    R3D Apple Resigner 2.1.1    ^|
  65. echo ^|                 .:'            ^|
  66. echo ^|             __ :'__            ^|
  67. echo ^|          .'^`__^`-'__^`^`.         ^|
  68. echo ^|         ^:____R3D___.-'         ^|
  69. echo ^|         ^:__Apple__:            ^|
  70. echo ^|          ^:__2.1.1__`-;         ^|
  71. echo ^|           ^`.__.-.__.'          ^|
  72. echo ^+================================^+
  73. echo ^|    [1] - Decrypt BIN to ELF    ^|
  74. echo ^|    [2] - Resign NON-DRM        ^|
  75. echo ^|    [3] - Output Option         ^|
  76. echo ^|    [4] - Credits               ^|
  77. echo ^|    [5] - About R3D Apple       ^|
  78. echo ^|    [6] - Exit R3D Apple        ^|
  79. echo ^+================================^+
  80. echo.
  81. set /p opt= %user%@%sid%:
  82. if %opt%==1 (goto d_dex)
  83. if %opt%==2 (goto disc_dex)
  84. if %opt%==3 (goto outputoption)
  85. if %opt%==4 (goto credits)
  86. if %opt%==5 (goto about)
  87. if %opt%==6 exit
  88. if %opt%==/dex goto error
  89. if %opt%==/DEX goto error
  90. if %opt%==/cex goto change_mode
  91. if %opt%==/CEX goto change_mode
  92. if not %opt%==1 goto error
  93. if not %opt%==2 goto error
  94. if not %opt%==3 goto error
  95. if not %opt%==4 goto error
  96. if not %opt%==5 goto error
  97. if not %opt%==6 goto error
  98. if not %opt%==/cex goto error
  99. if not %opt%==/CEX goto error
  100.  
  101. :cex_menu
  102. if %mode%==DEX goto dex_menu
  103. set mode=CEX
  104. title R3D Apple Resigner 2.1.1 [%mode% Mode]
  105. set opt=NULL
  106. cls
  107. echo WARNING: Be sure that your BIN/ELF is in %cd%
  108. echo.
  109. echo Mode: %mode% // Output: %outputmsg%
  110. echo Type "/dex" to change to DEX mode.
  111. echo.
  112. echo ^+================================^+
  113. ::echo ^|    R3D Apple Resigner 2.1.1    ^|
  114. echo ^|                 .:'            ^|
  115. echo ^|             __ :'__            ^|
  116. echo ^|          .'^`__^`-'__^`^`.         ^|
  117. echo ^|         ^:____R3D___.-'         ^|
  118. echo ^|         ^:__Apple__:            ^|
  119. echo ^|          ^:__2.1.1__`-;         ^|
  120. echo ^|           ^`.__.-.__.'          ^|
  121. echo ^+================================^+
  122. echo ^|    [1] - Decrypt BIN to ELF    ^|
  123. echo ^|    [2] - Resign NON-DRM        ^|
  124. echo ^|    [3] - Output Option         ^|
  125. echo ^|    [4] - Credits               ^|
  126. echo ^|    [5] - About R3D Apple       ^|
  127. echo ^|    [6] - Exit R3D Apple        ^|
  128. echo ^+================================^+
  129. echo.
  130. set /p opt= %user%@%sid%:
  131. if %opt%==1 (goto d_cex)
  132. if %opt%==2 (goto disc_cex)
  133. if %opt%==3 (goto outputoption)
  134. if %opt%==4 (goto credits)
  135. if %opt%==5 (goto about)
  136. if %opt%==6 exit
  137. if %opt%==/cex goto error
  138. if %opt%==/CEX goto error
  139. if %opt%==/dex goto change_mode
  140. if %opt%==/DEX goto change_mode
  141. if not %opt%==1 goto error
  142. if not %opt%==2 goto error
  143. if not %opt%==3 goto error
  144. if not %opt%==4 goto error
  145. if not %opt%==5 goto error
  146. if not %opt%==6 goto error
  147. if not %opt%==/dex goto error
  148. if not %opt%==/DEX goto error
  149. if %opt%==NULL (goto cex_menu)
  150.  
  151. :d_cex
  152. data\sfk.exe list . .bin>data\list.txt
  153. cls
  154. set /a count=0
  155. for /f %%f in (data\list.txt) do (
  156. set /a count+=1
  157. set a!count!=%%f
  158. if count NEQ 0 (echo  [!count!] %%f )
  159. )
  160. ) else (echo Could not find .BINs to list.)
  161. set filesel=NONE
  162. echo.
  163. echo Type "/q" to quit decryption.
  164. echo.
  165. set /p filesel=[^^!] Enter # to File:
  166. echo.
  167. if %filesel%==/q (goto cex_menu)
  168. if %filesel%==/Q (goto cex_menu)
  169. if %filesel% GTR !count! (
  170. echo [^^!] Invalid Input.
  171. ping localhost -n 3 >nul
  172. goto d_cex
  173. )
  174. if %filesel% LSS 1 (
  175. echo [^^!] Invalid Input.
  176. ping localhost -n 3 >nul
  177. goto d_cex
  178. )
  179. set filename=!a%filesel%!
  180. set file=%filename:~0,-4%
  181.  
  182. if exist %file%.ELF (del %file%.ELF)
  183. echo [*] Decrypting %file%.BIN...
  184. data\scetool.exe --decrypt "%curdir%\%file%.BIN" "%curdir%\%file%.ELF">nul
  185. if exist %file%.ELF (
  186. echo [*] Decrypted to %file%.ELF
  187. ) else (
  188. echo [^^!] Decryption failed.
  189. )
  190. if exist data\list.txt (del data\list.txt)
  191. ping localhost -n 3 >nul
  192. goto cex_menu
  193.  
  194.  
  195. :disc_cex
  196. data\sfk.exe list -file .elf>data\list.txt
  197. cls
  198. set /a count=0
  199. for /f %%f in (data\list.txt) do (
  200. set /a count+=1
  201. set a!count!=%%f
  202. if count NEQ 0 (echo  [!count!] %%f )
  203. )
  204. ) else (echo Could not find .ELFs to list.)
  205. set filesel=NONE
  206. echo.
  207. echo Type "/q" to quit encryption.
  208. echo.
  209. set /p filesel=[^^!] Enter # to File:
  210. echo.
  211. if %filesel%==/Q (goto cex_menu)
  212. if %filesel%==/q (goto cex_menu)
  213. if %filesel% GTR !count! (
  214. echo [^^!] Invalid Input.
  215. ping localhost -n 3 >nul
  216. goto disc_cex
  217. )
  218. if %filesel% LSS 1 (
  219. echo [^^!] Invalid Input.
  220. ping localhost -n 3 >nul
  221. goto disc_cex
  222. )
  223. set filename=!a%filesel%!
  224. set file=%filename:~0,-4%
  225.  
  226. set CID=
  227. FOR /F "tokens=1,2 delims= " %%A IN ('data\scetool.exe -i "%curdir%\%file%.BIN"') DO (
  228. if [%%A]==[ContentID] set CID=%%B
  229. )
  230. data\FixELF.exe %file%.ELF %elfsdk%
  231. if [%CID%]==[] (
  232. data\scetool.exe -v --sce-type=SELF --compress-data=FALSE --skip-sections=TRUE --key-revision=%keyrev% --self-auth-id=1010000001000003 --self-vendor-id=01000002 --self-type=APP --self-app-version=0001000000000000 --self-fw-version=%fwver% --encrypt "%curdir%\%file%.ELF" "%curdir%\%file%.BIN" >nul
  233. echo [*] Encrypted to %file%.BIN. ) ELSE (
  234. echo ContentID = %CID%
  235. data\scetool.exe -v --sce-type=SELF --compress-data=FALSE --skip-sections=TRUE --key-revision=%keyrev% --self-auth-id=1010000001000003 --self-add-shdrs=TRUE --self-vendor-id=01000002 --self-type=NPDRM --self-app-version=0001000000000000 --self-fw-version=%fwver% --np-license-type=FREE --np-content-id=%CID% --np-app-type=EXEC --np-real-file=%file%.BIN --encrypt "%curdir%\%file%.ELF" "%curdir%\%file%.BIN" >nul
  236. echo [*] Encrypted to %file%.BIN. )
  237. ::del "%curdir%\%file%.BIN.BAK">nul
  238. ping localhost -n 3 >nul
  239. goto cex_menu
  240.  
  241. :d_dex
  242. data\sfk.exe list -file .bin>data\list.txt
  243. cls
  244. set /a count=0
  245. for /f %%f in (data\list.txt) do (
  246. set /a count+=1
  247. set a!count!=%%f
  248. if count NEQ 0 (echo  [!count!] %%f )
  249. )
  250. ) else (echo Could not find .ELFs to list.)
  251. set filesel=NONE
  252. echo.
  253. echo Type "/q" to quit decryption.
  254. echo.
  255. set /p filesel=[^^!] Enter # to File:
  256. echo.
  257. if %filesel%==/Q (goto dex_menu)
  258. if %filesel%==/q (goto dex_menu)
  259. if %filesel% GTR !count! (
  260. echo [^^!] Invalid Input.
  261. ping localhost -n 3 >nul
  262. goto disc_cex
  263. )
  264. if %filesel% LSS 1 (
  265. echo [^^!] Invalid Input.
  266. ping localhost -n 3 >nul
  267. goto disc_cex
  268. )
  269. set filename=!a%filesel%!
  270. set file=%filename:~0,-4%
  271.  
  272. if not exist %file%.BIN (
  273. echo [^^!] %file%.BIN can't be found.
  274. ping localhost -n 3 >nul
  275. goto dex_menu
  276. )
  277. if exist %file%.ELF (del %file%.ELF)
  278. echo [*] Decrypting %file%.BIN...
  279. data\unfself "%curdir%\%file%.BIN" "%curdir%\%file%.ELF">nul
  280. if exist %file%.ELF (
  281. echo [*] Decrypted to %file%.ELF
  282. ) else (
  283. echo [^^!] Decryption failed.
  284. )
  285. ping localhost -n 3 >nul
  286. goto dex_menu
  287.  
  288. :disc_dex
  289. data\sfk.exe list -file .elf>data\list.txt
  290. cls
  291. set /a count=0
  292. for /f %%f in (data\list.txt) do (
  293. set /a count+=1
  294. set a!count!=%%f
  295. if count NEQ 0 (echo  [!count!] %%f )
  296. )
  297. ) else (echo Could not find .ELFs to list.)
  298. set filesel=NONE
  299. echo.
  300. echo Type "/q" to quit encryption.
  301. echo.
  302. set /p filesel=[^^!] Enter # to File:
  303. echo.
  304. if %filesel%==/Q (goto dex_menu)
  305. if %filesel%==/q (goto dex_menu)
  306. if %filesel% GTR !count! (
  307. echo [^^!] Invalid Input.
  308. ping localhost -n 3 >nul
  309. goto disc_cex
  310. )
  311. if %filesel% LSS 1 (
  312. echo [^^!] Invalid Input.
  313. ping localhost -n 3 >nul
  314. goto disc_cex
  315. )
  316. set filename=!a%filesel%!
  317. set file=%filename:~0,-4%
  318.  
  319. set autoresign=FALSE
  320. if not exist %file%.BIN (
  321. if not exist %file%.ELF (
  322. echo [^^!] %file%.BIN/ELF can't be found.
  323. ping localhost -n 3 >nul
  324. goto dex_menu
  325. )
  326. )
  327. if not exist %file%.ELF (
  328. echo [*] Decrypting %file%.BIN...
  329. data\scetool.exe --decrypt "%curdir%\%file%.BIN" "%curdir%\%file%.ELF">nul
  330. set autoresign=TRUE
  331. )
  332. if not exist %file%.ELF (
  333. echo [^^!] Decryption failed.
  334. ping localhost -n 3 >nul
  335. goto dex_menu
  336. )
  337. if exist %file%.BIN (
  338. if exist %file%.BIN.BAK (del %file%.BIN.BAK)
  339. ren %file%.BIN %file%.BIN.BAK
  340. )
  341. echo [*] Patching %file%.ELF...
  342. data\FixELF "%curdir%\%file%.ELF"
  343. echo [*] Encrypting %file%.ELF...
  344. data\make_fself "%curdir%\%file%.ELF" "%curdir%\%file%.BIN">nul
  345. if %autoresign%==TRUE (del %file%.ELF)
  346. echo [*] Encrypted to %file%.BIN
  347. del %file%.BIN.BAK>nul
  348. ping localhost -n 3 >nul
  349. goto dex_menu
  350.  
  351. :outputoption
  352. if %output%==4xxstd (
  353. set output=4xxalt
  354. set outputmsg=[4.XX ALT]
  355. set elfsdk=41
  356. set keyrev=1C
  357. set fwver=0004002000000000
  358. set ctrlflagswitch=TRUE
  359. set capflagswitch=FALSE
  360. echo.
  361. echo [*] Output set to 4.XX ALT.
  362. ping localhost -n 2 >nul
  363. goto default_mode
  364. )
  365. if %output%==4xxalt (
  366. set output=4xxode
  367. set outputmsg=[4.XX ODE]
  368. set elfsdk=33
  369. set keyrev=0A
  370. set fwver=0003005500000000
  371. set ctrlflagswitch=FALSE
  372. set capflagswitch=TRUE
  373. echo.
  374. echo [*] Output set to 4.XX ODE.
  375. ping localhost -n 2 >nul
  376. goto default_mode
  377. )
  378. if %output%==4xxode (
  379. set output=3xxstd
  380. set outputmsg=[3.XX STD]
  381. set elfsdk=33
  382. set keyrev=04
  383. set fwver=0003004000000000
  384. set ctrlflagswitch=FALSE
  385. set capflagswitch=FALSE
  386. echo.
  387. echo [*] Output set to 3.XX STD.
  388. ping localhost -n 2 >nul
  389. goto default_mode
  390. )
  391. if %output%==3xxstd (
  392. set output=3xxalt
  393. set outputmsg=[3.XX ALT]
  394. set elfsdk=33
  395. set keyrev=04
  396. set fwver=0003004000000000
  397. set ctrlflagswitch=TRUE
  398. set capflagswitch=FALSE
  399. echo [*] Output set to 3.XX ALT.
  400. echo.
  401. ping localhost -n 2 >nul
  402. goto default_mode
  403. )
  404. if %output%==3xxalt (
  405. set output=4xxstd
  406. set outputmsg=[4.XX STD]
  407. set elfsdk=41
  408. set keyrev=1C
  409. set fwver=0004002000000000
  410. set ctrlflagswitch=FALSE
  411. set capflagswitch=FALSE
  412. echo.
  413. echo [*] Output set to 4.XX STD.
  414. ping localhost -n 2 >nul
  415. goto default_mode
  416. )
  417.  
  418. :change_mode
  419. if %opt%==/cex goto set_cex
  420. if %opt%==/CEX goto set_cex
  421. if %opt%==/dex goto set_dex
  422. if %opt%==/DEX goto set_dex
  423. :set_cex
  424. set mode=CEX
  425. echo.
  426. echo CEX mode enabled.
  427. ping localhost -n 2 >nul
  428. goto cex_menu
  429. :set_dex
  430. set mode=DEX
  431. echo.
  432. echo DEX mode enabled.
  433. ping localhost -n 2 >nul
  434. goto dex_menu
  435.  
  436. :error
  437. echo.
  438. if %opt%==/cex goto fw_error
  439. if %opt%==/CEX goto fw_error
  440. if %opt%==/dex goto fw_error
  441. if %opt%==/DEX echo fw_error
  442. if %mode%==CEX echo [^^!] "%opt%" is not a valid option.
  443. if %mode%==DEX echo [^^!] "%opt%" is not a valid option.
  444. ping localhost -n 3 >nul
  445. goto default_mode
  446. :fw_error
  447. if %opt%==/cex echo [^^!] CEX mode is already enabled.
  448. if %opt%==/CEX echo [^^!] CEX mode is already enabled.
  449. if %opt%==/dex echo [^^!] DEX mode is already enabled.
  450. if %opt%==/DEX echo [^^!] DEX mode is already enabled.
  451. ping localhost -n 3 >nul
  452. goto default_mode
  453.  
  454. :about
  455. echo.
  456. echo R3D Apple is a resigning tool developed to quickly and simply encrypt/decrypt EBOOTs.
  457. echo.
  458. echo Waiting on %user%...
  459. pause >nul
  460. goto default_mode
  461.  
  462. :credits
  463. cls
  464. echo R3D Apple Resigner developed by Jet
  465. echo Released Sept. 22, 2016
  466. echo NGU: TrippinOnACID
  467. echo RG: Jet
  468. echo.
  469. echo Shout out to Trojan and Krank
  470. echo.
  471. echo Waiting on %user%...
  472. pause >nul
  473. goto default_mode
  474.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement