I state that this small program can be very useful to those who frequently use the FTP protocol
Today I show you a program that for many can be interesting, but at the same time it may seem silly to many 🙂
The FTP protocol is one of the most frequently used network protocols. The most used protocol is HTTP, the one we use every day to do research, etc ...
- The FTP (File Transfer Protocol) is available on the 21 port and serves mainly to download files. Each web browser interprets the layout of the FTP site page in a different way.
Both protocols have the ability to use encrypted connections, namely SSL or TLS (HTTPS, FTPS).
HTTPS is now increasingly used, and it is good that this is the case, a network sniffer (ES. The powerful Wireshark) sniffing the packets passing through the network, its possibility to find Pippo's username and password (an example) is almost impossible , or even if they succeeded in sniffing the data they are encrypted according to a specific algorithm md5 or sha1 (if I'm not wrong).
After this parenthesis we see the program
Meanwhile we download the source code with this command from the command line:
$ git clone https://github.com/StefanoBelli/ftp-handler then run a change directory:
$ cd ftp-handler
and we execute "./Install.sh" as root users
then we run the ftph command to see if the program is usable:
The syntax of use is:
ftph (debug level)
where it can correspond to:
ftp.debian.org, localhost (if you have an active FTP on your machine)
url can also be used for "- help" to get help in English.
and (debug level) [Not mandatory] may correspond to:
0,1,> = 2
In practice, when the second argument is specified, ftplib sends the request to the server to show it all the session information, which is shown on the screen.
The default value is 0,
1 requires minimal debugging,
while a value greater than or equal to 2 requires higher debugging.
What you see below is the login screen, leave it blank to enter anonymity.
If you have completed the login you will find yourself on this screen, which shows the warning for the 'h' command, the date and time of access to the server, information on who you are, the server's welcome message, information on current directory and its contents. That will always be present.
As soon as you execute a welcome message command, etc will disappear, but we don't mess up so the output is "cleaned" and then input is requested. This will continue until you execute the 'ex' command that is needed to exit the program and close the connection with the server.
In the "DIRECTORY" box there is the IP of the server and who is the user who is using that server.
Those blue 3 acute brackets represent the contents of the directory, the green ones the prompt waiting.
We execute the 'h' command to get help and see the commands we need.
It is mandatory to leave a space between one sentence and another.
Examples of commands:
osh # execute the local shell / bin / sh fcmd RETR something #execute FTP command ex #Exits the program md MY-DIR #create a cd directory MY-DIR #change the current directory rn MY-FILE FILE #change the names of MY -FILE to FILE rd MY-DIR #remove rf directory FILE #remove sz file FILE #display the size in Bytes of FILE dlb FILE local_file #Download FILE which will be renamed to local_file dile FILE_local #Same only in ASCII mode (search the web;)) ulb local_file #Upload a local file on the FTP server ula local_say file #Same thing only in ASCII mode
If you want to remove ftph, simply change the directory to ftp-handler and execute the command:
as root user.
To get the latest changes, run the following commands in the ftp-handler:
$ git pull # ./install.sh
Simply git scans the remote repository (origin), if the result is positive run install.sh, you will be shown a message saying that ftph is already present, so it will be overwritten.
Attention, due to special characters and some commands like "clear" the program does not work correctly on Windows
Interpreter: Python 2, / usr / bin / python2