CrushFTP provides a plugin interface where you can develop your own third party plugins.


CrushFTP 4 Plugins Architecture (01/06/2007)

There are a few hooks into CrushFTP that the plugins get.  Plugins are run synchronously, so if you are going to do something that will take a while, multi thread it off.  While I won't likely change how these hooks are called, I may be willing to add additional hooks if your situation demonstrates it would be beneficial.

Hook#1
When the user logs in there is a hook to make up a user from the plugin before CrushFTP tries to verify the user in its internal system.  This is how the SQL & LDAP plugins work.  The action is "login".

Hook#2
Once the login has been verified, there is an action of "afterLogin" called for any manipulations that need to be done to the user before anything else happens.  This is where the HomeDirectory plugin modifies the directory access and generates the appropriate directory.  This hook includes the special item "uVFSObject" which is the CrushFTP class crushftp.server.VFS.  See the HomeDirectory for how to use this.

Hook#3
When any action is done, an access check is performed.  There is a hook provided here where the plugin will be called with an action of "access".

Hook#4
When any listing is produced, an action of "list" will be called passing in the listing object. (FTP,HTTP,WebDAV)

Hook#5
For FTP only: when a command is issued, an action of "command" is called.  This can be used to filter commands out, or to do specific actions.  If you respond to the command, be sure to clear out the command so CrushFTP doesn't also try and respond and put the FTP client out of sync.

To access a download, disconnect, upload type situation, use the event interface of a user and specify your plugin to be called in those types of events.

What can I do?
Virtually all info about a user is passed to the plugin when its called.  If you edit a string item directly in the object that is called, nothing will happen.  However, pulling out any of the "Properties" objects and changing values there will cause immediate results as that is how everything internally is referenced.

To learn the structure of things, I recommend printing it out to system out or logging it in some way.  Then look through it to find what you are interested in.

[https://www.crushftp.com/Docs/CrushFTP4_plugin_sample_source.zip]