diff --git a/src/inc/Util.class.php b/src/inc/Util.class.php index 8392b0556..4f3f11068 100755 --- a/src/inc/Util.class.php +++ b/src/inc/Util.class.php @@ -563,6 +563,34 @@ public static function getStaticArray($val, $id) { return ""; } + /** + * @param $version1 + * @param $version2 + * @return int 1 if version2 is newer, 0 if equal and -1 if version1 is newer + */ + public static function versionComparison($version1, $version2){ + $version1 = explode(".", $version1); + $version2 = explode(".", $version2); + + for($i=0;$i $num2){ + return -1; + } + else if($num1 < $num2){ + return 1; + } + } + if(sizeof($version1) > sizeof($version2)){ + return -1; + } + else if(sizeof($version1) < sizeof($version2)){ + return 1; + } + return 0; + } + /** * Shows big numbers with the right suffixes (k, M, G) * @param $num int integer you want formatted diff --git a/src/install/hashtopussy.sql b/src/install/hashtopussy.sql index 06b59d492..85986c5fb 100755 --- a/src/install/hashtopussy.sql +++ b/src/install/hashtopussy.sql @@ -461,7 +461,7 @@ INSERT INTO `RightGroup` (`rightGroupId`, `groupName`, `level`) VALUES (5, 'Administrator', 50); INSERT INTO `AgentBinary` (`agentBinaryId`, `type`, `operatingSystems`, `filename`, `version`) -VALUES (1, 'csharp', 'Windows', 'hashtopussy.exe', '0.38'); +VALUES (1, 'csharp', 'Windows', 'hashtopussy.exe', '0.40'); CREATE TABLE `Session` ( `sessionId` INT(11) NOT NULL, diff --git a/src/install/migrate.sql b/src/install/migrate.sql deleted file mode 100755 index 40bb546ce..000000000 --- a/src/install/migrate.sql +++ /dev/null @@ -1,68 +0,0 @@ -/* -WARNING: This file is highly outdated, it might be removed later - */ - -/* Add new column to existing agents table */ -ALTER TABLE agents ADD `userId` int(11) NOT NULL DEFAULT '0'; -ALTER TABLE hashlists ADD `hexsalt` int(11) NOT NULL DEFAULT '0'; - -CREATE TABLE IF NOT EXISTS `RightGroup` ( - `rightGroupId` int(11) NOT NULL AUTO_INCREMENT, - `groupName` varchar(30) COLLATE utf8_bin NOT NULL, - `level` int(11) NOT NULL, - PRIMARY KEY (`rightGroupId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=6 ; - -INSERT INTO `RightGroup` (`rightGroupId`, `groupName`, `level`) VALUES -(1, 'View User', 1), -(2, 'Read Only User', 5), -(3, 'Normal User', 20), -(4, 'Superuser', 30), -(5, 'Administrator', 50); - -CREATE TABLE IF NOT EXISTS `Session` ( - `sessionId` int(11) NOT NULL AUTO_INCREMENT, - `userId` int(11) NOT NULL, - `sessionStartDate` int(11) NOT NULL, - `lastActionDate` int(11) NOT NULL, - `isOpen` tinyint(4) NOT NULL, - `sessionLifetime` int(11) NOT NULL, - `sessionKey` varchar(500) NOT NULL, - PRIMARY KEY (`sessionId`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `User` ( - `userId` int(11) NOT NULL AUTO_INCREMENT, - `username` varchar(50) COLLATE utf8_bin NOT NULL, - `passwordHash` varchar(512) COLLATE utf8_bin NOT NULL, - `email` varchar(512) COLLATE utf8_bin NOT NULL, - `passwordSalt` varchar(512) COLLATE utf8_bin NOT NULL, - `isValid` tinyint(11) NOT NULL, - `isComputedPassword` tinyint(11) NOT NULL, - `lastLoginDate` int(11) NOT NULL, - `registeredSince` int(11) NOT NULL, - `sessionLifetime` int(11) NOT NULL DEFAULT '600', - `rightGroupId` int(11) NOT NULL DEFAULT '1', - PRIMARY KEY (`userId`), - UNIQUE KEY `username` (`username`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; - -INSERT INTO `hashcatreleases` (`version`, `time`, `url_nvidia`, `url_amd`, `common_files`, `32_nvidia`, `64_nvidia`, `32_amd`, `64_amd`, `rootdir_nvidia`, `rootdir_amd`, `minver_nvidia`, `minver_amd`) VALUES -('3.10', 1457330572, 'https://hashcat.net/files/hashcat-3.10.7z', 'https://hashcat.net/files/hashcat-3.10.7z', 'hashcat.hcstat hashcat.hctune', 'OpenCL/*', 'OpenCL/*', 'OpenCL/*', 'OpenCL/*', 'hashcat-3.10', 'hashcat-3.10', 34659, 1409); - -CREATE TABLE `Supertask` ( - `supertaskId` int(11) NOT NULL, - `name` varchar(100) COLLATE utf8_bin NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -ALTER TABLE `Supertask` - ADD PRIMARY KEY (`supertaskId`); - -CREATE TABLE `SupertaskTask` ( - `supertaskTaskId` int(11) NOT NULL, - `supertaskId` int(11) NOT NULL, - `taskId` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -ALTER TABLE `SupertaskTask` - ADD PRIMARY KEY (`supertaskTaskId`); \ No newline at end of file diff --git a/src/install/updates/update_v0.2.0-beta_v0.2.0.php b/src/install/updates/update_v0.2.0-beta_v0.2.0.php index ce6ca7e54..b7119fd64 100644 --- a/src/install/updates/update_v0.2.0-beta_v0.2.0.php +++ b/src/install/updates/update_v0.2.0-beta_v0.2.0.php @@ -25,9 +25,9 @@ $qF = new QueryFilter(AgentBinary::TYPE, "csharp", "="); $binary = $FACTORIES::getAgentBinaryFactory()->filter(array($FACTORIES::FILTER => $qF), true); if($binary != null){ - if($binary->getVersion() < "0.38"){ + if(Util::versionComparison($binary->getVersion(), "0.40") == 1){ echo "update version... "; - $binary->setVersion("0.38"); + $binary->setVersion("0.40"); $FACTORIES::getAgentBinaryFactory()->update($binary); echo "OK"; } diff --git a/src/static/hashtopussy.exe b/src/static/hashtopussy.exe index e60e8b21e..5d08a8d1a 100644 Binary files a/src/static/hashtopussy.exe and b/src/static/hashtopussy.exe differ