def test_buildCommand_providedRequiredParameters_buildsAValidHydraCommand( self): expected = "hydra 127.0.0.1 -s 22 -o \"some-path/some-file.txt\" -t 16 some-service" args = HydraCommandArguments(ipAddress="127.0.0.1", port="22", outputFile="some-path/some-file.txt", threadsToUse="16", service="some-service") self.assertEqual(expected, buildHydraCommand(args))
def buildHydraCommand(self, runningfolder, userlistPath, passlistPath): self.ip = self.ipTextinput.text() self.port = self.portTextinput.text() self.service = str(self.serviceComboBox.currentText()) outputFile = getHydraOutputFileName(runningfolder, self.ip, self.port, self.service) threadsToUse = str(self.threadsComboBox.currentText()) labelText = str(self.labelPath.text() ) if self.checkAddMoreOptions.isChecked() else None if 'form' not in str(self.service): self.warningLabel.hide() tryLoginName = None tryLoginNameFile = None if not self.service in self.settings.brute_no_username_services.split( ","): if self.singleUserRadio.isChecked(): tryLoginName = self.usersTextinput.text() elif self.foundUsersRadio.isChecked(): tryLoginNameFile = userlistPath else: tryLoginNameFile = self.userlistTextinput.text() tryPassword = None tryPasswordFile = None if not self.service in self.settings.brute_no_password_services.split( ","): if self.singlePassRadio.isChecked(): tryPassword = self.passwordsTextinput.text().replace( '"', '\"\"\"') elif self.foundPasswordsRadio.isChecked(): tryPasswordFile = passlistPath else: tryPasswordFile = self.passlistTextinput.text() hydraArgs = HydraCommandArguments( ipAddress=str(self.ip), port=self.port, outputFile=outputFile, threadsToUse=threadsToUse, service=self.service, verbose=self.checkVerbose.isChecked(), label=labelText, exitAfterFirstUserPassPairFound=self.checkExitOnValid.isChecked(), loopUsers=self.checkLoopUsers.isChecked(), tryLoginAsPass=self.checkLoginAsPass.isChecked(), tryNullPassword=self.checkBlankPass.isChecked(), tryPassword=tryPassword, tryPasswordFile=tryPasswordFile, tryLoginName=tryLoginName, tryLoginNameFile=tryLoginNameFile) return buildHydraCommand(hydraArgs)
def test_buildCommand_providedRequiredParametersAndExitOnFirstPairFoundFlag_buildsAValidHydraCommand( self): expected = "hydra 127.0.0.1 -s 22 -o \"some-path/some-file.txt\" -f -V -t 16 some-service some-label" args = HydraCommandArguments(ipAddress="127.0.0.1", port="22", outputFile="some-path/some-file.txt", verbose=True, threadsToUse="16", service="some-service", label="some-label", exitAfterFirstUserPassPairFound=True) self.assertEqual(expected, buildHydraCommand(args))
def test_buildCommand_providedRequiredParametersAndTrySpecificPassFile_buildsAValidHydraCommand( self): expected = "hydra 127.0.0.1 -s 22 -o \"some-path/some-file.txt\" -P \"passwords.txt\" -e ns -u -f -V -t 16 " \ "some-service some-label" args = HydraCommandArguments(ipAddress="127.0.0.1", port="22", outputFile="some-path/some-file.txt", verbose=True, threadsToUse="16", service="some-service", label="some-label", exitAfterFirstUserPassPairFound=True, loopUsers=True, tryLoginAsPass=True, tryNullPassword=True, tryPasswordFile="passwords.txt") self.assertEqual(expected, buildHydraCommand(args))