Python job: Advanced FTP program, python job ftp

Source: Internet
Author: User

Python job: Advanced FTP program, python job ftp

 

Requirements:

 

 

Program flowchart:

 

Program Readme:

MiniFTP consists of three parts: Server, client, and management. This article mainly introduces the above three parts.

Initial System Configuration

Administrator Account

Username: admin password: password

User Account:

Username: zhangsan password: 123

Server address:

IP: Wagner. 0.0.1 Port: 8808

Server

The server is mainly in the long-term operation monitoring status. After the call is started, no further operation is required.

 

Involved file directory:

 

Bin folder: Mainly the server startup file. Run the start file in the folder to start the server.

Core folder: Mainly stores the core part of the server program. The file-related functions are as follows:

Heart. py is mainly used to set the connection mode between the server and the terminal. corresponding functional modules are provided internally.

Record. py this file is a set form of server log display and storage

Data folder: Mainly stores data. The folders and files involved are used as follows:

Conf Folder: stores the configure. py file, which serves as the default parameter configuration. The default content is as follows:

The address and port monitored by the current server are stored here. You can change the address and port to meet your actual needs.

Another important factor is the administrator's account and password. Currently, this program does not support changing the Administrator account and password, but the Administrator account and password are used by the Administrator program.

DocsFolder: This folder stores the files uploaded by the client to the server. The storage principle is to create the corresponding folders according to the user name.

Log folder: System logs are stored in this folder. After the system is running, the corresponding log file is generated by date. The file name is in the format of year, month, and day.

Users folder: There are two files under this folder. One is quota.txt, which stores the quota currently allowed by the user. Userauth.txt stores the information of the registered user.

 

Client:

Composition:

 

 

The Client involves MiniClient, which consists of Bin and Core folders.

The Start. py file where the program starts to be placed in the Bin folder; the Core file CCore. py of the program in the Core folder

Function:

 

The main interface of the client is as follows:

 

 

Common users mainly involve the following functions:

 

If an incorrect command is entered, a command prompt is displayed. If you enter help, a command prompt is displayed, but only a simple command prompt is displayed,

 

 

For details about the command format, refer to the following description:

1. put: upload files

 

Syntax: put file name

PS. The progress bar can only be displayed in the cmd environment.

Resumable upload is supported, that is, when an error occurs on the client during the upload process, the upload is incomplete. When you log on again and upload the file, the system continues to transfer the file. The premise is that the file MD5 value does not change.

Syntax: 1. get source file name target file address and target file name

2. get Original User Name

The progress bar can only be displayed in the cmd environment.

If the download directory is not specified, the system automatically selects the current running folder.

      

 

If the target file address is provided, it is automatically downloaded to the specified directory.

      

 

2. Create a directory:

Syntax: mkdir folder name

3. delete a directory

Syntax: rm folder name/file name

 

4. Traverse information about the current directory

Syntax: ls

5. Switch the Directory

Syntax: cd folder name

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

 

 

6. display the information of the current directory

Syntax: pwd

 

To exit, enter "bye" to exit the program.

Management end

Composition:

 

 

The management end involves MiniAdmin, which consists of Bin and Core folders.

The start. py file where the program starts to be placed in the Bin folder; the Core file ACore. py of the program in the Core folder

 

Function:

The administrator needs to use a dedicated terminal to communicate with the server. The administrator interface displays the following main functions:

 

1. Registered users

You can register a common user account that allows logon to ZFTP.

2. delete a user

You can delete an existing normal user account.

3. View users

You can view existing normal user accounts.

4. Modify the quota

You can modify the space quota of a registered user.

5. Exit

Exit System

 

Currently, Administrators cannot change their usernames and passwords.

 

 

Fixed bugs

 

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

2. resumable data transfer solves the abnormal MD5 value inconsistency caused by the next transmission of the transmission terminal.

3. For resumable upload, after the client replaces a valid file with an invalid file, the MD5 value is inconsistent.

4. Solve the system crash caused by file transfer exceeding the space limit.

 

 

Appendix: Brief description of resumable upload

1. First, connect to the server using the client

2. upload files and client

3. log on to the server again:

4. Upload again

5. If a file with the same file name but different content is uploaded, an error is returned:

The following message is displayed on the server:
  

The client reports the following message:

  

 

 

 

Code link:

Link: http://pan.baidu.com/s/1pKEXw5X password: xikg

 

The above is for reference only. Do not copy it as required.

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.