[Twisted-Python] Twisted FTP server fails on PASV

Slava Yanson urbansoot at gmail.com
Thu Sep 17 19:29:07 EDT 2009


It just doesn't want to go past PASV. Spent past 3 hours trying to figure
this one out. Any help is appreciated.


Log:

2009-09-17 16:26:56-0700 [-] Log opened.
2009-09-17 16:26:56-0700 [-] twisted.protocols.ftp.FTPFactory starting on
*****
2009-09-17 16:26:56-0700 [-] Starting factory
<twisted.protocols.ftp.FTPFactory instance at 0x2b3a031037a0>
2009-09-17 16:26:59-0700 [twisted.protocols.ftp.FTPFactory] client connected
2009-09-17 16:26:59-0700 [twisted.protocols.ftp.FTPFactory] --> 220 Twisted
8.2.0 FTP Server
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] <-- USER fnet
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] --> 331 Password
required for fnet.
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] <-- PASS *****
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] --> 230 User logged
in, proceed
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] <-- TYPE A
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] --> 200 Type set to
A.
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] <-- SYST
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] --> 215 UNIX Type:
L8
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] <-- PWD
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] --> 257 "/"
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] <-- PASV
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21]
DTPFactory.setTimeout set to 10 seconds
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21]
twisted.protocols.ftp.DTPFactory starting on 38637
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] Starting factory
<twisted.protocols.ftp.DTPFactory instance at 0x2b3a0544a170>
2009-09-17 16:27:00-0700 [ProtocolWrapper,0,24.43.31.21] --> 227 Entering
Passive Mode (65,61,232,130,150,237).
2009-09-17 16:27:10-0700 [-] timed out waiting for DTP connection
2009-09-17 16:27:10-0700 [-] Unexpected FTP error
2009-09-17 16:27:10-0700 [-] Unhandled Error
    Traceback (most recent call last):
    Failure: twisted.internet.defer.TimeoutError:

2009-09-17 16:27:10-0700 [-] --> 550 Requested action not taken: internal
server error
2009-09-17 16:27:10-0700 [-] dtpFactory.stopFactory



Code:

from twisted.protocols.ftp import FTPFactory, FTPRealm, FTP
from twisted.cred.portal import Portal
from twisted.cred.checkers import FilePasswordDB
from twisted.internet import reactor
from twisted.python import log
import sys

log.startLogging(sys.stdout)

class bcFTPProtocol(FTP):
    def connectionMade(self):
        log.msg("client connected")

        FTP.connectionMade(self)

    def lineReceived(self, line):
        log.msg("<-- " + line)
        FTP.lineReceived(self, line)

    def sendLine(self, msg):
        log.msg("--> " + msg)
        FTP.sendLine(self, msg)

ftp_portal = Portal(FTPRealm('data/'), [FilePasswordDB("ftp.users")])
ftp_factory = FTPFactory(ftp_portal)
ftp_factory.protocol = bcFTPProtocol

reactor.listenTCP(*****, ftp_factory)
reactor.run()






Thank you,

Slava Yanson
Positive Blue, LLC

web: www.positiveblue.com
tel: (323) 963-4787
aim/yahoo/skype: urbansoot

http://www.LinuxDecals.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20090917/ccc0afb8/attachment-0001.htm 


More information about the Twisted-Python mailing list