From 35ef14d6fc5e2c73a8c839e6040dbca57d6981e2 Mon Sep 17 00:00:00 2001 From: rafa_99 Date: Tue, 3 Sep 2019 12:47:13 +0000 Subject: Only supported on Windows, for now --- tools/4/resign_linux.sh | 325 ------------------------------------------------ tools/4/resign_mac.sh | 315 ---------------------------------------------- 2 files changed, 640 deletions(-) delete mode 100644 tools/4/resign_linux.sh delete mode 100644 tools/4/resign_mac.sh diff --git a/tools/4/resign_linux.sh b/tools/4/resign_linux.sh deleted file mode 100644 index aa86cd5..0000000 --- a/tools/4/resign_linux.sh +++ /dev/null @@ -1,325 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 Caio Oliveira -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# PS3Xploit ReSign BASH Script for act.dat, PKG and RAP -# Thanks to @CaptainCPS-X for script to build a proper PKG using Python -function ps3xploit_resign() { - - # Usage: ps3xploit_resign (Resign for act.dat, PKG and RAP) - echo; - echo "ps3xploit_resign: PS3Xploit ReSign BASH Script for act.dat, PKG and RAP"; - echo; - - ### - ### Variables - ### - - # Main Exports - export PS3XPLOIT_RESIGNER_BINARY=; - export PS3XPLOIT_PKGPY_BINARY=; - export PS3XPLOIT_PYTHON_BINARY=; - - # Save Current Working Dir and Create a TEMPorary DIR - cwd=$(pwd); - - # Main tools - ps3py_tools_dir="${cwd}/source/tools/ps3py"; - ps3xploit_resign_source_dir="${cwd}/source/src"; - ps3xploit_precompiled_dir="${cwd}/source/pre-compiled/linux"; - - # Output dirs - output_pkgs_dir="${cwd}/output/pkgs"; - - # Input files - input_act_dat="${cwd}/input/act_dat/act.dat"; - input_idps_hex="${cwd}/input/idps_hex/idps.hex"; - - # Input dirs - input_raps_dir="${cwd}/input/raps" - input_pkgs_dir="${cwd}/input/pkgs" - - # RIF Package ContentID and Name - rif_pkg_contentid="RIF000-INSTALLER_00-0000000000000000"; - rif_pkg_name="${output_pkgs_dir}/PKG_RIF-INSTALLER.pkg"; - - ### - ### Check - ### - - # Search for *.rap files - input_raps_files=($(find "${input_raps_dir}/" -maxdepth 1 -type f \( -iname \*.rap -o -iname \*.RAP \))); - input_raps_size="${#input_raps_files[@]}"; - if [ "${input_raps_size}" -eq 0 ]; then - echo; - echo "ps3xploit_resign: No '*.rap' files found on '.${input_raps_dir##${cwd}}'"; - echo; - fi; - - # Check 'act.dat' and 'idps.hex' only when resign RAP files - if [ "${input_raps_size}" -gt 0 ]; then - for IFC in ${input_act_dat} ${input_idps_hex}; do - if [ ! -e "${IFC}" ]; then - echo; - echo "ps3xploit_resign: '.${IFC##${cwd}}' not found, exiting..."; - echo; - return; - fi; - done; - fi; - - # Search for *.pkg files - input_pkgs_files=($(find "${input_pkgs_dir}/" -maxdepth 1 -name "*.pkg")); - input_pkgs_size="${#input_pkgs_files[@]}"; - if [ "${input_pkgs_size}" -eq 0 ]; then - echo; - echo "ps3xploit_resign: No '*.pkg' files found on '.${input_pkgs_dir##${cwd}}'"; - echo; - fi; - - # Nothing to do, just exit - if [ "${input_raps_size}" -eq 0 -a "${input_pkgs_size}" -eq 0 ]; then - return; - fi; - - # Check source files of resign - if [ -f "${ps3xploit_resign_source_dir}" ]; then - echo; - echo "ps3xploit_resign: Resign Dir '.${ps3xploit_resign_source_dir##${cwd}}' not found, exiting..."; - echo; - return; - fi; - - ### - ### Prepare Common - ### - - # Cleanup - rm -rf "${ps3xploit_precompiled_dir}/ps3xploit_rifgen_edatresign"; - - # Message Output - echo; - echo "ps3xploit_resign: Building 'ps3xploit_rifgen_edatresign'"; - echo; - - # Go to src dir - cd "${ps3xploit_resign_source_dir}"; - - # Clean old builds - make clean; - - # Make 'ps3xploit_rifgen_edatresign' - make; - - # Return back to current dir - cd "${cwd}"; - - # Check if ps3xploit_rifgen_edatresing exists - PS3XPLOIT_RESIGNER_BINARY=$(readlink -e "${ps3xploit_resign_source_dir}/ps3xploit_rifgen_edatresign"); - if [ -z "${PS3XPLOIT_RESIGNER_BINARY}" ]; then - echo; - echo "ps3xploit_resign: 'ps3xploit_rifgen_edatresign' not found, exiting..."; - echo; - return; - fi; - - # Copy new binary to precompiled dir - cp "${PS3XPLOIT_RESIGNER_BINARY}" "${ps3xploit_precompiled_dir}/"; - - # Go to src dir - cd "${ps3xploit_resign_source_dir}"; - - # Clean build - make clean; - - # Return back to current dir - cd "${cwd}"; - - # Check Resigner binary file - PS3XPLOIT_RESIGNER_BINARY=$(readlink -e "${ps3xploit_precompiled_dir}/ps3xploit_rifgen_edatresign"); - - # Check 'Build ReSign for Linux' - if [ -z "${PS3XPLOIT_RESIGNER_BINARY}" ]; then - echo; - echo "ps3xploit_resign: 'ps3xploit_rifgen_edatresign' not found, exiting..."; - echo; - return; - fi; - - ### - ### Start - RIF - ### - - # Use only when resign RAP files - if [ "${input_raps_size}" -gt 0 ]; then - - # Check 'pkg.py' - PS3XPLOIT_PKGPY_BINARY=$(readlink -e "${ps3py_tools_dir}/pkg.py"); - if [ -z "${PS3XPLOIT_PKGPY_BINARY}" ]; then - echo "ps3xploit_resign: 'pkg.py' not found, exiting..."; - return; - fi; - - # Cleanup - rm -rf "${ps3py_tools_dir}/build" "${ps3py_tools_dir}/pkgcrypt.so"; - - # Check if the Python2.7 is installed - PS3XPLOIT_PYTHON_BINARY=$(which python2.7); - if [ -z "${PS3XPLOIT_PYTHON_BINARY}" ]; then - echo; - echo "ps3xploit_ps3py_all: 'python2.7' not is installed, exiting..."; - echo " To continue install 'python2.7'"; - echo; - return; - fi; - - # Check if python-dev is installed - python_headers=$(dpkg-query -l python-dev >/dev/null 2>&1; echo "${?}"); - if [ "${python_headers}" -ne 0 ]; then - echo; - echo "ps3xploit_ps3py_all: 'python-dev' not is installed, exiting..."; - echo " To continue install 'python-dev'"; - echo; - return; - fi; - - # Message output - echo; - echo "ps3xploit_ps3py_all: Preparing 'ps3py' tools"; - echo; - - # Go to src dir - cd "${ps3py_tools_dir}"; - - # Setup to 'pkg.py' - ${PS3XPLOIT_PYTHON_BINARY} 'setup.py' 'build'; - - # Return back to current dir - cd "${cwd}"; - - # Check if the 'pkgcrypt' is builded - ps3py_lib=$(readlink -e "${ps3py_tools_dir}/build/lib."*"/pkgcrypt.so"); - if [ -z "${ps3py_lib}" ]; then - echo; - echo "ps3xploit_ps3py_all: 'pkgcrypt.so' building failed, exiting..."; - echo; - return; - fi; - - # Copy new library - cp "${ps3py_lib}" "${ps3py_tools_dir}/"; - - # Cleanup - rm -rf "${rif_pkg_name:?}" "${rif_pkg_name:?}_signed.pkg"; - - # Create a TEMPorary DIR - temp_dir=$(mktemp -d); - - # Copy 'act.dat' and 'idps.hex' - for IFC in ${input_act_dat} ${input_idps_hex}; do - cp "${IFC}" "${temp_dir}/"; - done; - - # Sign RIF files - for ((srap=0; srap