[DEV] param.sfo parsing class in Ruby.

FennyFatal

Perma-banned by Server OP
Original poster
Coder
Donor
회원 | Member
May 14, 2018
7
2
This is a simple parser written in Ruby. It has the capability to check system firmware version requirements on a PKG file without downloading the whole thing.

To use: you will need to install the http, and bindata gems.
Git clone this repo, and follow instructions in readme: https://github.com/FennyFatal/param_sfo_tools
 
Last edited:
from where does it pull the db ?
It downloads the first 2MB from the provided pkg URL, then extracts the param.sfo, and parses out the information from there.

Code:
~/ps4tools/param_sfo$ ./get_sfo_info.rb http://gs2.ww.prod.dl.playstation.net/gs2/appkgo/prod/CUSA00016_00/3/f_532be3d0389a65b89ecbd892f96a361dce5d55b011953f7dd3803a110bd6e2a1/f/EP0001-CUSA00016_00-WATCHDOGS0000000_0.pkg
APP_TYPE: ["00000001"]
APP_VER: 01.00
ATTRIBUTE: {:display_location_flag=>0, :unknown_value_15=>0, :supports_HDR=>0, :unknown_value_14=>0, :unknown_value_13=>0, :requires_PSVR=>0, :unknown_value_12=>0, :unknown_value_11=>0, :support_NEO_mode_on_PRO=>0, :unknown_value_10=>0, :unknown_value_9=>0, :unknown_value_8=>0, :unknown_value_7=>0, :unknown_value_6=>0, :unknown_value_5=>0, :cpu_mode_7cpu=>0, :cpu_mode_6cpu=>0, :psvr_support=>0, :unknown_value_4=>0, :unknown_value_3=>0, :unknown_value_2=>0, :hdcp_disalbed_non_games=>0, :hdcp_enabled=>0, :suspend_on_output_resolution_change=>0, :unknown_value_1=>0, :share_button_overriden=>0, :common_dialog_accept_system_setting=>0, :suspend_on_lose_focus=>0, :stereoscopic_3d=>0, :ps_move=>0, :common_dialog_accept_is_cross=>1, :support_logout=>0}
CATEGORY: gd
CONTENT_ID: EP0001-CUSA00016_00-WATCHDOGS0000000
DOWNLOAD_DATA_SIZE: ["00000000"]
FORMAT: obs
PARENTAL_LEVEL: ["00000009"]
PUBTOOLINFO: c_date=20140416,sdk_ver=01600000,st_type=bd25,img0_l0_size=20846,img0_l1_size=0,img0_ch_size=26
REMOTE_PLAY_KEY_ASSIGN: ["00000000"]
SERVICE_ID_ADDCONT_ADD_1:
SERVICE_ID_ADDCONT_ADD_2:
SERVICE_ID_ADDCONT_ADD_3:
SERVICE_ID_ADDCONT_ADD_4:
SERVICE_ID_ADDCONT_ADD_5:
SERVICE_ID_ADDCONT_ADD_6:
SERVICE_ID_ADDCONT_ADD_7:
SYSTEM_VER: ["01610000"]
TITLE: WATCH_DOGS

TITLE_ID: CUSA00016
VERSION: 01.02

In the above example the PKG file requires 1.61 system FW.
 
It downloads the first 2MB from the provided pkg URL, then extracts the param.sfo, and parses out the information from there.

Code:
~/ps4tools/param_sfo$ ./get_sfo_info.rb http://gs2.ww.prod.dl.playstation.net/gs2/appkgo/prod/CUSA00016_00/3/f_532be3d0389a65b89ecbd892f96a361dce5d55b011953f7dd3803a110bd6e2a1/f/EP0001-CUSA00016_00-WATCHDOGS0000000_0.pkg
APP_TYPE: ["00000001"]
APP_VER: 01.00
ATTRIBUTE: {:display_location_flag=>0, :unknown_value_15=>0, :supports_HDR=>0, :unknown_value_14=>0, :unknown_value_13=>0, :requires_PSVR=>0, :unknown_value_12=>0, :unknown_value_11=>0, :support_NEO_mode_on_PRO=>0, :unknown_value_10=>0, :unknown_value_9=>0, :unknown_value_8=>0, :unknown_value_7=>0, :unknown_value_6=>0, :unknown_value_5=>0, :cpu_mode_7cpu=>0, :cpu_mode_6cpu=>0, :psvr_support=>0, :unknown_value_4=>0, :unknown_value_3=>0, :unknown_value_2=>0, :hdcp_disalbed_non_games=>0, :hdcp_enabled=>0, :suspend_on_output_resolution_change=>0, :unknown_value_1=>0, :share_button_overriden=>0, :common_dialog_accept_system_setting=>0, :suspend_on_lose_focus=>0, :stereoscopic_3d=>0, :ps_move=>0, :common_dialog_accept_is_cross=>1, :support_logout=>0}
CATEGORY: gd
CONTENT_ID: EP0001-CUSA00016_00-WATCHDOGS0000000
DOWNLOAD_DATA_SIZE: ["00000000"]
FORMAT: obs
PARENTAL_LEVEL: ["00000009"]
PUBTOOLINFO: c_date=20140416,sdk_ver=01600000,st_type=bd25,img0_l0_size=20846,img0_l1_size=0,img0_ch_size=26
REMOTE_PLAY_KEY_ASSIGN: ["00000000"]
SERVICE_ID_ADDCONT_ADD_1:
SERVICE_ID_ADDCONT_ADD_2:
SERVICE_ID_ADDCONT_ADD_3:
SERVICE_ID_ADDCONT_ADD_4:
SERVICE_ID_ADDCONT_ADD_5:
SERVICE_ID_ADDCONT_ADD_6:
SERVICE_ID_ADDCONT_ADD_7:
SYSTEM_VER: ["01610000"]
TITLE: WATCH_DOGS

