def __init__( self, execMethod, forceReRun=False, tcpPortList=[25,80,53,1433,8080], udpPortList=[53,69,139,1025] ): ''' @parameter execMethod: The execMethod used to execute commands on the remote host @parameter forceReRun: If forceReRun is True, the extrusion scanner won't fetch the results from the KB ''' self._execMethod = execMethod self._forceReRun = forceReRun self._tcpPortList = tcpPortList self._udpPortList = udpPortList os = osDetectionExec( execMethod ) if os == 'windows': self._transferHandler = echoWin( execMethod, os ) elif os == 'linux': self._transferHandler = echoLnx( execMethod, os )
def getTransferHandler( self , inboundPort=None ): ''' Perform an extrusion scan and return a handler that will know how to upload files to the remote end. If the caller sends an inboundPort, don't perform an extrusion scan, just trust him and use that port. @param inboundPort: The port that we should use for reverse connections @return: An object with a "transfer" method, which can be called by the user in order to upload files. ''' os = osDetectionExec( self._exec_method ) if os == 'windows': echoTransfer = echoWin( self._exec_method, os ) elif os == 'linux': echoTransfer = echoLnx( self._exec_method, os ) to_test = [] to_test.append( echoTransfer ) try: if not inboundPort: inboundPort = self._es.getInboundPort() except w3afException, w3: om.out.error( 'The extrusion test failed, no reverse connect transfer methods can be used. Trying inband echo transfer method.' ) om.out.error( 'Error: ' + str(w3) )