#NEWLINE# def download( self , url , fakeoutfile , outputfile , * args , **kwargs ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# parsed = urlparse . urlparse ( url ) #NEWLINE# scheme = parsed . scheme #NEWLINE# host = parsed . hostname #NEWLINE# port = ( parsed . port or ( 443 if ( scheme == 'https' ) else 80 ) ) #NEWLINE# path = ( parsed . path or '/' ) #NEWLINE# if ( ( scheme != 'http' ) and ( scheme != 'https' ) ) : #NEWLINE# #INDENT# raise exceptions . NotImplementedError #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# self . write ( ( '%s: Unsupported scheme.\n' % ( url , ) ) ) #NEWLINE# self . exit ( ) #NEWLINE# return None #NEWLINE# #UNINDENT# if ( self . quiet == False ) : #NEWLINE# #INDENT# self . write ( ( '--%s--  %s' % ( time . strftime ( '%Y-%m-%d %H:%M:%S\n' ) , url ) ) ) #NEWLINE# self . write ( ( 'Connecting to %s:%d... connected.\n' % ( host , port ) ) ) #NEWLINE# self . write ( 'HTTP request sent, awaiting response... ' ) #NEWLINE# #UNINDENT# factory = HTTPProgressDownloader ( self , fakeoutfile , url , outputfile , * args , ** kwargs ) #NEWLINE# out_addr = None #NEWLINE# if self . protocol . cfg . has_option ( 'honeypot' , 'out_addr' ) : #NEWLINE# #INDENT# out_addr = ( self . protocol . cfg . get ( 'honeypot' , 'out_addr' ) , 0 ) #NEWLINE# #UNINDENT# if ( scheme == 'https' ) : #NEWLINE# #INDENT# contextFactory = ssl . ClientContextFactory ( ) #NEWLINE# contextFactory . method = SSL . SSLv23_METHOD #NEWLINE# reactor . connectSSL ( host , port , factory , contextFactory ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . connection = reactor . connectTCP ( host , port , factory , bindAddress = out_addr ) #NEWLINE# #UNINDENT# return factory . deferred