Skip to content

hoangtxss/Miracle.FileZilla.Api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Miracle.FileZilla.Api

Managed API for FileZilla FTP server. Allows you to do basically the same as the FileZilla Server interface. Target audience is everyone who wants to automate the administration of FileZilla server, particularly user/group management.

##Features

  • Get/Set Groups/Users using GetAccountSettings/SetAccountSettings methods.
  • Get/Set server state using GetServerState/SetServerState methods.
  • Get/Set server settings using GetSettings/SetSettings methods.
  • Get active connections using GetConnections method.
  • Kick connection using Kick method.
  • Ban IP (and kick) using BanIp method.
  • Use FileZillaServerProtocol for more advanced implemetations.

##FileZilla Server versions supported Simplified: 0.9.43 or later

###FileZilla Server versions tested during development

  • 0.9.43 - Verified to work (Last FileZilla Server to support Windows XP/2003)
  • 0.9.46 - First version supported
  • 0.9.48 - Protocol changed to support 16M users
  • 0.9.52 - Protocol changes mostly related to TLS

Other versions than listed are supported provided that the FileZilla team has not changed the protocol version (an ApiException is thrown upon connect if that is the case). Basically: If the API are able to connect to the FileZilla server then you are good to go! If not then let me know, and I will fix it.

##Example: Create user in 5 easy steps:

####1: Create instance of API

// Using localhost and default port
var fileZillaApi = new FileZillaApi();

or
// Using specific server/port
var fileZillaApi = new FileZillaApi(IPAddress.Parse("192.168.0.42"), 54321);

####2: Connect to FileZilla server

fileZillaApi.Connect("FileZilla password");

####3: Get account settings which includes all users and groups

var accountSettings = fileZillaApi.GetAccountSettings();

####4: Modify Users and Groups lists as desired (add/change/delete).

var user = new User
{
	GroupName = "SomeGroup", // Reference to existing group
	UserName = "NewUser",
	Password = User.HashPassword("secret"),
	Permissions = new List<Permission>()
	{
		new Permission()
		{
			Directory = @"C:\Hello\World",
		}
	}
};
accountSettings.Users.Add(user);

####5: Save account settings. This will override all users and groups.

fileZillaApi.SetAccountSettings(accountSettings);

##Complete example:

using (IFileZillaApi fileZillaApi = new FileZillaApi())
{
    fileZillaApi.Connect("FileZilla password");
    var accountSettings = fileZillaApi.GetAccountSettings();
    var user = new User
    {
        GroupName = "SomeGroup", // Reference to existing group
        UserName = "NewUser",
        Password = User.HashPassword("secret"),
        Permissions = new List<Permission>()
        {
            new Permission()
            {
                Directory = @"C:\Hello\World",
            }
        }
    };
    accountSettings.Users.Add(user);
    fileZillaApi.SetAccountSettings(accountSettings);
}

Groups are managed just like Users using accountSettings.Groups.

####See sample project for further information.

About

Managed api for FileZilla FTP server. Primarily for automated user/group creation and deletion.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.9%
  • Batchfile 0.1%