mtheall / ftpd Goto Github PK
View Code? Open in Web Editor NEWFTP Server for 3DS/Switch
License: GNU General Public License v3.0
FTP Server for 3DS/Switch
License: GNU General Public License v3.0
Hi there – currently, the FTP server only supports the LIST
command for directory listings. Although this is fine, it’s a difficult format for some libraries to parse. The MLSD
command, on the other hand, provides a standardized, easily-dealt-with response that would help library development.
Info on the command: https://tools.ietf.org/html/rfc3659#page-23
Would it be possible to include this command?
This isn't necessarily a problem with ftpd, but when I launch ftpd, my 3DS gets assigned an unusual IP address, and I can no longer connect to it using filezilla. My IP address was 10.0.1.7, has something similar occurred to anyone else?
Hi,
I had no trouble building it (I got the 3dsx file and all without error) and copied it in the 3ds/ftpbrony folder on my sd card. But homebrew launcher won't recognize it. Is it meant to work this way?
A few documentation lines could help, please.
Yes, I do know I have posted this before and you should know too, but I have found something that is not too expensive on the resources side of the 3DS. This will allow FTP over TLS on the 3DS without using way too much resources if you go to and use matrixssl , as I read it says that matrixssl is very lightweight meaning that you know, it would not use so much resources to create a FTP over TLS connection. Just go to matrixssl.org and you will see it. You should also enable a password (which should be optional too) that can be changed so nobody can accidentally or purposefully access the 3DS system and mess up some files in it. I ended up finding matrixssl just by doing a tiny bit of research, but I guess this might help or not.
I tried to delete my home menu extdata folder in preparation for downgrading, but it gave me the error:
unlink: 2 No such file or directory
Im using this with rxtools. Installed the CIA no Problem. Displaying the Ip number 192.168.1.30 Port 5000. Tried to connect via firefox (ftp://192.168.1.30:5000) not working. Tried to connect via Filezilla not working.
Edit. Solved it myself. 3ds was running on guest network where i locked access to local network. well stupid me :D
I compiled the latest commit as a .cia (both with and without #47 fixed), and it crashes to the "An error has occurred. Hold down the ..." screen for me and a few others. However, people in the #cakey IRC channel reported that the .CIA I compiled works fine on O3DS, so this issue appears to be N3DS only; might be USA only as well, no one with a EUR/JPN unit was around to test. ErrDisp seems to say that the Home Menu is complaining about fs not finding something:
FATAL ERROR
PID: 0x00040030_00008F02
REV: 61806
AID: 0xFFFFFFFF_FFFFFFFF
ADR: 0x00229338
RSL: 0xC8804478
Level: -7 (this should be 25, some sort of display error)
Summary: 4
Module: 17
Desc: 120
As the issue states.
If there are too many files/folders in a single directory, file list will fail. I don't know the exact number of files that triggers this.
This could also explain why dumping a directory with 149 files won't properly work (Pokemon Rumble World savegame)
Not a big issue, but a few folks in #cakey noticed if you attempt to build ftpd as a CIA, the icon isn't generated properly and results in the CIA having a blank square for an icon. The issue seems to be the smdh generation in Makefile.3ds being commented out:
#$(OUTPUT).smdh : $(APP_ICON)
# @bannertool makesmdh -s "$(APP_TITLE)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -i $(APP_ICON) -o $@
# @echo "built ... $(notdir $@)"
The icon was generated correctly when those lines were un-commented out.
Not sure which commit changed things but I just built ftpd with a fresh clone and all directories show up as files that can't be downloaded. I use filezilla.
The ftp server is so slow.
I noticed the socket send/recv buf is only 8192 and try to increase it.
Get error message: "22 Invalid Argument".
Anything wrong? Or just not support to change it?
Here is the code I add in function ftp_set_socket_nonblocking.
int rcvbuf, sndbuf;
socklen_t len = 4;
getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, &len);
console_print(YELLOW "SO_RCVBUF = %d len %d (before set it)\n" RESET, rcvbuf, len);
rcvbuf *= 2;
if(setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf)) < 0) {
console_print(RED "setsockopt: %d %s\n" RESET, errno, strerror(errno));
}
getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, &len);
console_print(YELLOW "SO_RCVBUF = %d (after set it)\n" RESET, rcvbuf);
getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, &len);
console_print(YELLOW "SO_SNDBUF = %d len %d (before set it)\n" RESET, sndbuf, len);
sndbuf *= 2;
if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf)) < 0) {
console_print(RED "setsockopt: %d %s\n" RESET, errno, strerror(errno));
}
getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, &len);
console_print(YELLOW "SO_SNDBUF = %d (after set it)\n" RESET, sndbuf);
Normal servers send 220 after logging in to indicate that it it ready for the new client. As ftbrony doesn't send this after someone logs in some clients just throw an error and don't connect.
Very, VERY big issue. Totally not kidding.
You really gave the haters this point?
User anonymous
230 OK
OPTS utf8 on
200 OK
SYST
215 UNIX Type: L8
502 Invalid command "sitehelp"
https://en.wikipedia.org/wiki/List_of_FTP_commands
Inspect SITE HELP
output for complete list of supported commands.
It only reacts after additional FTP commands. In Windows Explorer, f.e. you have to push the B Button on the 3DS (seemingly nothing happens) -> refresh or change the folder in Windows Explorer (it fails in WIndows Explorer, but on the 3DS you get the "Push B to quit message") -> push B again to quit.
I think (I'm not sure) the reason is in the ftp_session_read_command(ftp_session_t *session) function, more specifically in the line saying:
rc = recv(session->cmd_fd, buffer, sizeof(buffer), 0);
No idea how to properly fix this yet, though.
Respond 230 or something like that.
It's easy for linux version.
3ds's fstat seems not get st_mtime?
At any moment I press B then it shows "Press the Home Button to exit", no button functions any more so I need to hard shutdown the device
using ftpd.cia via Luma3DSv6.1.1
ftpd v2.2-17f1036c
JPN 3DSL sys v11.0 (arm9ed)
GREAT app. Could we get a toggle button that shuts the screen off while transferring? FTPing 20GB takes a long time - would be GREAT if we could just toggle off the screens. Thanks!
Hey,
Dolphin (the KDE file manager for Linux) uses the FTP SIZE command to show file sizes in the GUI. It would be great if this could be implemented.
I compiled devkitARM release 45 with libctru-0.6.0.
Next I tried to make build of ftpd:
Log:
https://dl.dropboxusercontent.com/u/97349870/ftpd-dff661c-build.log
Folders with a large total file size (i.e. multiple cart dumps) can be opened on the client, but show nothing inside of them. Total file size in the folder when this happened was a little over 2.2 GB, and individual file sizes ranged from 256 MB to 1 GB. Files in this folder showed up fine on the client when the total size in the folder was ~1.2 GB. I don't know enough about FTP to know if this is an inherent limitation or not, or if it is related to issue #38, which covered large individual files.
Anyway, I thought I should let you know just in case you didn't already. Thank you for a great program!
why FTDP doesn't work when there's no internet but the router wifi works fine... i mean, both 3ds and PC still are conected in the local network...
thanks...
A more secure and error free way of transferring files wirelessly.....so if a file transfers over corrupted, it will re-do the transfer or at least redownload the corrupted bits, whereas without TLS, you wouldn't know if the file is corrupted or not on transfer until you try out the file in whatever program it is you need it for and it turns out to be a dud....requiring you to re-transfer the file again...
IDK why, but old versions of FTPD don't give me this problem. version 1.0 of FTBrony was snappier (and had a really unique interface), I clicked connect, it went ahead and did that. Now... I have to wait like 20 secs, even 30, when the FTP client says timeout... Why does this happen? And does it happen to me only? Filezilla keeps telling me waiting for welcome message, and WinSCP just spits up timeouts.
I can't download from my 3ds file with size more than 2147476592 bytes (it's near 2 Gb).
What the title says. While ftpd is waiting for wifi, I can't exit via B. I instead get a red errormessage.
Server: 3DS ftpd v2.2
Client: Linux curlftpfs
Checked with Wireshark:
SIZE SEF10171519_boot11_00.bin
502 Invalid command "SIZESEF10171519_boot11_00.bin"
Note that in the response to the SIZE
command, the space between command and argument is missing. Could this indicate a processing error in the ftpd
or just a formatting error in the reply?
Tried uploading a .mp3 using FileZilla Client for Windows, but it keeps saying "Replace file" - do idea why this happens...
Doesn't work with ES File Explorer for Android or XBMC, either.
Thanks for the Homebrew!
I currently use FTPD for transferring things such as CIA files and ROMFS files, but some of the files are large and then after a long period of time, FTPD decides to close the connection to the client that is in the middle of a large transfer. This doesn't happen when you transfer lots of amounts of small files. I managed to stop it from timing out by opening an unopened folder to request some file data from the folders to prevent it from closing the connection. This gets very annoying after a while.
BTW, I can't use the SD card on my PC because it says that the file format is unrecognized, so my only option is FTPD, especially because I have used more than 8GB of storage on my SD card.
Not really an issue, just curiosity:
On startup it seems to connect to ~2 Nintendo servers
52.27.236.3:443 and 69.25.139.139:443
Something related to the used libraries?
make[1]: Entering directory '/home/adrian/ftpd'
console.c
arm-none-eabi-gcc -MMD -MP -MF /home/adrian/ftpd/build/console.d -g -Wall -O3 -mword-relocations -march=armv6k -mtune=mpcore -mfloat-abi=hard -DSTATUS_STRING="\"ftpd v2.2\"" -I/home/adrian/ftpd/include -I/home/adrian/devkitPro/libctru/include -I/home/adrian/ftpd/build -DARM11 -D_3DS -c /home/adrian/ftpd/source/console.c -o console.o
/home/adrian/ftpd/source/console.c: In function 'print_tcp_table':
/home/adrian/ftpd/source/console.c:73:10: error: unknown type name 'SOCU_TCPTableEntry'
static SOCU_TCPTableEntry tcp_entries[32];
^
/home/adrian/ftpd/source/console.c:81:8: warning: implicit declaration of function 'SOCU_GetNetworkOpt' [-Wimplicit-function-declaration]
rc = SOCU_GetNetworkOpt(SOL_CONFIG, NETOPT_TCP_TABLE, tcp_entries, &o ^
/home/adrian/ftpd/source/console.c:81:27: error: 'SOL_CONFIG' undeclared (first use in this function)
rc = SOCU_GetNetworkOpt(SOL_CONFIG, NETOPT_TCP_TABLE, tcp_entries, &o ^
/home/adrian/ftpd/source/console.c:81:27: note: each undeclared identifier is reported only once for each function it appears in
/home/adrian/ftpd/source/console.c:81:39: error: 'NETOPT_TCP_TABLE' undeclared (first use in this function)
rc = SOCU_GetNetworkOpt(SOL_CONFIG, NETOPT_TCP_TABLE, tcp_entries, &o ^
/home/adrian/ftpd/source/console.c:86:36: error: 'SOCU_TCPTableEntry' undeclared (first use in this function)
for(i = 0; i < optlen / sizeof(SOCU_TCPTableEntry); ++i)
^
/home/adrian/ftpd/source/console.c:88:27: error: 'entry' undeclared (first use in this function)
SOCU_TCPTableEntry *entry = &tcp_entries[i];
^
/home/adrian/ftpd/source/console.c:95:14: error: 'TCP_STATE_CLOSED' undeclared (first use in this function)
case TCP_STATE_CLOSED:
^
/home/adrian/ftpd/source/console.c:97:14: error: 'TCP_STATE_LISTEN' undeclared (first use in this function)
case TCP_STATE_LISTEN:
^
/home/adrian/ftpd/source/console.c:99:14: error: 'TCP_STATE_ESTABLISHED' undeclared (first use in this function)
case TCP_STATE_ESTABLISHED:
^
/home/adrian/ftpd/source/console.c:101:14: error: 'TCP_STATE_FINWAIT1' undeclared (first use in this function)
case TCP_STATE_FINWAIT1:
^
/home/adrian/ftpd/source/console.c:103:14: error: 'TCP_STATE_FINWAIT2' undeclared (first use in this function)
case TCP_STATE_FINWAIT2:
^
/home/adrian/ftpd/source/console.c:105:14: error: 'TCP_STATE_CLOSE_WAIT' undeclared (first use in this function)
case TCP_STATE_CLOSE_WAIT:
^
/home/adrian/ftpd/source/console.c:107:14: error: 'TCP_STATE_LAST_ACK' undeclared (first use in this function)
case TCP_STATE_LAST_ACK:
^
/home/adrian/ftpd/source/console.c:109:14: error: 'TCP_STATE_TIME_WAIT' undeclared (first use in this function)
case TCP_STATE_TIME_WAIT:
^
/home/adrian/devkitPro/devkitARM/base_rules:84: recipe for target 'console.o' failed
make[2]: *** [console.o] Error 1
Makefile.3ds:133: recipe for target 'build' failed
make[1]: *** [build] Error 2
make[1]: Leaving directory '/home/adrian/ftpd'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2
Also, is there a CIA version?
This is rather an enhancement than a bug, but would adding .CIA / .3DS build goals be possible? It has been done, f.e. in this fork of ftpd:
https://github.com/FloatingStar/FTP-GMX
It requires including a few additional binaries (bannertool, makerom, info.rsf). For the two executables - those could be included as submodules and compiled from source (so that it will still be platform independent).
I'd be willing to do the pull request for this if you are interested.
For example using a 5 bar system, all five bars coloured in = perfect as can be signal, 4 out of 5 = 80% signal strength, 3 out 5 = 60% signal strength, 2 out of 5 = 40% signal strength, 1 out of 5 = 20% signal strength and no bars coloured = WiFi turned off or no WiFi is found because the signal is so weak that it can't even connect.
Or could use a more detailed method using percentages from 0% to 100% rather than bars of signal which would work too.
And assuming you will be transferring over large amounts of files or a large file, a battery indicator would be nice, either a detailed percentage 0 to 100%, estimated remaining time left of battery or a bar method works too.
This really needs a secure connection and a password that is optional and changeable to connect to it safely.
The CIA build at during the time of this commit seemed to be fine according to @ihaveamac but the CIA has since broken resulting in the issue present in #47 despite none of the actual code changing since then.
Cannot change directories to folders that have special characters (i.e. é in "Pokémon")
Using Chrome browser as client, the following commands are sent giving the errors;
SIZE /
-> 550 Could not get file size.
LIST -l
-> 550 No such file or directory
Only a minor issue, since there are other working clients.
Using heimdal-ftp on Linux, I try to connect and manage to connect. Then I do a ls or get. The result: ftpd displays "502 Invalid command "EPRT|1|192.168.1.2|52727"
It then locks up and refuses to respond to the Home button or anything else until the ls command times out.
It shouldn't lock up, and also you'd probably be better off returning a response code 522 indicating that you don't support ipv6.
I am able to connect using other ftp clients that apparently don't try to use ipv6.
The server sends out a 502 unavailable
, and then 421 Service not available, remote server has closed connection
.
I dont really know if this is because is scripter behavior to define the platforms, but i dont really know why youre doing this.
Recieveing any spotpass item breaks ftpd, and causes repeated spam of error 22 until you close the app.
Console: N3DS 11.1
Version: 2.2 CIA
When I closed the console, screen went black and transfer stopped. When opening the lid, screen is off and the console is frozen.
I installed your app via the qr code and wanted to transfer a file to the 3ds but it was read only. Then I turned off the console. When I now try to start my console the screen just keeps black.
We tried to make on Linux but got error report saying a lot of variables not declared. . . I saw there's an update post on devkitARM. . Not on 3ds so I am not very sure if the not compiling issue is generated by that.
What I do is just go to the folder where I put every code and makefiles. Then I type make
Or if anyone can tell me if it still compile on Windows? And how about after installing the devkitARM last update on Nov 16
main.c: the correct way to handle APT in the latest ctrulib is
while(aptMainLoop())
{
// code here
}
http://gbatemp.net/attachments/ftbrony-zip.12403/
I don't know pull requests ;P I built and added images and rsf to make a .cia, feel free to use/abuse/delete as you see fit. Cheers for awesome app!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.