mirror of
https://github.com/LisherSong/ps5-web-file-manager.git
synced 2026-10-06 08:00:23 +02:00
Homebrew HTTP file manager payload for jailbroken PS5 consoles (x86_64-sie-ps5,
title id FMGR88888). Browse, edit, upload, download and extract ZIPs through
any browser on the LAN; single self-contained ELF, no external services.
Highlights (v1.7):
- ZIP large-file profile (large=1): 2 TiB total / 1 TiB per entry / 1000:1
ratio. Frontend prompts for confirmation whenever archive > 60 GiB on disk.
- Default ZIP profile stays safe: 512 GiB / 64 GiB / 200:1.
- 69 host-side C tests (tests/run-tests.sh) covering traversal, ZIP64,
encryption rejection, conflict policies and the large-file profile.
- Three-phase extraction engine (scan -> extract -> publish -> cleanup) with
atomic staging + rename, located in src/zip_extract.{c,h}.
Project layout:
src/ C payload sources
assets/ HTML / CSS / JS / icons / param.json
tests/ POSIX/host test suite + fixtures
third_party/ vendored zlib + minizip-ng (zlib license)
docs/screenshots/ README screenshot images
LICENSE GPLv3+
Build:
make # cross-compile with PS5_PAYLOAD_SDK
make linux # Linux host binary for UI dev
85 lines
2.2 KiB
Python
85 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
# encoding: utf-8
|
|
# Copyright (C) 2024 John Törnblom
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; see the file COPYING. If not see
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
import argparse
|
|
import gzip
|
|
import string
|
|
import mimetypes
|
|
|
|
|
|
tmpl = string.Template('''
|
|
void asset_register(const char*, const void*, unsigned long, const char*, const char*);
|
|
|
|
static const unsigned char data[] = $data;
|
|
|
|
__attribute__((constructor)) static void
|
|
constructor(void) {
|
|
asset_register("/$path", data, sizeof(data), $mime, $encoding);
|
|
}
|
|
''')
|
|
|
|
GZIP_MIMES = {
|
|
'application/javascript',
|
|
'application/json',
|
|
'text/css',
|
|
'text/html',
|
|
'text/javascript',
|
|
}
|
|
|
|
|
|
def cstr(value):
|
|
if value is None:
|
|
return '0'
|
|
return '"' + value.replace('\\', '\\\\').replace('"', '\\"') + '"'
|
|
|
|
|
|
def gen_data(data):
|
|
yield '{\n '
|
|
|
|
for n, b in enumerate(data, 1):
|
|
yield hex(b)
|
|
yield ', '
|
|
|
|
if n % 16 == 0:
|
|
yield '\n '
|
|
|
|
yield '\n}'
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('-p', '--path', default=None)
|
|
parser.add_argument('FILE')
|
|
args = parser.parse_args()
|
|
|
|
if args.path is None:
|
|
args.path = args.FILE
|
|
|
|
mime = mimetypes.guess_type(args.path)[0]
|
|
encoding = None
|
|
with open(args.FILE, mode='rb') as f:
|
|
payload = f.read()
|
|
if mime in GZIP_MIMES:
|
|
zipped = gzip.compress(payload, compresslevel=9, mtime=0)
|
|
if len(zipped) < len(payload):
|
|
payload = zipped
|
|
encoding = 'gzip'
|
|
|
|
data = ''.join(gen_data(payload))
|
|
print(tmpl.substitute(data=data, path=args.path,
|
|
mime=cstr(mime), encoding=cstr(encoding)))
|