Giter Site home page Giter Site logo

miracle.filezilla.api's People

Contributors

almis90 avatar dependabot[bot] avatar polarbeardk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

miracle.filezilla.api's Issues

Write Permission on User Create

Hi

Firstly koodos on the code. I just finished integrating it into a website of mine however i really need to give the created user "Write Permissiions" oh him home directory.

Is this possible?

Regards

Meir

Connect failing on closed connection

FileZillaApi ftp = new FileZillaApi(IPAddress.Loopback, 10101);

then somewhere in Task.Run

try
{
    if(!ftp.IsConnected)
    {
       ftp.Connect("12345");
    }

     List<Connection> connections = ftp.GetConnections();
     Console.WriteLine("{0} connections", connections.Count);
}
catch (Exception ee)
{
     Console.WriteLine(ee.Message);
}

First time when the code is running everything works ok, I'm getting the list.
Then I am killing active connection using TCPView, in order to simulate what happened in reality few times. The connection was killed by the FileZilla service. Now after killing I am getting

An existing connection was forcibly closed by the remote host

Next time I run, IsConnected is false and another exception happens on "ftp.Connect":

Once the socket has been disconnected, you can only reconnect again asynchronously, and only to a different EndPoint. BeginConnect must be called on a thread that won't exit until the operation has been completed.

I think Connect method should detect that the socket is invalid and create new one.

[2.1.0.0] NullReferenceException in SendCommand method

SendCommand(MessageType messageType, Action dataAction) throws an NRE when using the FileZillaApi class as the Log property is not initialized.

I worked around this by wrapping the log line in a null check:
if (Log != null) {
Log.WriteLine("Send: {0}", messageType);
}

User ForceSsl misses the undetermined option

The User.ForceSsl property can have the next values:
0 False
1 True
2 Undetermined

When you use GetAccountSettings, all the Undetermined values are set to True.
When you add a new User to the accountSettins and do fileZillaApi.SetAccountSettings(accountSettings)
All the Users wich had set ForceSsl to Undetermined will be changed to ForceSsl set to True.

why no create dic method

1608197757(1)
when I dynamic create user ,first I need create directory,second I will to set user info ,and add user,please help me how to create directory

Event based handling

First of all I would like to express my gratitude for this library. Keep this work up.

As far as I understand there is no event based handling. For example if I want to know that new connection arrived or client disconnected, I have to poll. FileZilla server interface is showing progress of everything nearly real-time. Do you plan to make some event based handling for your library?

Exceptions in GetConnections

With FileZilla 0.9.57 I am getting exceptions in GetConnections:

Unable to receive message: UserControl
on other retry I am getting
Multiple commands matched
on 3rd retry success.

The exception happens when a new connection arrives.

How to modify/remove a user with Miracle.FileZilla.Api?

Hi all

I'm having problems understanding the referenced documentation from here.

#19

The doc says:

4: Modify Users and Groups lists as desired (add/change/delete).
accountSettings.Users.Add(user);

It seems those options are invalid:

accountSettings.Users.Delete(user)
accountSettings.Users.Change(user)

It seems this option is valid, but does not remove a user:

accountSettings.Users.Remove(user)

Are there some code samples for example how to reset a password for and/or how to delete a user?

Best regards
Tom

Arithmetic operation caused an overflow (AccessRights)

Hi all,

I use this vb.net routine to connect to a server and to set the .AccessRights.

            fileZillaApi.Connect(strServerPass)
            Dim accountSettings = fileZillaApi.GetAccountSettings()
            Dim user = New User With {
                .GroupName = strGroupName, ' Reference to existing group
                .UserName = strUserName,
                .BypassUserLimit = TriState.No,
                .ForceSsl = strForceSSLaction
            }
                user.SharedFolders = New List(Of SharedFolder)() From {
                New SharedFolder() With {
                .Directory = strUserDir,
                .AccessRights = strACLaction
                    }
            }

I use this code to identify what ACLs should be applied:

            Dim strACLaction As AccessRights
            If strACL.Contains("DirList") Then
                strACLaction = AccessRights.DirList
            End If
            If strACL.Contains("DirSubdirs") Then
                strACLaction &= AccessRights.DirSubdirs
            End If
            If strACL.Contains("DirCreate") Then
                strACLaction &= AccessRights.DirCreate
            End If
            If strACL.Contains("DirDelete") Then
                strACLaction &= AccessRights.DirDelete
            End If
            If strACL.Contains("FileRead") Then
                strACLaction &= AccessRights.FileRead
            End If
            If strACL.Contains("FileWrite") Then
                strACLaction &= AccessRights.FileWrite
            End If
            If strACL.Contains("FileDelete") Then
                strACLaction &= AccessRights.FileDelete
            End If
            If strACL.Contains("FileAppend") Then
                strACLaction &= AccessRights.FileAppend
            End If
            If strACL.Contains("IsHome") Then
                strACLaction &= AccessRights.IsHome
            End If

If i use:
/acl:DirList,DirSubdirs,DirCreate
Then i get the response: Action completed.

