Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions ci/apiv2/test_taskwrapperdisplay.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from hashtopolis import TaskWrapperDisplay
from utils import BaseTest
class TaskWrapperDisplayTest(BaseTest):
model_class = TaskWrapperDisplay

def create_test_object(self, *nargs, delete=True, **kwargs):
# Always cleanup hashlist when done, this is potentially confusing,
# since it will also remove the related task
hashlist = self.create_hashlist()
task = self.create_task(hashlist, delete=delete)
return TaskWrapperDisplay.objects.get(pk=task.taskWrapperId)

def test_task_wrapper_display_should_return_color_field(self):
task_wrapper_display_object = self.create_test_object()
expected_color_value = str(task_wrapper_display_object.color)
self.assertIsNotNone(task_wrapper_display_object.color)
self.assertEqual(task_wrapper_display_object.color, expected_color_value)
self.assertNotEqual("FFFFFF", task_wrapper_display_object.color)
15 changes: 14 additions & 1 deletion src/dba/models/TaskWrapperDisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class TaskWrapperDisplay extends AbstractModel {
private ?int $cracked;
private ?int $taskId;
private ?string $taskName;
private ?string $color;
private ?string $attackCmd;
private ?int $chunkTime;
private ?int $statusTimer;
Expand All @@ -35,7 +36,7 @@ class TaskWrapperDisplay extends AbstractModel {
private ?string $hashTypeDescription;
private ?string $groupName;

function __construct(?int $taskWrapperId, ?int $taskWrapperPriority, ?int $taskWrapperMaxAgents, ?int $taskType, ?int $hashlistId, ?int $accessGroupId, ?string $taskWrapperName, ?string $displayName, ?int $taskWrapperIsArchived, ?int $cracked, ?int $taskId, ?string $taskName, ?string $attackCmd, ?int $chunkTime, ?int $statusTimer, ?int $keyspace, ?int $keyspaceProgress, ?int $taskPriority, ?int $taskMaxAgents, ?int $isSmall, ?int $isCpuTask, ?int $taskIsArchived, ?int $taskUsePreprocessor, ?string $hashlistName, ?int $hashCount, ?int $hashlistCracked, ?int $hashTypeId, ?string $hashTypeDescription, ?string $groupName) {
function __construct(?int $taskWrapperId, ?int $taskWrapperPriority, ?int $taskWrapperMaxAgents, ?int $taskType, ?int $hashlistId, ?int $accessGroupId, ?string $taskWrapperName, ?string $displayName, ?int $taskWrapperIsArchived, ?int $cracked, ?int $taskId, ?string $taskName, ?string $color, ?string $attackCmd, ?int $chunkTime, ?int $statusTimer, ?int $keyspace, ?int $keyspaceProgress, ?int $taskPriority, ?int $taskMaxAgents, ?int $isSmall, ?int $isCpuTask, ?int $taskIsArchived, ?int $taskUsePreprocessor, ?string $hashlistName, ?int $hashCount, ?int $hashlistCracked, ?int $hashTypeId, ?string $hashTypeDescription, ?string $groupName) {
$this->taskWrapperId = $taskWrapperId;
$this->taskWrapperPriority = $taskWrapperPriority;
$this->taskWrapperMaxAgents = $taskWrapperMaxAgents;
Expand All @@ -48,6 +49,7 @@ function __construct(?int $taskWrapperId, ?int $taskWrapperPriority, ?int $taskW
$this->cracked = $cracked;
$this->taskId = $taskId;
$this->taskName = $taskName;
$this->color = $color;
$this->attackCmd = $attackCmd;
$this->chunkTime = $chunkTime;
$this->statusTimer = $statusTimer;
Expand Down Expand Up @@ -81,6 +83,7 @@ function getKeyValueDict(): array {
$dict['cracked'] = $this->cracked;
$dict['taskId'] = $this->taskId;
$dict['taskName'] = $this->taskName;
$dict['color'] = $this->color;
$dict['attackCmd'] = $this->attackCmd;
$dict['chunkTime'] = $this->chunkTime;
$dict['statusTimer'] = $this->statusTimer;
Expand Down Expand Up @@ -116,6 +119,7 @@ static function getFeatures(): array {
$dict['cracked'] = ['read_only' => True, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => True, "private" => False, "alias" => "cracked", "public" => False, "dba_mapping" => False];
$dict['taskId'] = ['read_only' => True, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => True, "private" => False, "alias" => "taskId", "public" => False, "dba_mapping" => False];
$dict['taskName'] = ['read_only' => False, "type" => "str(256)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "taskName", "public" => False, "dba_mapping" => False];
$dict['color'] = ['read_only' => False, "type" => "str(50)", "subtype" => "unset", "choices" => "unset", "null" => True, "pk" => False, "protected" => False, "private" => False, "alias" => "color", "public" => False, "dba_mapping" => False];
$dict['attackCmd'] = ['read_only' => False, "type" => "str(65535)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "attackCmd", "public" => False, "dba_mapping" => False];
$dict['chunkTime'] = ['read_only' => False, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "chunkTime", "public" => False, "dba_mapping" => False];
$dict['statusTimer'] = ['read_only' => False, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "statusTimer", "public" => False, "dba_mapping" => False];
Expand Down Expand Up @@ -249,6 +253,14 @@ function setTaskName(?string $taskName): void {
$this->taskName = $taskName;
}

function getColor(): ?string {
return $this->color;
}

function setColor(?string $color): void {
$this->color = $color;
}

function getAttackCmd(): ?string {
return $this->attackCmd;
}
Expand Down Expand Up @@ -397,6 +409,7 @@ function setGroupName(?string $groupName): void {
const CRACKED = "cracked";
const TASK_ID = "taskId";
const TASK_NAME = "taskName";
const COLOR = "color";
const ATTACK_CMD = "attackCmd";
const CHUNK_TIME = "chunkTime";
const STATUS_TIMER = "statusTimer";
Expand Down
4 changes: 2 additions & 2 deletions src/dba/models/TaskWrapperDisplayFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getCacheValidTime(): int {
* @return TaskWrapperDisplay
*/
function getNullObject(): TaskWrapperDisplay {
return new TaskWrapperDisplay(-1, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
return new TaskWrapperDisplay(-1, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
}

/**
Expand All @@ -44,7 +44,7 @@ function createObjectFromDict($pk, $dict): TaskWrapperDisplay {
$conv[strtolower($key)] = $val;
}
$dict = $conv;
return new TaskWrapperDisplay($dict['taskwrapperid'], $dict['taskwrapperpriority'], $dict['taskwrappermaxagents'], $dict['tasktype'], $dict['hashlistid'], $dict['accessgroupid'], $dict['taskwrappername'], $dict['displayname'], $dict['taskwrapperisarchived'], $dict['cracked'], $dict['taskid'], $dict['taskname'], $dict['attackcmd'], $dict['chunktime'], $dict['statustimer'], $dict['keyspace'], $dict['keyspaceprogress'], $dict['taskpriority'], $dict['taskmaxagents'], $dict['issmall'], $dict['iscputask'], $dict['taskisarchived'], $dict['taskusepreprocessor'], $dict['hashlistname'], $dict['hashcount'], $dict['hashlistcracked'], $dict['hashtypeid'], $dict['hashtypedescription'], $dict['groupname']);
return new TaskWrapperDisplay($dict['taskwrapperid'], $dict['taskwrapperpriority'], $dict['taskwrappermaxagents'], $dict['tasktype'], $dict['hashlistid'], $dict['accessgroupid'], $dict['taskwrappername'], $dict['displayname'], $dict['taskwrapperisarchived'], $dict['cracked'], $dict['taskid'], $dict['taskname'], $dict['color'], $dict['attackcmd'], $dict['chunktime'], $dict['statustimer'], $dict['keyspace'], $dict['keyspaceprogress'], $dict['taskpriority'], $dict['taskmaxagents'], $dict['issmall'], $dict['iscputask'], $dict['taskisarchived'], $dict['taskusepreprocessor'], $dict['hashlistname'], $dict['hashcount'], $dict['hashlistcracked'], $dict['hashtypeid'], $dict['hashtypedescription'], $dict['groupname']);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/dba/models/generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@
['name' => 'cracked', 'read_only' => True, 'type' => 'int', 'protected' => True],
['name' => 'taskId', 'read_only' => True, 'type' => 'int', 'protected' => True],
['name' => 'taskName', 'read_only' => False, 'type' => 'str(256)'],
['name' => 'color', 'read_only' => False, 'type' => 'str(50)', 'null' => True],
['name' => 'attackCmd', 'read_only' => False, 'type' => 'str(65535)'],
['name' => 'chunkTime', 'read_only' => False, 'type' => 'int'],
['name' => 'statusTimer', 'read_only' => False, 'type' => 'int'],
Expand Down
2 changes: 1 addition & 1 deletion src/migrations/mysql/20260413140000_task-view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE VIEW TaskWrapperDisplay AS SELECT
tw.taskWrapperId AS taskWrapperId, tw.priority AS taskWrapperPriority, tw.maxAgents AS taskWrapperMaxAgents,
tw.taskType AS taskType, tw.hashlistId AS hashlistId, tw.accessGroupId AS accessGroupId,
tw.taskWrapperName AS taskWrapperName, tw.isArchived AS taskWrapperIsArchived, tw.cracked AS cracked,
t.taskId AS taskId, t.taskName AS taskName, t.attackCmd AS attackCmd, t.chunkTime AS chunkTime,
t.taskId AS taskId, t.taskName AS taskName, t.color AS color, t.attackCmd AS attackCmd, t.chunkTime AS chunkTime,
t.statusTimer AS statusTimer, t.keyspace AS keyspace, t.keyspaceProgress AS keyspaceProgress,
t.priority AS taskPriority, t.maxAgents AS taskMaxAgents, t.isArchived AS taskIsArchived,
t.isSmall AS isSmall, t.isCpuTask AS isCpuTask, t.usePreprocessor AS taskUsePreprocessor,
Expand Down
2 changes: 1 addition & 1 deletion src/migrations/postgres/20260413140000_task-view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE VIEW TaskWrapperDisplay AS SELECT
tw.taskWrapperId AS taskWrapperId, tw.priority AS taskWrapperPriority, tw.maxAgents AS taskWrapperMaxAgents,
tw.taskType AS taskType, tw.hashlistId AS hashlistId, tw.accessGroupId AS accessGroupId,
tw.taskWrapperName AS taskWrapperName, tw.isArchived AS taskWrapperIsArchived, tw.cracked AS cracked,
t.taskId AS taskId, t.taskName AS taskName, t.attackCmd AS attackCmd, t.chunkTime AS chunkTime,
t.taskId AS taskId, t.taskName AS taskName, t.color AS color, t.attackCmd AS attackCmd, t.chunkTime AS chunkTime,
t.statusTimer AS statusTimer, t.keyspace AS keyspace, t.keyspaceProgress AS keyspaceProgress,
t.priority AS taskPriority, t.maxAgents AS taskMaxAgents, t.isArchived AS taskIsArchived,
t.isSmall AS isSmall, t.isCpuTask AS isCpuTask, t.usePreprocessor AS taskUsePreprocessor,
Expand Down
Loading