Join Us and become a Member for a Verified Badge to access private areas with the latest PS4 PKGs.
PS4 CFW and Hacks       Thread starter PSXHAX       Start date Sep 12, 2018 at 1:44 AM       277      
Status
Not open for further replies.
Since his PS4Updates.py python script, PlayStation 4 developer Zer0xFF returns with PS4_db_rebuilder which will restore your FPKGs (Fake Packages) after rebuilding the PS4 database. (y)

Download: PS4_db_rebuilder (Latest Release) / GIT / release_0.1.EXTERNAL.zip (v0.1 rebuilder for external only) via thxalot60 / Restore_DB_PS4_2020.rar (30 KB - For 6.72) / PS4_db_rebuilder_6.72-0.2.zip (Python Script with added support for 6.72 FW) / GIT Fork by lKinderBueno / PS4_db_rebuilder_6.72_7.02_7.55.zip (23.6 KB - compatible with PS4 6.72, 7.02 and 7.55) / GIT Fork by hippie68 / Tutorial by VitoPS4 / PS4_db_Rebuilder_EXT-0.1.zip via @aizenar78
Here's further details from the README.md file, to quote: PS4_db_rebuilder

PS4 built in database rebuilder has the tendency to remove FPKG from the database, this will repopulate the database with them

Requirement
How-to-use
  1. recursively clone this repo or download a Release
  2. start FTP server on the PS4
  3. run the python script though terminal/cmdline python3 fix_db.py PS4_IP (command for external via sp0k: py fix_db.py PS4_IP)
  4. wait for the script to finish, then logout of the PS4 user without closing the browser
  5. log back in and all your games should be there again
:arrow: Update: From the README.md forked by lKinderBueno: PS4_db_rebuilder - Updated to 6.72

PS4 built in database rebuilder has the tendency to remove FPKG from the database, this will repopulate the database with them

requirement
  • Python (preferably 3.0+)
how-to-use
  1. recursively clone this repo or download a Release
  2. start FTP server on the PS4
  3. run the python script though terminal/cmdline python3 fix_db.py PS4_IP
  4. wait for the script to finish, then logout of the PS4 user without closing the browser
  5. log back in and all your games should be there again
Changelog
  • Fixed error "table tbl_appbrowse_XXXXXXX has 53 columns but 47 values were supplied"
  • Support to FW 6.72
PS4_DB_Rebuilder to Restore FPKGs After PS4 Database Rebuilding.jpg
 

Comments

Thanks! It complained to me because the query had less values than fields that exist in the DB. Maybe I was using the wrong one then!
Thanks!
 
I was trying to install fake pkg files onto my jailbroken PS4 9.00. But always when I try to download a game onto my ps4 it tells that there was an error (CE-30005-8).

I tried it with NBA 2k22 and Red Dead Redemption 2, and neither worked. I also tried it with a smaller game, which for some reason installed without a problem.

I read that it could be a problem with the HDD and I had to rebuild the database. But even after that nothing changed. Does anybody know what I can do, so that I can install games?
 
I recommend you to download the game, copy to an external drive (formatted as ExFAT) and install it via Goldhen menu (Settings>Goldhen>Game Installer). If the game installs fine, there is no problem.

If the issue persists, try to plug an external drive to PS4, format as 2nd disk and install there. If you don't get any error, we may suspect that you have a faulty hard drive.

Best way to install games is through an external drive (formatted as ExFAT) and Goldhen Game Installer.
 
Hi guys, I have a ps4, I have installed several pkg, but while I was starting the golden hen, the ps4 decided that it wanted to reboot and then restore the database, I have a ps4 pro with of 9.00 obviously and the pkg are installed in the internal HDD.

I was trying to fix with dB rebuilder, it gives me error following the official guide. Maybe I'm wrong. Any good soul who can help me please?
 
I had this problem; luckily all my games are installed on the external hdd, I recommend using an expanded hdd not apptousb after launch exploit with goldhen.