If i use:
/acl:DirList,DirSubdirs,DirCreate,DirDelete,FileRead,FileWrite,FileDelete,FileAppend,IsHome
Then i get the response: Arithmetic operation caused an overflow

strACL is the string after /acl: in the code above.

Interesting, if i use this code, it works good:

            fileZillaApi.Connect(strServerPass)
            Dim accountSettings = fileZillaApi.GetAccountSettings()
            Dim user = New User With {
                .GroupName = strGroupName, ' Reference to existing group
                .UserName = strUserName,
                .BypassUserLimit = TriState.No,
                .ForceSsl = strForceSSLaction
            }
                user.SharedFolders = New List(Of SharedFolder)() From {
                New SharedFolder() With {
                .Directory = strUserDir,
                .AccessRights = AccessRights.DirList Or AccessRights.DirDelete Or AccessRights.DirCreate Or AccessRights.DirDelete Or AccessRights.FileRead Or AccessRights.FileWrite Or AccessRights.FileDelete Or AccessRights.FileAppend Or AccessRights.IsHome
                    }
            }

It seems strACLaction exceeds a limit? Is there an idea how i can solve/workaround this?

Unable to read beyond the end of the stream

Has anyone ran across this issue? I get this message about 70% of the time when I am creating a new user, the other 30% it works with no issues.

I feel like I may end up having to make an async method for SetAccountSettings.

EndOfStreamException: Unable to read beyond the end of the stream. System.IO.BinaryReader.ReadByte() Miracle.FileZilla.Api.BinaryExtensions.Verify(BinaryReader reader, byte expected) in BinaryExtensions.cs Miracle.FileZilla.Api.BinaryExtensions.Verify(BinaryReader reader, byte[] data) in BinaryExtensions.cs Miracle.FileZilla.Api.FileZillaServerProtocol+<>c__DisplayClass26_0.<Connect>b__0(BinaryReader reader) in FileZillaServerProtocol.cs Miracle.FileZilla.Api.FileZillaServerProtocol.Receive(Action<BinaryReader> action) in FileZillaServerProtocol.cs Miracle.FileZilla.Api.FileZillaServerProtocol.Connect(string password) in FileZillaServerProtocol.cs CustomerPortal.Controllers.AccountController.Register(RegisterViewModel model, string returnUrl) in AccountController.cs

Stack trace:
System.IO.EndOfStreamException: Unable to read beyond the end of the stream. at System.IO.BinaryReader.ReadByte() at Miracle.FileZilla.Api.BinaryExtensions.Verify(BinaryReader reader, Byte expected) in C:\Users\user\Documents\Visual Studio 2017\Projects\CustomerPortalPrototype\Miracle.FileZilla.Api\BinaryExtensions.cs:line 337 at Miracle.FileZilla.Api.BinaryExtensions.Verify(BinaryReader reader, Byte[] data) in C:\Users\user\Documents\Visual Studio 2017\Projects\CustomerPortalPrototype\Miracle.FileZilla.Api\BinaryExtensions.cs:line 330 at Miracle.FileZilla.Api.FileZillaServerProtocol.<>c__DisplayClass26_0.<Connect>b__0(BinaryReader reader) in C:\Users\user\Documents\Visual Studio 2017\Projects\CustomerPortalPrototype\Miracle.FileZilla.Api\FileZillaServerProtocol.cs:line 259 at Miracle.FileZilla.Api.FileZillaServerProtocol.Receive(Action1 action) in C:\Users\user\Documents\Visual Studio 2017\Projects\CustomerPortalPrototype\Miracle.FileZilla.Api\FileZillaServerProtocol.cs:line 152
at Miracle.FileZilla.Api.FileZillaServerProtocol.Connect(String password) in C:\Users\user\Documents\Visual Studio 2017\Projects\CustomerPortalPrototype\Miracle.FileZilla.Api\FileZillaServerProtocol.cs:line 286
at CustomerPortal.Controllers.AccountController.Register(RegisterViewModel model, String returnUrl) in C:\USAGIT\WebApps\CustomerPortal\CustomerPortal\Controllers\AccountController.cs:line 229
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at System.Threading.Tasks.ValueTask1.get_Result() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

How to add allowed and dissalowed ip

How do you add this?

