-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New attack mode: Association attack #95
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(boinccmd --project 127.0.0.1/fitcrack/ detach || true) && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed for our repo. |
||
KEY=$(boinccmd --create_account 127.0.0.1/fitcrack/ [email protected] fitcrack dukek | grep -oP 'account key: \K\w+') && | ||
boinccmd --project_attach 127.0.0.1/fitcrack/ $KEY |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,15 +5,15 @@ services: | |
image: fitcrack_server | ||
|
||
hostname: fitcrack | ||
|
||
cap_add: | ||
- SYS_NICE | ||
# Configuration of the build context | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
- COMPILER_THREADS=1 # Higher values may cause linker race conditions | ||
|
||
command: ./entrypoint-fitcrack.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly bad merge of dev branch? |
||
restart: always | ||
ports: | ||
- ${BACKEND_PORT}:${BACKEND_PORT} # Mapping of WebAdmin backend | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
./remove_docker_installation.sh && | ||
yes | docker system prune -a --volumes && | ||
docker-compose -f docker-compose-custom-build.yml build && | ||
docker-compose -f docker-compose-custom-build.yml up |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ enum AttackType { | |
AT_Benchmark, | ||
AT_HybridDictMask, | ||
AT_HybridMaskDict, | ||
AT_Association, | ||
AT_Unknown | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Author : see AUTHORS | ||
* Licence: MIT, see LICENSE | ||
*/ | ||
|
||
#ifndef ATTACKASSOCIATION_HPP | ||
#define ATTACKASSOCIATION_HPP | ||
|
||
#include "AttackCrackingBase.hpp" | ||
|
||
/** Class representing hashcat's association attack */ | ||
class AttackAssociation: public AttackCrackingBase { | ||
|
||
protected: | ||
|
||
/** | ||
* @brief Adds all attack specific arguments | ||
*/ | ||
void addSpecificArguments(); | ||
|
||
public: | ||
|
||
/** | ||
* @brief Basic constructor | ||
* @param config [in] Representation of config file | ||
* @param directory [in] Working directory | ||
*/ | ||
AttackAssociation(const ConfigTask& config, Directory& directory); | ||
|
||
}; | ||
#endif // ATTACKASSOCIATION_HPP |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Author : see AUTHORS | ||
* Licence: MIT, see LICENSE | ||
*/ | ||
|
||
#include "AttackAssociation.hpp" | ||
#include "Dictstat.hpp" | ||
|
||
|
||
AttackAssociation::AttackAssociation(const ConfigTask& config, Directory& directory) | ||
: AttackCrackingBase(config, directory, "9") { // change attack mode for hashcat | ||
std::string mode; | ||
|
||
config.find("mode", mode); | ||
|
||
// This is abusing an undefined behavior in hascat (multiple definitions of attack mode argument) | ||
// The last defined one will be considered the correct | ||
if (mode == "b" || mode == "a"){ | ||
// Association mode doen't like 0 keyspace so testing is done on dictionary | ||
addArgument("-a"); | ||
addArgument("0"); | ||
} | ||
} | ||
|
||
void AttackAssociation::addSpecificArguments() { | ||
AttackCrackingBase::addSpecificArguments(); | ||
|
||
if (attack_submode_ == "0") { | ||
|
||
// Do nothing just at the end add dictionaries | ||
|
||
} else if (attack_submode_ == "1") { | ||
|
||
addArgument("--rules-file"); | ||
addRequiredFile("rules"); | ||
|
||
} else { | ||
RunnerUtils::runtimeException("Unsupported attack_submode = " + attack_submode_ + " attack_mode = " + attack_mode_ + " has no such attack_submode"); | ||
} | ||
|
||
std::string relativePath = addRequiredFile("dict1"); | ||
|
||
std::string dict1Keyspace; | ||
if (config_.find(ConfigTask::DICT1_KEYSPACE, dict1Keyspace)) { | ||
// Build hashcat.dictstat2 so hashcat does not have to recompute | ||
// number of passwords in this dictionary - could be a bottleneck for huge | ||
// dictionaries. | ||
DictStatBuilder dsBuilder; | ||
bool dict1StatAdded = | ||
dsBuilder.addStatForDict(relativePath.c_str(), stoull(dict1Keyspace)); | ||
if (dict1StatAdded) { | ||
Logging::debugPrint(Logging::Detail::GeneralInfo, | ||
"dictstat2 created for " + relativePath); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* @file AttackDict.h | ||
* @brief Header file for creation of Dictionary Attack | ||
* @authors Lukas Zobal (zobal.lukas(at)gmail.com) | ||
* @date 12. 12. 2018 | ||
* @license MIT, see LICENSE | ||
*/ | ||
|
||
#ifndef WORKGENERATOR_ATTACKASSOC_H | ||
#define WORKGENERATOR_ATTACKASSOC_H | ||
|
||
#include <AttackMode.h> | ||
|
||
|
||
class CAttackAssoc : public AttackMode { | ||
public: | ||
/** | ||
* @brief Constructor for Association Attack | ||
* @param job [in] Instance of CJob which is parent of this attack instance | ||
* @param host [in] Instance of CHost which this attack belongs to | ||
* @param seconds [in] Number of seconds this instance of attack should take | ||
*/ | ||
CAttackAssoc(PtrJob job, PtrHost &host, uint64_t seconds, CSqlLoader *sqlLoader); | ||
|
||
/** | ||
* @brief Default destructor | ||
*/ | ||
~CAttackAssoc() override = default; | ||
|
||
/** | ||
* @brief Creates BOINC workunit, adds entry to fc_workunit | ||
* @return True if a workunit was planned, False otherwise | ||
*/ | ||
bool makeWorkunit() override ; | ||
|
||
virtual bool requiresDicts() const override {return true;} | ||
|
||
virtual bool hasStickyLeftDict() const override { | ||
return m_job->getDistributionMode() == 1 || m_job->getDistributionMode() == 2; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to put these constants to enum |
||
} | ||
|
||
/** | ||
* @brief enum for distribution mode options readability | ||
*/ | ||
enum DistributionMode { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have them here, so move this declaration somewhere else, into some more general header, so we can use these named constants everywhere. |
||
FragmentOnServer = 0, | ||
FragmentOnHosts = 1, | ||
FragmentByRules = 2 | ||
}; | ||
|
||
private: | ||
/** | ||
* @brief Function to generate new CWorkunit for certain host for given time | ||
* @return True if workunit was generated successfully, False otherwise | ||
*/ | ||
bool generateWorkunit() override ; | ||
}; | ||
|
||
#endif //WORKGENERATOR_ATTACKASSOC_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* @file AttackDict.h | ||
* @brief Header file for creation of Dictionary Attack | ||
* @authors Lukas Zobal (zobal.lukas(at)gmail.com) | ||
* @date 12. 12. 2018 | ||
* @license MIT, see LICENSE | ||
*/ | ||
|
||
#ifndef WORKGENERATOR_ATTACKASSOC_NO_RULE_H | ||
#define WORKGENERATOR_ATTACKASSOC_NO_RULE_H | ||
|
||
#include <AttackMode.h> | ||
|
||
|
||
class CAttackAssocNoRule : public AttackMode { | ||
public: | ||
/** | ||
* @brief Constructor for Association Attack | ||
* @param job [in] Instance of CJob which is parent of this attack instance | ||
* @param host [in] Instance of CHost which this attack belongs to | ||
* @param seconds [in] Number of seconds this instance of attack should take | ||
*/ | ||
CAttackAssocNoRule(PtrJob job, PtrHost &host, uint64_t seconds, CSqlLoader *sqlLoader); | ||
|
||
/** | ||
* @brief Default destructor | ||
*/ | ||
~CAttackAssocNoRule() override = default; | ||
|
||
/** | ||
* @brief Creates BOINC workunit, adds entry to fc_workunit | ||
* @return True if a workunit was planned, False otherwise | ||
*/ | ||
bool makeWorkunit() override ; | ||
|
||
virtual bool requiresDicts() const override {return true;} | ||
|
||
virtual bool hasStickyLeftDict() const override { | ||
return m_job->getDistributionMode() == 1 || m_job->getDistributionMode() == 2; | ||
} | ||
|
||
/** | ||
* @brief enum for distribution mode options readability | ||
*/ | ||
enum DistributionMode { | ||
FragmentOnServer = 0, | ||
FragmentOnHosts = 1, | ||
FragmentByRules = 2 | ||
}; | ||
|
||
private: | ||
/** | ||
* @brief Function to generate new CWorkunit for certain host for given time | ||
* @return True if workunit was generated successfully, False otherwise | ||
*/ | ||
bool generateWorkunit() override ; | ||
}; | ||
|
||
#endif //WORKGENERATOR_ATTACKASSOC_NO_RULE_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need these changes?