After that connect external hdd and will scan all installed games with updates and DLCs. I didn't use the db rebuilder program but I think it corrupts the db file, restoring the game without DLCs.
 
I get this error when running the script on powershell
Code:
PS C:\Users\Desktop\release_0.1> py fix_db.py 192.168.1.244
Traceback (most recent call last):
  File "fix_db.py", line 10, in <module>
    from sfo.sfo import SfoFile as SfoFile
  File "C:\Users\Desktop\release_0.1\sfo\__init__.py", line 10, in <module>
    from .sfo import SfoFile
  File "C:\Users\Desktop\release_0.1\sfo\sfo.py", line 232
    def __init__(self, sfo: SfoFile, key):
                          ^
SyntaxError: invalid syntax
Can someone help??

does this work for app2usb??
 
db_rebuilder (3 different version) None of them worked for me on Fw 9.00. I had used it on earlier fw's and it worked. On Fw 9.00 i could not get the script to rebuild my db. I think it has two issues... on is working with fw 9.00 but also i believe some sort of issue if you have over 500 games etc.

@pharaoh2k was kind enough to try to help me the last time i attempted to use db_rebuilder but we could NOT get it to fully work for me :eek: I ended up just reinstalling every single game... huge pain in the butt. I really hope someone could fix and update the script because it is a horrible experience trying to rebuild.
 
@stripnwild I actually already posted the fixed version that can handle over 500 games:
PS4_db_Rebuilder_EXT:
Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function
from ftplib import FTP
import sqlite3
import appinfo
import io
import os
import re
from sfo.sfo import SfoFile as SfoFile
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("PS4_IP", help="PS4 ftp ip address")
parser.add_argument('--fw', default="6.72", help='currently support 5.05, 6.72')
parser.add_argument('--port', default="2121", help='PS4 FTP Port Number')
args = parser.parse_args()
app_db = "tmp/app.db"
PS4_IP = args.PS4_IP

port = 2121
port = int(args.port)

value_format = ""
if(args.fw == "5.05"):
        value_format = """("%s", "%s", "%s", "/user/appmeta/%s", "2018-07-27 15:06:46.822", "0", "0", "5", "1", "100", "0", "151", "5", "1", "gd", "0", "0", "0", "0", NULL, NULL, NULL, "%d", "2018-07-27 15:06:46.802", "0", "game", NULL, "0", "0", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "0", NULL, NULL, NULL, NULL, NULL, "0", "0", NULL, "2018-07-27 15:06:46.757")"""
elif(args.fw == "6.72"):
        value_format = """("%s", "%s", "%s", "/user/appmeta/%s", "2018-07-27 15:06:46.822", "0", "0", "5", "1", "100", "0", "151","5", "1", "gd", "0", "0", "0", "0",NULL, NULL, NULL, "%d", "2018-07-27 15:06:46.802", "0", "game", NULL, "0", "0", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "0", NULL,NULL, NULL, NULL, NULL, "0", "0", NULL, "2018-07-27 15:06:46.757","0","0","0","0","0",NULL)"""
else:
        value_format = """("%s", "%s", "%s", "/user/appmeta/%s", "2018-07-27 15:06:46.822", "0", "0", "5", "1", "100", "0", "151","5", "1", "gd", "0", "0", "0", "0",NULL, NULL, NULL, "%d", "2018-07-27 15:06:46.802", "0", "game", NULL, "0", "0", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "0", NULL,NULL, NULL, NULL, NULL, "0", "0", NULL, "2018-07-27 15:06:46.757","0","0","0","0","0",NULL)"""

if not os.path.exists('tmp'):
        os.makedirs('tmp')

class CUSA :
        sfo = None
        size = 10000000
        is_usable = False

info = {}
files = []

def sort_files(file) :
        if re.search("^[A-Z]", file[-9]):
                files.append("'%s'" % file[-9:])