i can see i need to create a list, but when i do

            var accountSettings = fileZillaApi.GetAccountSettings();
            var user = new User
            {
                //GroupName = ExampleGroupName, // Reference to group
                UserName = ftpuser,
           
                DisallowedIPs = new List<DisallowedIPs>()
                {
                   new DisallowedIPs()
                    {

                    }
                
                }

it just says the type or namespace DisallowedIPs could not be found. ?

[Question] - Can I set the SALT and PASSWORD hash?

Hi,

I was looking at the README (example 4), and saw that the Password can be assigned. However, I think that's not the case anymore at least with the latest version or even longer. Anyway, I want to be able to assign the Password (hash) and Salt directly. It's computed in another system and the hash/salt is used in various systems to authtenticate the user. Now, I want to use the same hash/salt to create a user for FileZilla, so the user can use their existing credential.

Anyway, would it ever be possible to make the Password and Salt property assignable? Are there pitfalls with having these 2 properties available to set?

(Note: I tested our hash/salt manually by setting it in the FileZilla-server.xml file, and it worked perfectly)

Thanks

Its not a bug, but no idea where to post 'many thanks'.
Very usefull API!

We setup a intranet website where use can per one-click create random ftp access. account and files are automatically deleted after specified time.

Little bit tricky was it, to get it running under Win2003.
FileZilla stops support with 0.9.43

Mario.

Miracle.FileZilla.Api.ProtocolException: 'Unable to receive message: Authenticate

Hello, I am trying to create a c sharp project that creates a user and makes a directory in a ftp server that is hosted on a remote computer. And I am having trouble on making the connection, I am trying to look at the remote server's ftp server configuration but I am not able to find the configuration to enable or set configuration to be able to connect to the server to administrate users.

Can someone help me understand what is the action I need to take?

Error when trying to connect to the server

FileZilla version 0.9.49

When I call the method Connect, I get an exception:

Exception Details: Miracle.FileZilla.Api.ProtocolException: Expected Byte 70 actual 50 at offset 0x0(0)

[ProtocolException: Expected Byte 70 actual 50 at offset 0x0(0)]
Miracle.FileZilla.Api.BinaryExtensions.Verify(BinaryReader reader, Byte expected) +59
Miracle.FileZilla.Api.BinaryExtensions.Verify(BinaryReader reader, Byte[] data) +35
Miracle.FileZilla.Api.BinaryExtensions.Verify(BinaryReader reader, String s) +35
Miracle.FileZilla.Api.<>c__DisplayClass8.b__5(BinaryReader reader) +26
Miracle.FileZilla.Api.FileZillaServerProtocol.Receive(Action`1 action) +144
Miracle.FileZilla.Api.FileZillaServerProtocol.Connect(String password) +110

Extension based pre-transfer rejection via transfer.cs

Hi Philip,

Would it be possible to use the transfer.cs on a loop to reject specific file extensions? I see that the following are defined in that class.

public string PhysicalFile { get; set; }
public string LogicalFile { get; set; }

Along with a connectionid, I assume if I could perform the loop on either of those and check the filename that I could reject specific file extensions.

Thank you for your time.

Unable to read beyond the end of the stream.

Unhandled Exception: System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
at System.IO.BinaryReader.ReadByte()
at Miracle.FileZilla.Api.BinaryExtensions.Verify(BinaryReader reader, Byte expected)
at Miracle.FileZilla.Api.BinaryExtensions.Verify(BinaryReader reader, Byte[] data)
at Miracle.FileZilla.Api.FileZillaServerProtocol.<>c__DisplayClass26_0.b__0(BinaryReader reader)
at Miracle.FileZilla.Api.FileZillaServerProtocol.Receive(Action`1 action)
at Miracle.FileZilla.Api.FileZillaServerProtocol.Connect(String password)
at HelloWorld.Program.Main(String[] args) in E:\Code\HelloWorld\Program.cs:line 22

Support of FileZilla Server 1.1.0

At the moment it's not possible to use the new version of FileZilla Server.

Example: Calling GetAccountSettings causes the application to stop.
Background: I assume it's related to the Windows Messages which are no longer processed by the new Admin UI of the FileZilla Server.

Changelog FileZilla Server

FileZillaApi.GetConnections

server vesion: FileZilla Server 0.9.60 beta
client vesion: FileZilla 3.60.2

Some files it cannot be obtained . TotalSize field ,value is null

Unsupported FileZilla protocol version:0.1.30.0

Recently i got the following error when i tried to deploy in a different server

Miracle.FileZilla.Api.ApiException: Unsupported FileZilla protocol version:0.1.30.0. Report issue on https://github.com/PolarbearDK/Miracle.FileZilla.Api.
at Miracle.FileZilla.Api.FileZillaServerProtocol.<>c__DisplayClass6.b__3(BinaryReader reader)
at Miracle.FileZilla.Api.FileZillaServerProtocol.Receive(Action1 action) at Miracle.FileZilla.Api.FileZillaServerProtocol.Connect(String password) at ... (my class)

Any ideas on how i could proceed?
Thanks in advance

Unable to read beyond the end of the stream when trying to connect

I'm trying to use this code outside of the server for the ftp site to connect. The same code while on the server works correctly. I have traced it to this method but not sure what is causing it. Any idea?

public static void Verify(this BinaryReader reader, byte expected)
{
var actual = reader.ReadByte();
if (actual != expected)
throw ProtocolException.Create(reader, expected, actual);
}

Updating the User disables the user (Enabled unchecked)

The following code unchecked the Enabled flag for the user:

User existingUser = accountSettings.Users.Find(x => x.UserName.CompareTo(username) == 0);
existingUser.ForceSsl = TriState.Yes;
existingUser.Enabled = TriState.Yes;
existingUser.DisallowedIPs = disallowedIps;
existingUser.AllowedIPs = allowedIps;
fileZillaApi.SetAccountSettings(accountSettings);

Am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.