Skip to content

Commit

Permalink
Merge pull request #1107 from hashtopolis/1096-enhancement-increase-t…
Browse files Browse the repository at this point in the history
…he-limit-of-the-attack-command-length

1096 enhancement increase the limit of the attack command length
  • Loading branch information
jessevz authored Nov 4, 2024
2 parents 4068735 + 912a92e commit 319c619
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/dba/models/Agent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static function getFeatures() {
$dict['uid'] = ['read_only' => False, "type" => "str(100)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "uid"];
$dict['os'] = ['read_only' => False, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "os"];
$dict['devices'] = ['read_only' => False, "type" => "str(65535)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "devices"];
$dict['cmdPars'] = ['read_only' => False, "type" => "str(256)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "cmdPars"];
$dict['cmdPars'] = ['read_only' => False, "type" => "str(65535)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "cmdPars"];
$dict['ignoreErrors'] = ['read_only' => False, "type" => "int", "subtype" => "unset", "choices" => [0 => "Deactivate agent on error", 1 => "Keep agent running, but save errors", 2 => "Keep agent running and discard errors", ], "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "ignoreErrors"];
$dict['isActive'] = ['read_only' => False, "type" => "bool", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "isActive"];
$dict['isTrusted'] = ['read_only' => False, "type" => "bool", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "isTrusted"];
Expand Down
2 changes: 1 addition & 1 deletion src/dba/models/HealthCheck.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static function getFeatures() {
$dict['hashtypeId'] = ['read_only' => False, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "hashtypeId"];
$dict['crackerBinaryId'] = ['read_only' => False, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "crackerBinaryId"];
$dict['expectedCracks'] = ['read_only' => True, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => True, "private" => False, "alias" => "expectedCracks"];
$dict['attackCmd'] = ['read_only' => True, "type" => "str(256)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => True, "private" => False, "alias" => "attackCmd"];
$dict['attackCmd'] = ['read_only' => True, "type" => "str(65535)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => True, "private" => False, "alias" => "attackCmd"];

return $dict;
}
Expand Down
2 changes: 1 addition & 1 deletion src/dba/models/Pretask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static function getFeatures() {
$dict = array();
$dict['pretaskId'] = ['read_only' => True, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => True, "protected" => True, "private" => False, "alias" => "pretaskId"];
$dict['taskName'] = ['read_only' => False, "type" => "str(100)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "taskName"];
$dict['attackCmd'] = ['read_only' => False, "type" => "str(256)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "attackCmd"];
$dict['attackCmd'] = ['read_only' => False, "type" => "str(65535)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "attackCmd"];
$dict['chunkTime'] = ['read_only' => False, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "chunkTime"];
$dict['statusTimer'] = ['read_only' => False, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "statusTimer"];
$dict['color'] = ['read_only' => False, "type" => "str(20)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "color"];
Expand Down
2 changes: 1 addition & 1 deletion src/dba/models/Task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static function getFeatures() {
$dict = array();
$dict['taskId'] = ['read_only' => True, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => True, "protected" => True, "private" => False, "alias" => "taskId"];
$dict['taskName'] = ['read_only' => False, "type" => "str(256)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "taskName"];
$dict['attackCmd'] = ['read_only' => False, "type" => "str(256)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "attackCmd"];
$dict['attackCmd'] = ['read_only' => False, "type" => "str(65535)", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "attackCmd"];
$dict['chunkTime'] = ['read_only' => False, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "chunkTime"];
$dict['statusTimer'] = ['read_only' => False, "type" => "int", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => False, "private" => False, "alias" => "statusTimer"];
$dict['keyspace'] = ['read_only' => True, "type" => "int64", "subtype" => "unset", "choices" => "unset", "null" => False, "pk" => False, "protected" => True, "private" => False, "alias" => "keyspace"];
Expand Down
8 changes: 4 additions & 4 deletions src/dba/models/generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
['name' => 'uid', 'read_only' => False, 'type' => 'str(100)'],
['name' => 'os', 'read_only' => False, 'type' => 'int'],
['name' => 'devices', 'read_only' => False, 'type' => 'str(65535)'],
['name' => 'cmdPars', 'read_only' => False, 'type' => 'str(256)'],
['name' => 'cmdPars', 'read_only' => False, 'type' => 'str(65535)'],
['name' => 'ignoreErrors', 'read_only' => False, 'type' => 'int', 'choices' => $FieldIgnoreErrorsChoices],
['name' => 'isActive', 'read_only' => False, 'type' => 'bool'],
['name' => 'isTrusted', 'read_only' => False, 'type' => 'bool'],
Expand Down Expand Up @@ -267,7 +267,7 @@
['name' => 'hashtypeId', 'read_only' => False, 'type' => 'int'],
['name' => 'crackerBinaryId', 'read_only' => False, 'type' => 'int'],
['name' => 'expectedCracks', 'read_only' => True, 'type' => 'int', 'protected' => True],
['name' => 'attackCmd', 'read_only' => True, 'type' => 'str(256)', 'protected' => True],
['name' => 'attackCmd', 'read_only' => True, 'type' => 'str(65535)', 'protected' => True],
],
];
$CONF['HealthCheckAgent'] = [
Expand Down Expand Up @@ -319,7 +319,7 @@
'columns' => [
['name' => 'pretaskId', 'read_only' => True, 'type' => 'int', 'protected' => True],
['name' => 'taskName', 'read_only' => False, 'type' => 'str(100)'],
['name' => 'attackCmd', 'read_only' => False, 'type' => 'str(256)'],
['name' => 'attackCmd', 'read_only' => False, 'type' => 'str(65535)'],
['name' => 'chunkTime', 'read_only' => False, 'type' => 'int'],
['name' => 'statusTimer', 'read_only' => False, 'type' => 'int'],
['name' => 'color', 'read_only' => False, 'type' => 'str(20)'],
Expand Down Expand Up @@ -382,7 +382,7 @@
'columns' => [
['name' => 'taskId', 'read_only' => True, 'type' => 'int', 'protected' => True],
['name' => 'taskName', 'read_only' => False, 'type' => 'str(256)'],
['name' => 'attackCmd', 'read_only' => False, 'type' => 'str(256)'],
['name' => 'attackCmd', 'read_only' => False, 'type' => 'str(65535)'],
['name' => 'chunkTime', 'read_only' => False, 'type' => 'int'],
['name' => 'statusTimer', 'read_only' => False, 'type' => 'int'],
['name' => 'keyspace', 'read_only' => True, 'type' => 'int64', 'protected' => True],
Expand Down
4 changes: 2 additions & 2 deletions src/inc/utils/PretaskUtils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ public static function createPretask($name, $cmdLine, $chunkTime, $statusTimer,
else if (strpos($cmdLine, SConfig::getInstance()->getVal(DConfig::HASHLIST_ALIAS)) === false) {
throw new HTException("The attack command does not contain the hashlist alias!");
}
else if (strlen($cmdLine) > 256) {
throw new HTException("Attack command is too long (max 256 characters)!");
else if (strlen($cmdLine) > 65535) {
throw new HTException("Attack command is too long (max 65535 characters)!");
}
else if (Util::containsBlacklistedChars($cmdLine)) {
throw new HTException("The command must contain no blacklisted characters!");
Expand Down
4 changes: 2 additions & 2 deletions src/inc/utils/TaskUtils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,8 @@ public static function createTask($hashlistId, $name, $attackCmd, $chunkTime, $s
else if (strpos($attackCmd, SConfig::getInstance()->getVal(DConfig::HASHLIST_ALIAS)) === false) {
throw new HTException("Attack command does not contain hashlist alias!");
}
else if (strlen($attackCmd) > 256) {
throw new HTException("Attack command is too long (max 256 characters)!");
else if (strlen($attackCmd) > 65535) {
throw new HTException("Attack command is too long (max 65535 characters)!");
}
else if ($staticChunking < DTaskStaticChunking::NORMAL || $staticChunking > DTaskStaticChunking::NUM_CHUNKS) {
throw new HTException("Invalid static chunk setting!");
Expand Down
8 changes: 4 additions & 4 deletions src/install/hashtopolis.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE TABLE `Agent` (
`uid` VARCHAR(100) NOT NULL,
`os` INT(11) NOT NULL,
`devices` TEXT NOT NULL,
`cmdPars` VARCHAR(256) NOT NULL,
`cmdPars` TEXT NOT NULL,
`ignoreErrors` TINYINT(4) NOT NULL,
`isActive` TINYINT(4) NOT NULL,
`isTrusted` TINYINT(4) NOT NULL,
Expand Down Expand Up @@ -786,7 +786,7 @@ CREATE TABLE `NotificationSetting` (
CREATE TABLE `Pretask` (
`pretaskId` INT(11) NOT NULL,
`taskName` VARCHAR(100) NOT NULL,
`attackCmd` VARCHAR(256) NOT NULL,
`attackCmd` TEXT NOT NULL,
`chunkTime` INT(11) NOT NULL,
`statusTimer` INT(11) NOT NULL,
`color` VARCHAR(20) NULL,
Expand Down Expand Up @@ -851,7 +851,7 @@ CREATE TABLE `SupertaskPretask` (
CREATE TABLE `Task` (
`taskId` INT(11) NOT NULL,
`taskName` VARCHAR(256) NOT NULL,
`attackCmd` VARCHAR(256) NOT NULL,
`attackCmd` TEXT NOT NULL,
`chunkTime` INT(11) NOT NULL,
`statusTimer` INT(11) NOT NULL,
`keyspace` BIGINT(20) NOT NULL,
Expand Down Expand Up @@ -954,7 +954,7 @@ CREATE TABLE `HealthCheck` (
`hashtypeId` INT(11) NOT NULL,
`crackerBinaryId` INT(11) NOT NULL,
`expectedCracks` INT(11) NOT NULL,
`attackCmd` VARCHAR(256) NOT NULL
`attackCmd` TEXT NOT NULL
) ENGINE=InnoDB;

CREATE TABLE `HealthCheckAgent` (
Expand Down
11 changes: 11 additions & 0 deletions src/install/updates/update_v0.14.2_v0.14.x.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php /** @noinspection SqlNoDataSourceInspection */

use DBA\Factory;

if (!isset($PRESENT["v0.14.x_attackCmd"])) {
Factory::getAgentFactory()->getDB()->query("ALTER TABLE `Task` MODIFY `attackCmd` TEXT NOT NULL;");
Factory::getAgentFactory()->getDB()->query("ALTER TABLE `Pretask` MODIFY `attackCmd` TEXT NOT NULL;");
Factory::getAgentFactory()->getDB()->query("ALTER TABLE `HealthCheck` MODIFY `attackCmd` TEXT NOT NULL;");
Factory::getAgentFactory()->getDB()->query("ALTER TABLE `Agent` MODIFY `cmdPars` TEXT NOT NULL;");
$EXECUTED["v0.14.x_attackCmd"] = true;
}
1 change: 0 additions & 1 deletion src/install/updates/update_v0.14.x_v0.14.2.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php /** @noinspection SqlNoDataSourceInspection */

use DBA\Factory;
use DBA\HashType;


if (!isset($PRESENT["v0.14.x_maxAgents_taskwrapper"])) {
Expand Down

0 comments on commit 319c619

Please sign in to comment.