forked from PS3Xploit/PS3xploit-resigner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resign_windows.bat
executable file
·152 lines (128 loc) · 4.54 KB
/
resign_windows.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
:: ------------------------------------------------------------------
:: Simple script to build a proper PKG using Python (by CaptainCPS-X)
:: Adapted to PS3xploit-ReSigner (by Caio99BR)
:: ------------------------------------------------------------------
:: Disable Debug output
@echo off
:: Save Current Working Dir
set CURRENT_DIR=%cd%
:: Go to current dir
cd "%CURRENT_DIR%"
:: Main Tools
set TOOLS_PKG_EXDATA=source\tools\ps3py_exe\pkg_exdata.exe
set TOOLS_RESIGNER=source\pre-compiled\windows\ps3xploit_rifgen_edatresign.exe
:: Output Dirs
set OUTPUT_PKGS_DIR=output\pkgs
set OUTPUT_TEMP_DIR=output\temp
:: Input Dirs
set INPUT_PKGS_DIR=input\pkgs
set INPUT_RAPS_DIR=input\raps
:: Input Files
set INPUT_ACT_DAT=input\act_dat\act.dat
set INPUT_IDPS_HEX=input\idps_hex\idps.hex
:: RIF Package ContentID and Name
set RIF_PKG_CONTENTID=RIF000-INSTALLER_00-0000000000000000
set RIF_PKG_NAME=PKG_RIF-INSTALLER.pkg
:: Cleanup before everything
if exist "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\*.pkg" (
echo.
echo ps3xploit_resign: You have *.pkg files on output folder, keep in mind if you continue these files will be deleted.
echo.
echo ps3xploit_resign: Are you sure you want to continue?
echo.
pause
del "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\*.pkg"
)
if exist "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\%RIF_PKG_NAME%_signed.pkg" del "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\%RIF_PKG_NAME%_signed.pkg"
:: Prevent missing dirs
if not exist "%CURRENT_DIR%\%INPUT_PKGS_DIR%\" mkdir "%CURRENT_DIR%\%INPUT_PKGS_DIR%\"
if not exist "%CURRENT_DIR%\%INPUT_RAPS_DIR%\" mkdir "%CURRENT_DIR%\%INPUT_RAPS_DIR%\"
if not exist "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\" mkdir "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\"
if not exist "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\" mkdir "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\"
:: Check for RAP or PKG files
if not exist "%CURRENT_DIR%\%INPUT_RAPS_DIR%\*.rap" (
echo.
echo ps3xploit_resign: No '.rap' files found on '.\%INPUT_RAPS_DIR%\'
echo.
if exist "%CURRENT_DIR%\%INPUT_PKGS_DIR%\*.pkg" (
GOTO RESIGN_PKG_ONLY
) else (
echo.
echo ps3xploit_resign: No '.pkg' files found on '.\%INPUT_PKGS_DIR%\'
echo.
pause
exit /b
)
)
:: Copy act.dat files
if not exist "%CURRENT_DIR%\%INPUT_ACT_DAT%" (
echo.
echo ps3xploit_resign: '.\%INPUT_ACT_DAT%' not found, exiting...
echo.
pause
exit /b
)
copy /Y "%CURRENT_DIR%\%INPUT_ACT_DAT%" "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\"
:: Copy idps.hex files
if not exist "%CURRENT_DIR%\%INPUT_IDPS_HEX%" (
echo.
echo ps3xploit_resign: '.\%INPUT_IDPS_HEX%' not found, exiting...
echo.
pause
exit /b
)
copy /Y "%CURRENT_DIR%\%INPUT_IDPS_HEX%" "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\"
:: Copy RAP files
copy /Y "%CURRENT_DIR%\%INPUT_RAPS_DIR%\*.rap" "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\"
:: Resign all RAP files to RIF files
if exist "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\*.rif" del "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\*.rif"
for %%I in ("%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\*.rap") do (
cd "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\"
echo y | "%CURRENT_DIR%\%TOOLS_RESIGNER%" "%%I"
cd "%CURRENT_DIR%\"
)
:: Delete unneed files on PKG RIF
del "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\*.rap"
del "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\act.dat"
del "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\idps.hex"
:: Move 'signed_act.dat' to 'act.dat'
move "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\signed_act.dat" "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\act.dat"
:: Build PKG RIF
"%CURRENT_DIR%\%TOOLS_PKG_EXDATA%" --contentid %RIF_PKG_CONTENTID% %OUTPUT_TEMP_DIR%\ %OUTPUT_PKGS_DIR%\%RIF_PKG_NAME%
:: Resign PKG RIF
if not exist "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\%RIF_PKG_NAME%" (
echo.
echo ps3xploit_resign: '.\%OUTPUT_PKGS_DIR%\%RIF_PKG_NAME%' not found, exiting...
echo.
pause
exit /b
)
echo y | "%CURRENT_DIR%\%TOOLS_RESIGNER%" "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\%RIF_PKG_NAME%"
:: Cleanup
del "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\*.rif"
del "%CURRENT_DIR%\%OUTPUT_TEMP_DIR%\act.dat"
del "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\%RIF_PKG_NAME%"
:: Resign PKG files
:RESIGN_PKG_ONLY
for %%I in ("%CURRENT_DIR%\%INPUT_PKGS_DIR%\*.pkg") do (
echo y | "%CURRENT_DIR%\%TOOLS_RESIGNER%" "%%I"
move "%%I_signed.pkg" "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\"
)
:: Output header
echo.
echo ps3xploit_resign: Output files:
:: See PKGS signed
if exist "%CURRENT_DIR%\%OUTPUT_PKGS_DIR%\*.pkg" (
echo.
echo. PKGS:
for %%I in (%OUTPUT_PKGS_DIR%\*.pkg) do (
if "%%I" == "%OUTPUT_PKGS_DIR%\%RIF_PKG_NAME%_signed.pkg" (
echo. [RIF PKG] .\%%I
) else (
echo. .\%%I
)
)
echo.
)
:: Let user see everything
pause