TITLE_ID: CUSA00016
VERSION: 01.02

In the above example the PKG file requires 1.61 system FW.
COOL, how do u extract the title name ? since each game have its own offset where it holds the title of the name

i made here, a little script that pull out all the cusa names in the same directory.
https://ayakalounge.me/threads/nice-site-to-find-update-packages.1164/#post-12184

could be great if i could also add names to it . but i am not sure about the offset that u use. perhaps u could do that with python ?
im not good with ruby.
 
Last edited:
COOL, how do u extract the title name ? since each game have its own offset where it holds the title of the name

i made here, a little script that pull out all the cusa names in the same directory.
https://ayakalounge.me/threads/nice-site-to-find-update-packages.1164/#post-12184

could be great if i could also add names to it . but i am not sure about the offset that u use. perhaps u could do that with python ?
im not good with ruby.

I scan for magic in param.sfo, then I parse the header. You can see the structure of the header in SFO.rb.
You can calculate the offset of the value you are looking for by parsing the struct that contains each entry which will tell you the start and end offset from the SFO magic value.
 
I scan for magic in param.sfo, then I parse the header. You can see the structure of the header in SFO.rb.
You can calculate the offset of the value you are looking for by parsing the struct that contains each entry which will tell you the start and end offset from the SFO magic value.
i am not to good with ruby, i am pretty bad actualy (dont know how to code it)
i think u should add flags with ur code such as -u for url or -l for local. and be able to parse those info from a local files / files/ folder
 
i am not to good with ruby, i am pretty bad actualy (dont know how to code it)
i think u should add flags with ur code such as -u for url or -l for local. and be able to parse those info from a local files / files/ folder

It will actually work that way now.

Code:
~/ps4tools/param_sfo$ get_sfo_info EP0001-CUSA00016_00-WATCHDOGS0000000_0.pkg
APP_TYPE: 00000001
APP_VER: 01.00
ATTRIBUTE: {:display_location_flag=>0, :unknown_value_15=>0, :supports_HDR=>0, :unknown_value_14=>0, :unknown_value_13=>0, :requires_PSVR=>0, :unknown_value_12=>0, :unknown_value_11=>0, :support_NEO_mode_on_PRO=>0, :unknown_value_10=>0, :unknown_value_9=>0, :unknown_value_8=>0, :unknown_value_7=>0, :unknown_value_6=>0, :unknown_value_5=>0, :cpu_mode_7cpu=>0, :cpu_mode_6cpu=>0, :psvr_support=>0, :unknown_value_4=>0, :unknown_value_3=>0, :unknown_value_2=>0, :hdcp_disalbed_non_games=>0, :hdcp_enabled=>0, :suspend_on_output_resolution_change=>0, :unknown_value_1=>0, :share_button_overriden=>0, :common_dialog_accept_system_setting=>0, :suspend_on_lose_focus=>0, :stereoscopic_3d=>0, :ps_move=>0, :common_dialog_accept_is_cross=>1, :support_logout=>0}
CATEGORY: gd
CONTENT_ID: EP0001-CUSA00016_00-WATCHDOGS0000000
DOWNLOAD_DATA_SIZE: 00000000
FORMAT: obs
PARENTAL_LEVEL: 00000009
PUBTOOLINFO: c_date=20140416,sdk_ver=01600000,st_type=bd25,img0_l0_size=20846,img0_l1_size=0,img0_ch_size=26
REMOTE_PLAY_KEY_ASSIGN: 00000000
SERVICE_ID_ADDCONT_ADD_1:
SERVICE_ID_ADDCONT_ADD_2:
SERVICE_ID_ADDCONT_ADD_3:
SERVICE_ID_ADDCONT_ADD_4:
SERVICE_ID_ADDCONT_ADD_5:
SERVICE_ID_ADDCONT_ADD_6:
SERVICE_ID_ADDCONT_ADD_7:
SYSTEM_VER: 01610000
TITLE: WATCH_DOGS™
TITLE_ID: CUSA00016
VERSION: 01.02