Python jobs: Advanced FTP Programs

Source: Internet
Author: User
Tags file upload system log

Requirements:

    1. User encryption authentication
    2. Allow simultaneous multi-user logins
    3. Each user has their own home directory and can only access their home directory
    4. Disk quotas for users, with different free space per user
    5. Allow user to switch directories at random on FTP server
    6. Allow users to view files in the current directory
    7. Allows uploading and downloading of files to ensure file consistency
    8. Show progress bar during file transfer
    9. Additional features: Support for file breakpoint continuation

Program Flowchart:

Program Readme:

Miniftp is mainly composed of three parts: Server side, client, management side. This article is mainly about the above three parts of the content.

System Initial Configuration

Administrator account

User name: admin Password: password

User account:

User name: Zhangsan Password: 123

Server address:

ip:127.0.0.1 port:8808

Server-side

Server-side is mainly in the long-run monitoring state. After the call is started, there is no need to operate again.

File directory involved:

Bin folder : The server startup file is mainly placed, run the start file under this folder to start the server

Core folder : The central part of the main server program, involving the role of the file is as follows:

Heart.py is mainly the server and Terminal connection mode setting, with corresponding function module

record.py This file is a set of server log logs displayed and stored in the form

Data folder : The main is the storage, the folders and files involved in the following functions:

Conf folder: Store configure.py file, this file is the default parameter configuration, the default content such as:

Here is the address and port where the current server is monitored, which can be changed here for practical use.

Another more important is the administrator's account and password, this program does not support the change of administrator account and password, but the administrator account and password is used by the Administrator program, ordinary user program use invalid.

Docs folder : This folder is the main store of files uploaded to the server, the principle is to follow the user name to create the appropriate folder.

Log folder : This folder is stored in the system log, the system will be run by the date of the corresponding log file, the file name is: year-month-day. txt

Users folder : There are two files under this folder, one is Quota.txt, and the quota that the user is currently allowed to use is stored. One is UserAuth.txt, storing the information of the registered user.

Client:

Composition

The client section relates to Miniclient, which consists of a bin and core two folders.

Under the Bin folder, place the program's core file under the File Start.py;core folder where the programs start ccore.py

Function:

The client main interface is as follows:

The general user mainly involves the following functions:

Enter the wrong command to get the appropriate command prompt, input help will also get the corresponding command prompt, but only for simple command prompt,

Please refer to the following instructions for the specific command format:

1, put, upload files

Syntax: Put file name

PS. The progress bar here only supports the display in a CMD environment.

File upload supports the continuation of a breakpoint, that is, the client during the upload, an error caused the upload is not completed, log in again and upload the unfinished file, the system will continue to transfer. The premise is that the file MD5 value does not change.

    1. Get download file

Syntax: 1, get original filename destination file address and target filename

2, get the original user name

The progress bar here only supports the display in a CMD environment.

Does not specify a download directory, the system automatically selects the current running folder

      

The destination file address is provided and is automatically downloaded to the specified directory

      

2. Create a directory:

Syntax: mkdir folder name

3. Deleting a directory

Syntax: RM folder name/file name

4. Traverse the current directory for related information

Syntax: LS

5. Switch directories

Syntax: CD folder name

To return to the upper-level directory, you can use the CD. To switch

6. Display information for the current directory

Syntax: pwd

If you need to exit, you can simply enter "Bye" to exit the program.

Management side

Composition

The management side section is about Miniadmin, which consists mainly of bin and core two folders.

Under the Bin folder, place the program's core file under the File Start.py;core folder where the programs start acore.py

Function:

The administrator needs to communicate with the server using the private side, and the main functions displayed by the Administrator interface are as follows:

1. Registered users

Can register a regular user account that allows login to Zftp

2. Delete users

You can delete a regular user account that currently exists

3. View Users

You can view the current existing user account.

4. Modify Quotas

Can modify the space quota value of registered users

5. Exit

Exit system

Administrators are currently not supported to change their user name and password.

Fixed bug

1, the client port number specification to a reasonable range (0-65535).

2, the extension of the breakpoint, to solve the transmission terminal after the re-transmission caused by the abnormal MD5 value inconsistency problem.

3, the extension of the breakpoint, to resolve the client in the use of illegal files to replace the legitimate file caused MD5 value inconsistency, again with the legitimate file transmission still appear MD5 inconsistent situation.

4. Resolve the system crash caused by transferring files exceeding the space limit.

Attached: Brief description of the continuation of the breakpoint

1. Connect to the server using the client first

2. Uploading files and terminal client

3. Re-login to the server:

4. Re-upload

5. If you upload files with the same file name but different contents, you will get an error:

The server reports the following prompt:
  

The client reports the following prompt:

  

Code Link:

Link: Http://pan.baidu.com/s/1pKEXw5X Password: xikg

The above is for reference only, Hope not copy.

Python jobs: Advanced FTP Programs

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.