def get_game_info_by_id(GameID) :
        if(GameID not in info) :
                info[GameID] = CUSA()

                try:
                        buffer = io.BytesIO()
                        ftp.cwd('/system_data/priv/appmeta/%s/' % GameID)
                        ftp.retrbinary("RETR param.sfo" , buffer.write)
                        buffer.seek(0)
                        sfo = SfoFile.from_reader(buffer)
                        info[GameID].sfo = sfo
                        info[GameID].size = ftp.size("/user/app/%s/app.pkg" % GameID)
                        info[GameID].is_usable = True
                except Exception as e:
                        print("Error processing %s, ignorining..." % GameID)
                        print("type error: " + str(e))

        return info[GameID]

def bin(input, bin_size):
    for i in range(0, len(input), bin_size):
        yield input[i:i + bin_size]


ftp = FTP()
ftp.connect(PS4_IP, port, timeout=30)
ftp.login(user='username', passwd = 'password')
if(len(files) == 0) :
        ftp.cwd('/user/app/')
        ftp.dir(sort_files)
        print(files)


ftp.cwd('/system_data/priv/mms/')
lf = open(app_db, "wb")
ftp.retrbinary("RETR app.db" , lf.write)
lf.close()

conn = sqlite3.connect(app_db)

cursor = conn.cursor()
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'tbl_appbrowse_%%';")
tables = cursor.fetchall()

for files_subset in bin(files, 500):
        files_joined = "SELECT %s AS titleid " % ' AS titleid UNION SELECT '.join(files_subset)
        tbl_appbrowse = []
        for tbl in tables :
                tbl_appbrowse.append(tbl[0])
                print("Processing table: %s" % tbl[0])
                cursor.execute("SELECT T.titleid FROM (%s) T WHERE T.titleid NOT IN (SELECT titleid FROM %s);" % (files_joined, tbl[0]))
                list_id = cursor.fetchall()
                sql_list = []
                for tmp_GameID in list_id :
                        GameID = tmp_GameID[0].replace("'", "")
                        print(" Processing GameID: %s... " % GameID, end='')
                        cusa = get_game_info_by_id(GameID)
                        if(cusa.is_usable == True) :
                                sql_list.append(value_format
                                        % (cusa.sfo['TITLE_ID'], cusa.sfo['CONTENT_ID'], cusa.sfo['TITLE'], cusa.sfo['TITLE_ID'], cusa.size))
                                print("Completed %d" % cusa.size)
                        else :
                                print("Ignoring")

                if(len(sql_list) > 0) :
                        cursor.execute("INSERT INTO %s VALUES %s;" % (tbl[0], ', '.join(sql_list)))

print('')
print('')
print('')

print("Processing table: tbl_appinfo")

cursor.execute("SELECT DISTINCT T.titleid FROM (SELECT titleid FROM %s) T WHERE T.titleid NOT IN (SELECT DISTINCT titleid FROM tbl_appinfo);" % (" UNION SELECT titleid FROM ".join(tbl_appbrowse)))
missing_appinfo_cusa_id = cursor.fetchall()
for tmp_cusa_id in missing_appinfo_cusa_id :
        game_id = tmp_cusa_id[0]
        print(" Processing GameID: %s... " % game_id, end='')
        cusa = get_game_info_by_id(game_id)
        if(cusa.is_usable == True) :
                sql_items = appinfo.get_pseudo_appinfo(cusa.sfo, cusa.size)
                for key, value in sql_items.items():
                        cursor.execute("INSERT INTO tbl_appinfo (titleid, key, val) VALUES (?, ?, ?);", [game_id, key, value])
                print("Completed")
        else :
                print("Skipped")

conn.commit()

conn.close()

ftp.cwd('/system_data/priv/mms/')
file = open(app_db,'rb')
ftp.storbinary('STOR app.db', file)
file.close()
 
Status
Not open for further replies.
Back
Top