Package twisted :: Package protocols :: Module ftp :: Class FTP

[show private | hide private]
[frames | no frames]

## Class FTP

    BaseProtocol --+
                   |
            Protocol --+
                       |
            LineReceiver --+
                           |
         Factory --+       |
                   |       |
       ClientFactory --+   |
                       |   |
              DTPFactory --+
                           |
                          FTP

An FTP server.

This class is unstable (it will be heavily refactored to support dynamic content, etc).

Method Summary
| ``buildFullpath`(self, rpath)` Build a new path, from a relative path based on the current wd This routine is not fully tested, and I fear that it can be exploited by building clever paths
| ``buildProtocol`(self, addr)` Create an instance of a subclass of Protocol. (inherited from `DTPFactory`)
| ``checkauth`(self)` Will return None if the user has been authorized This must be run in front of all commands except USER, PASS and QUIT
| ``clientConnectionFailed`(self, connector, reason)` Called when a connection has failed. (inherited from `ClientFactory`)
| ``clientConnectionLost`(self, connector, reason)` Called when a connection is lost. (inherited from `ClientFactory`)
| ``connectionFailed`(self)` (Deprecated) (inherited from `Protocol`)
| ``connectionLost`(self, reason)` Called when the connection is shut down. (inherited from `Protocol`)
| ``connectionMade`(self)` Called when a connection is made.
| `createActiveServer(self)` (inherited from `DTPFactory`)
| `createPassiveServer(self)` (inherited from `DTPFactory`)
| ``dataReceived`(self, data)` Protocol.dataReceived. (inherited from `LineReceiver`)
| ``doStart`(self)` Make sure startFactory is called. (inherited from `Factory`)
| ``doStop`(self)` Make sure stopFactory is called. (inherited from `Factory`)
| `ftp_Abor(self, params)`
| `ftp_Cdup(self, params)`
| `ftp_Cwd(self, params)`
| `ftp_Dele(self, params)`
| ``ftp_Epsv`(self, params)` Request for a Extended Passive connection
| `ftp_List(self, params)`
| `ftp_Mkd(self, params)`
| `ftp_Nlst(self, params)`
| ``ftp_Noop`(self, params)` Do nothing, and reply an OK-message Sometimes used by clients to avoid a time-out.
| ``ftp_Pass`(self, params)` Authorize the USER and the submitted password
| ``ftp_Pasv`(self, params)` Request for a passive connection
| ``ftp_Port`(self, params)` Request for an active connection This command may be potentially abused, and the only countermeasure so far is that no port below 1024 may be targeted.
| `ftp_Pwd(self, params)`
| `ftp_Quit(self, params)`
| `ftp_Retr(self, params)`
| `ftp_Rmd(self, params)`
| `ftp_Size(self, params)`
| `ftp_Stor(self, params)`
| ``ftp_Syst`(self, params)` Return the running operating system to the client However, due to security-measures, it will return a standard 'L8' reply
| `ftp_Type(self, params)`
| ``ftp_User`(self, params)` Get the login name, and reset the session PASS is expected to follow
| `getListing(self, params, action)`
| ``lineLengthExceeded`(self, line)` Called when the maximum line length has been reached. (inherited from `LineReceiver`)
| ``lineReceived`(self, line)` Process the input from the client
| ``makeConnection`(self, transport)` Make a connection to a transport and a server. (inherited from `BaseProtocol`)
| ``rawDataReceived`(self, data)` Override this for when raw data is received. (inherited from `LineReceiver`)
| `reply(self, key, s)`
| ``sendLine`(self, line)` Sends a line to the other end of the connection. (inherited from `LineReceiver`)
| ``setAction`(self, action)` Alias for DTP.setAction Since there's no guarantee an instance of dtp exists
| ``setLineMode`(self, extra)` Sets the line-mode of this receiver. (inherited from `LineReceiver`)
| ``setRawMode`(self)` Sets the raw mode of this receiver. (inherited from `LineReceiver`)
| ``startedConnecting`(self, connector)` Called when a connection has been started. (inherited from `ClientFactory`)
| ``startFactory`(self)` This will be called before I begin listening on a Port or Connector. (inherited from `Factory`)
| ``stopFactory`(self)` This will be called before I stop listening on all Ports/Connectors. (inherited from `Factory`)

Class Variable Summary
`int` | `debug`
`NoneType` | `passwd`
`NoneType` | `peerhost`
`NoneType` | `peerport`
`NoneType` | `queuedfile`
`NoneType` | `root`
`NoneType` | `type`
`NoneType` | `user`
`NoneType` | `wd`

Method Details

### buildFullpath(self, rpath)

Build a new path, from a relative path based on the current wd This routine is not fully tested, and I fear that it can be exploited by building clever paths

### checkauth(self)

Will return None if the user has been authorized This must be run in front of all commands except USER, PASS and QUIT

### connectionMade(self)

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

  Overrides:
    `twisted.internet.protocol.BaseProtocol.connectionMade` (inherited documentation)

### ftp_Epsv(self, params)

Request for a Extended Passive connection

### ftp_Noop(self, params)

Do nothing, and reply an OK-message Sometimes used by clients to avoid a time-out. TODO: Add time-out, let Noop extend this time-out. Add a No-Transfer-Time-out as well to get rid of idlers.

### ftp_Pass(self, params)

Authorize the USER and the submitted password

### ftp_Pasv(self, params)

Request for a passive connection

### ftp_Port(self, params)

Request for an active connection This command may be potentially abused, and the only countermeasure so far is that no port below 1024 may be targeted. An extra approach is to disable port'ing to a third-party ip, which is optional through ALLOW_THIRDPARTY. Note that this disables 'Cross-ftp'

### ftp_Syst(self, params)

Return the running operating system to the client However, due to security-measures, it will return a standard 'L8' reply

### ftp_User(self, params)

Get the login name, and reset the session PASS is expected to follow

### lineReceived(self, line)

Process the input from the client

### setAction(self, action)

Alias for DTP.setAction Since there's no guarantee an instance of dtp exists

Class Variable Details

### debug

  Type:
    `int`
  Value:

        0

### passwd

  Type:
    `NoneType`
  Value:

        None

### peerhost

  Type:
    `NoneType`
  Value:

        None

### peerport

  Type:
    `NoneType`
  Value:

        None

### queuedfile

  Type:
    `NoneType`
  Value:

        None

### root

  Type:
    `NoneType`
  Value:

        None

### type

  Type:
    `NoneType`
  Value:

        None

### user

  Type:
    `NoneType`
  Value:

        None

### wd

  Type:
    `NoneType`
  Value:

        None

Generated by Epydoc 1.1 on Thu May 8 13:18:37 2003 | http://epydoc.sf.net