Exemple #1
0
    def __testIfAGoodSID__(self):
        '''
		Test if it is a good SID
		'''
        no_good_sid_found = False
        self.__setUserAndPassword__()
        self.__generateConnectionString__()
        logging.debug("Try to connect with the {0} SID ({1})".format(
            self.args['sid'], self.args['connectionStr']))
        status = self.connection()
        if self.__needRetryConnection__(status) == True:
            status = self.__retryConnect__(nbTry=4)
        if status != None:
            for aNoGoodString in self.NO_GOOD_SID_STRING_LIST:
                if aNoGoodString in str(status):
                    no_good_sid_found = True
                    break
            if no_good_sid_found == False:
                self.appendValideSID(self.args['sid'])
                logging.info(
                    "'{0}' is a valid SID (Server message: {1})".format(
                        self.args['sid'], str(status)))
                self.args['print'].goodNews(
                    stringToLinePadded(
                        "'{0}' is a valid SID. Continue... ".format(
                            self.args['sid'])))
        self.close()
Exemple #2
0
    def searchValideAccounts(self):
        '''
		Search valide accounts
		'''
        userChoice = 1
        logging.info("Searching valid accounts on {0}:{1}/{2}".format(
            self.args['server'], self.args['port'], self.args['sid']))
        pbar, nb = self.getStandardBarStarted(len(self.accounts)), 0
        for anAccount in self.accounts:
            nb += 1
            pbar.update(nb)
            self.args['SYSDBA'] = False
            self.args['SYSOPER'] = False
            logging.debug("Try to connect with {0}".format(
                '/'.join(anAccount)))
            self.args['user'], self.args['password'] = anAccount[0], anAccount[
                1]
            self.__generateConnectionString__()
            status = self.__saveThisLoginInFileIfNotExist__(self.args['user'])
            if self.args[
                    'force-retry'] == False and status == False and userChoice == 1:
                userChoice = self.__askToTheUserIfNeedToContinue__(
                    self.args['user'])
            if userChoice == 0:
                logging.info(
                    "The attack is aborded because you choose to stop (s/S)")
                break
            status = self.connection(threaded=False)
            if status == True:
                self.valideAccounts[self.args['user']] = self.args['password']
                logging.info("Valid credential: {0} ({1})  ".format(
                    '/'.join(anAccount), self.args['connectionStr']))
                self.args['print'].goodNews(
                    stringToLinePadded(
                        "Valid credentials found: {0}. Continue... ".format(
                            '/'.join(anAccount))))
            elif "connection as SYS should be as SYSDBA or SYSOPER" in str(
                    status):
                logging.debug("Try to connect as sysdba")
                self.args['SYSDBA'] = True
                status = self.connection()
                if status == True:
                    self.valideAccounts[
                        self.args['user']] = self.args['password']
                    logging.info("Valid credential: {0} ({1})  ".format(
                        '/'.join(anAccount), self.args['connectionStr']))
                self.args['SYSDBA'] = False
            elif self.__needRetryConnection__(status) == True:
                status = self.__retryConnect__(nbTry=4)
            else:
                logging.debug(
                    "Error during connection with this account: {0}".format(
                        status))
            self.close()
            sleep(self.timeSleep)
        pbar.finish()
        return True
Exemple #3
0
    def searchValideAccounts(self):
        """
		Search valide accounts
		"""
        userChoice = 1
        logging.info(
            "Searching valid accounts on {0}:{1}/{2}".format(self.args["server"], self.args["port"], self.args["sid"])
        )
        pbar, nb = self.getStandardBarStarted(len(self.accounts)), 0
        for anAccount in self.accounts:
            nb += 1
            pbar.update(nb)
            logging.debug("Try to connect with {0}".format("/".join(anAccount)))
            self.args["user"], self.args["password"] = anAccount[0], anAccount[1]
            self.__generateConnectionString__()
            status = self.__saveThisLoginInFileIfNotExist__(self.args["user"])
            if self.args["force-retry"] == False and status == False and userChoice == 1:
                userChoice = self.__askToTheUserIfNeedToContinue__(self.args["user"])
            if userChoice == 0:
                logging.info("The attack is aborded because you choose to stop (s/S)")
                break
            status = self.connection()
            if status == True:
                self.valideAccounts[self.args["user"]] = self.args["password"]
                logging.info("Valid credential: {0} ({1})  ".format("/".join(anAccount), self.args["connectionStr"]))
                self.args["print"].goodNews(
                    stringToLinePadded("Valid credentials found: {0}. Continue... ".format("/".join(anAccount)))
                )
            elif "connection as SYS should be as SYSDBA or SYSOPER" in str(status):
                logging.debug("Try to connect as sysdba")
                self.args["SYSDBA"] = True
                status = self.connection()
                if status == True:
                    self.valideAccounts[self.args["user"]] = self.args["password"]
                    logging.info(
                        "Valid credential: {0} ({1})  ".format("/".join(anAccount), self.args["connectionStr"])
                    )
                self.args["SYSDBA"] = False
            elif self.__needRetryConnection__(status) == True:
                status = self.__retryConnect__(nbTry=4)
            self.close()
            sleep(self.timeSleep)
        pbar.finish()
        return True
Exemple #4
0
	def __testIfAGoodSID__(self):
		'''
		Test if it is a good SID
		'''
		no_good_sid_found = False
		self.__setUserAndPassword__()
		self.__generateConnectionString__()
		logging.debug("Try to connect with the {0} SID ({1})".format(self.args['sid'],self.args['connectionStr'])) 
		status = self.connection()
		if self.__needRetryConnection__(status) == True: 
			status = self.__retryConnect__(nbTry=4)
		if status != None :
			for aNoGoodString in self.NO_GOOD_SID_STRING_LIST:
				if aNoGoodString in str(status):
					no_good_sid_found = True
					break
			if no_good_sid_found == False:
				self.appendValideSID(self.args['sid'])
				logging.info("'{0}' is a valid SID (Server message: {1})".format(self.args['sid'],str(status)))
				self.args['print'].goodNews(stringToLinePadded("'{0}' is a valid SID. Continue... ".format(self.args['sid'])))
		self.close()