hashtopolis / server

Hashtopolis - distributed password cracking with Hashcat
GNU General Public License v3.0
1.42k stars 212 forks source link

[BUG]: Int too small for AgentStatsId #1047

Open zyronix opened 5 months ago

zyronix commented 5 months ago

Version Information

0.14.1

Hashcat

No response

Description

In case of a long running hashtopolis environment, you can run into the int being too small for storing ids of some of the stats or logging entries.

As an example, this will result in something like this, an agent trying to submit progress:

[php:error] [pid 31340] PHP Fatal error:  Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2147483647' for key 'AgentStat.PRIMARY' inAbstractModelFactory.class.php:115

Stack trace:
#0 hashtopolis/dba/AbstractModelFactory.class.php(115): PDOStatement->execute()
#1 hashtopolis/dba/models/AgentStatFactory.class.php(80): DBA\\AbstractModelFactory->save()
#2 hashtopolis/inc/api/APISendProgress.class.php(99): DBA\\AgentStatFactory->save()
#3 hashtopolis/api/server.php(141): APISendProgress->execute()
#4 {main}
thrown in hashtopolis/dba/AbstractModelFactory.class.php on line 115

This is because the key is created as a int(11). Simple fix for this is:

ALTER TABLE AgentStat MODIFY agentStatId BIGINT AUTO_INCREMENT;

@s3inlc there are multiple solutions

  1. we could increase the INT to BIGINT for just AgentStat
  2. we could increase them for all stat/log tables (Speed, AgentStat, Log, maybe others?)
  3. we could increase all ints to 64 int by default

Any preference?