mirror of
https://github.com/seregonwar/zftpd.git
synced 2026-10-21 19:22:28 -05:00
v1.2.1
Convert TARGET to lowercase in the Makefile so values like PS4/PS5 match rules; update the test target to include OUTPUT_BIN and only run test binaries on linux/macos (skip otherwise). Expand README with feature notes, supported FTP commands, and ZHTTP (web file explorer) usage/security/build details. In src/pal_fileio.c, broaden the FreeBSD-style sendfile branch to also cover PLATFORM_PS4 and PLATFORM_PS5 so those platforms use the same sendfile path.
zftpd - Zero-copy FTP Daemon compatible with all POSIX systems
Multi-platform FTP server designed to run both as a POSIX binary (Linux/macOS) and as a console payload (PS3/PS4/PS5).
Key Features
- Zero-copy data path where available (
sendfilefast path; falls back to buffered I/O when encrypted) - Robust TCP I/O (partial sends, EINTR, backpressure-aware send buffers)
- Control/data channel timeouts + session idle timeout
- Path hardening (canonicalization, traversal blocking, optional safe-list for /dev, /proc, /sys)
- Structured per-session logging + stats (bytes/files sent/received)
- Transfer rate limiting (token bucket, compile-time toggle)
- Resume uploads via
REST+STOR; append uploads viaAPPE - Optional ChaCha20 stream cipher (
AUTH XCRYPT) with PSK - On-screen notifications on PS4/PS5 (IP/port and status)
- Optional ZHTTP web file explorer (compile-time, enabled by default on PS4/PS5)
Supported FTP Commands
- Authentication & control:
USER,PASS,QUIT,NOOP - Navigation:
CWD,CDUP,PWD - Listing:
LIST,NLST,MLSD,MLST(MLST minimal) - Transfer:
RETR,STOR,APPE,REST - File management:
DELE,RMD,MKD,RNFR,RNTO - Data connection:
PORT,PASV - Information:
SIZE,MDTM,STAT,SYST,FEAT,HELP - Transfer parameters:
TYPE,MODE,STRU - Encryption (opt-in):
AUTH XCRYPT(ChaCha20 PSK)
Build
Artifacts are placed in build/<target>/<build_type>/.
Requirements
- C11 Toolchain (gcc/clang) +
make - To generate
.bin:objcopy(binutils or llvm-objcopy). Alternatively, use SDK wrappers:- PS4:
OBJCOPY=orbis-objcopy - PS5:
OBJCOPY=prospero-objcopy
- PS4:
- PS4:
PS4_PAYLOAD_SDKset - PS5:
PS5_PAYLOAD_SDKset
Commands
# Linux
make TARGET=linux
# macOS
make TARGET=macos
# PS4
make TARGET=ps4
# PS5
make TARGET=ps5
# Debug build
make TARGET=linux BUILD_TYPE=debug
Output (what to use)
Artifacts are versioned and platform-tagged (examples):
- Linux:
build/linux/release/zftpd-linux-<arch>-v<version>.elf - macOS:
build/macos/release/zftpd-macos-<arch>-v<version> - PS4:
build/ps4/release/zftpd-ps4-v<version>.bin+zftpd-ps4-v<version>.elf - PS5:
build/ps5/release/zftpd-ps5-v<version>.bin+zftpd-ps5-v<version>.elf
Running (Daemon) by Platform
Linux
./build/linux/release/zftpd-linux-<arch>-v<version>.elf
Useful options (POSIX only): -p <port> and -d <root>.
macOS
./build/macos/release/zftpd-macos-<arch>-v<version>
PS4
- Requires a payload loader (e.g. WebKit/PPPwn/Netcat/GoldHEN).
zftpddoes not require a resident "HEN", but must be launched by a loader/exploit. - If the loader expects a
.binpayload: sendbuild/ps4/release/zftpd-ps4-v<version>.bin. - If the loader accepts ELF: you can choose between
build/ps4/release/zftpd-ps4-v<version>.binandbuild/ps4/release/zftpd-ps4-v<version>.elf.
On startup, it shows a notification with IP and port.
PS5
- Requires a payload loader (etaHEN/Netcat/equivalent loader).
- If the loader expects a
.binpayload: sendbuild/ps5/release/zftpd-ps5-v<version>.bin. - If the loader accepts ELF: you can choose between
build/ps5/release/zftpd-ps5-v<version>.binandbuild/ps5/release/zftpd-ps5-v<version>.elf.
On startup, it shows "started" notifications + FTP: <ip>:<port>.
Configuration
Compile-time configuration is in ftp_config.h. Useful macros:
FTP_DEFAULT_PORT(PS4/PS5 default 2122, POSIX default 2121)FTP_MAX_SESSIONSFTP_SESSION_TIMEOUTFTP_TRANSFER_RATE_LIMIT_BPS/FTP_TRANSFER_RATE_BURST_BYTESFTP_LOG_COMMANDS
Notes
- If you see "payload already loaded" on PS4/PS5, it means an instance is already active (dedup). The new daemon will try to terminate the old instance and start a new one on port
FTP_DEFAULT_PORT:2122. If that fails, it will try the next portFTP_DEFAULT_PORT+1:2123up to a maximum of 9 subsequent ports. - For host testing:
make TARGET=linux testormake TARGET=macos test.
ZHTTP (Web File Explorer)
- What it is: Lightweight web UI to browse, download, and (optionally) upload files from a browser.
- Enable/disable: On by default on PS4/PS5. Disabled by default elsewhere. Override with
ENABLE_ZHTTPD=1or disable withENABLE_ZHTTPD=0at build time (e.g.,make TARGET=ps5 ENABLE_ZHTTPD=0). - Build impact: Adds HTTP modules (
event_loop_kqueue,http_server,http_parser,http_response,http_api,http_csrf,http_resources). - Usage: After starting the daemon, open
http://<ip>:<port>/(port matches the configured FTP port). Shows a file explorer with breadcrumb, direct download, and—if built withENABLE_WEB_UPLOAD=1(enabled alongside ZHTTP)—an upload button. - Security: Intended for LAN/payload scenarios; no additional auth beyond local network context. Keep the port closed on WAN.
Support
If you find zftpd useful and would like to support its ongoing development, consider making a donation. Any contribution is greatly appreciated!
License
MIT — see LICENSE.
Description
Zero-copy FTP/HTTP Daemon compatible with all POSIX systems
17 MiB
0 Stars
1 Watchers
0 Forks
Releases
9
zftpd v1.6.0
Latest
Languages
C
64.5%
JavaScript
19.5%
CSS
8.2%
HTML
2.9%
Makefile
2%
Other
2.9%