diff --git a/src/dba/models/Task.php b/src/dba/models/Task.php index 42e7dc550..5d4b139aa 100644 --- a/src/dba/models/Task.php +++ b/src/dba/models/Task.php @@ -104,7 +104,7 @@ static function getFeatures(): array { $dict['useNewBench'] = ['read_only' => True, "type" => "bool", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "useNewBench", "public" => False, "dba_mapping" => False]; $dict['skipKeyspace'] = ['read_only' => True, "type" => "int64", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "skipKeyspace", "public" => False, "dba_mapping" => False]; $dict['crackerBinaryId'] = ['read_only' => True, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "crackerBinaryId", "public" => False, "dba_mapping" => False]; - $dict['crackerBinaryTypeId'] = ['read_only' => True, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "crackerBinaryTypeId", "public" => False, "dba_mapping" => False]; + $dict['crackerBinaryTypeId'] = ['read_only' => True, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => True, "pk" => False, "protected" => False, "private" => False, "alias" => "crackerBinaryTypeId", "public" => False, "dba_mapping" => False]; $dict['taskWrapperId'] = ['read_only' => True, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => True, "private" => False, "alias" => "taskWrapperId", "public" => False, "dba_mapping" => False]; $dict['isArchived'] = ['read_only' => False, "type" => "bool", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "isArchived", "public" => False, "dba_mapping" => False]; $dict['notes'] = ['read_only' => False, "type" => "str(65535)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "notes", "public" => False, "dba_mapping" => False]; diff --git a/src/inc/apiv2/model/TaskAPI.php b/src/inc/apiv2/model/TaskAPI.php index 7753ea0b2..6756e7459 100644 --- a/src/inc/apiv2/model/TaskAPI.php +++ b/src/inc/apiv2/model/TaskAPI.php @@ -159,11 +159,12 @@ protected function createObject(array $data): int { $data[Task::PRIORITY], $data[Task::MAX_AGENTS], $this->db2json($this->getFeatures()['files'], $data["files"]), - $data[Task::CRACKER_BINARY_TYPE_ID], + $data[Task::CRACKER_BINARY_ID], $this->getCurrentUser(), $data[Task::NOTES], $data[Task::STATIC_CHUNKS], - $data[Task::CHUNK_SIZE] + $data[Task::CHUNK_SIZE], + $data[Task::FORCE_PIPE] ); return $task->getId(); diff --git a/src/inc/utils/TaskUtils.php b/src/inc/utils/TaskUtils.php index c2ab206f5..5d4b60279 100644 --- a/src/inc/utils/TaskUtils.php +++ b/src/inc/utils/TaskUtils.php @@ -793,7 +793,7 @@ public static function updateMaxAgents($taskId, $maxAgents, $user) { * @return Task * @throws HttpError */ - public static function createTask($hashlistId, $name, $attackCmd, $chunkTime, $status, $benchtype, $color, $isCpuOnly, $isSmall, $usePreprocessor, $preprocessorCommand, $skip, $priority, $maxAgents, $files, $crackerVersionId, $user, $notes = "", $staticChunking = DTaskStaticChunking::NORMAL, $chunkSize = 0) { + public static function createTask($hashlistId, $name, $attackCmd, $chunkTime, $status, $benchtype, $color, $isCpuOnly, $isSmall, $usePreprocessor, $preprocessorCommand, $skip, $priority, $maxAgents, $files, $crackerVersionId, $user, $notes = "", $staticChunking = DTaskStaticChunking::NORMAL, $chunkSize = 0, $enforcePipe = 0) { $hashlist = Factory::getHashlistFactory()->get($hashlistId); if ($hashlist == null) { throw new HttpError("Invalid hashlist ID!"); @@ -842,6 +842,8 @@ public static function createTask($hashlistId, $name, $attackCmd, $chunkTime, $s } else if ($benchtype != 'speed' && $benchtype != 'runtime') { throw new HttpError("Invalid benchmark type!"); + } else if ($enforcePipe < 0 || $enforcePipe > 1) { + throw new HttpError("Invalid enforce pipe value"); } $benchtype = ($benchtype == 'speed') ? 1 : 0; if (preg_match("/[0-9A-Za-z]{6}/", $color) != 1) { @@ -892,7 +894,7 @@ public static function createTask($hashlistId, $name, $attackCmd, $chunkTime, $s $notes, $staticChunking, $chunkSize, - 0, + $enforcePipe, ($usePreprocessor > 0) ? $preprocessor->getId() : 0, ($usePreprocessor > 0) ? $preprocessorCommand : '' );