BenMatteson / CS410_Agile_Group2

CS410 Agile Practice Project - FTP Client
0 stars 2 forks source link

Add Interactive Shell #35

Closed BenMatteson closed 5 years ago

BenMatteson commented 5 years ago

closes #34

eddiekelleypdx commented 5 years ago

This appears to be connecting correctly using plaintext authentication. The interactive shell / commands are also working properly (make sure you're using Python3! v.2.x doesn't use the input() function the same as v.3).

BenMatteson commented 5 years ago

yeah, it's running in 3.7. good to check though. I don't really have an issue with that, but pycharm does. :P it actually flags catching Exception as a bad thing, so I'm going to do some research I guess on why that would be because unlike style things it doesn't cite why it says that.

eddiekelleypdx commented 5 years ago

PyCharm is probably complaining because we're catching the base Exception class rather than some subclass (i.e., we aren't getting specific enough). The exception being thrown when the get command's "get_help.txt" file isn't found is the ModuleNotFoundError - maybe we should just look for that exception, and deal with it accordingly (report that the command isn't found, etc.)? That way, other (more serious?) exceptions will cause the script to crash (as it should).

This has some info on why catching any exception is bad: https://docs.python.org/2/howto/doanddont.html#except

BenMatteson commented 5 years ago

Yeah, catching that error specifically I'm 100% behind, I forgot I never actually tested it without creating the help file

BenMatteson commented 5 years ago

hmm, so I'm getting a FileNotFoundError is it something other than a missing file on your end? or is it just a difference of OS? what version if python are you using?

eddiekelleypdx commented 5 years ago

Holy crap - I'm sorry for randomly copying&pasting exceptions from my Terminal window... You're correct, the one being thrown is FileNotFoundError (when a non-existent command is referred to from help), sorry to confuse.

eddiekelleypdx commented 5 years ago

This is looking good after suppressing the deprecation warnings, and I haven't seen any fallout after moving the commands from the Command class to SFTP.

ppdom commented 5 years ago

When I try to connect to ada.cs.pdx.edu or any other pdx.edu host I get the "Connection Sucessful!" message but when I log into the host via ssh and run the who command my username only appears once. Likewise when I type quit in the interactive shell and log into the host via ssh the last login message isn't affected by the ftp session. Am I doing something wrong or is it not really connecting?

EDIT: Maybe I should read the issue # first. Sorry. This is just the interactive shell without any log in functionality, right?

eddiekelleypdx commented 5 years ago

SSH logins may not be considered the same as SFTP logins, even though SFTP uses SSH as a transport layer. When connected via SFTP, it may not update the last login date & time either. Technically, who will show users that are logged into a TTY, but since you're connected over SFTP, you don't have a TTY (and thus, shouldn't show up when running who). If you run a command like ps aux | grep "sshd: username" (where username is your PSU ID), you'll probably see an sshd connection/process running for your terminal session (with something like ptys/0), and you should also see one that doesn't indicate a TTY with a bare sshd: username while connected with SuperCoolSFTPClient_v.1.0

ppdom commented 5 years ago

Great point Eddie. I didn't consider that. I tried ps aux | grep "sshd: myusername" and it looks like the connection is working.