-
Notifications
You must be signed in to change notification settings - Fork 38
New attack mode: Association attack #95
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
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 |
|---|---|---|
|
|
@@ -153,7 +153,7 @@ RUN mkdir /srv/db_init | |
| EXPOSE 80 | ||
| EXPOSE 5000 | ||
|
|
||
| HEALTHCHECK --interval=5s --timeout=20s CMD ps -ef | grep apache2 | grep -v grep || exit 1 | ||
|
|
||
| # Entrypoint | ||
| RUN ["chmod", "+x", "/srv/fitcrack/entrypoint-fitcrack.sh"] | ||
| ENTRYPOINT ["/srv/fitcrack/entrypoint-fitcrack.sh"] | ||
|
Contributor
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. Why we need these changes? |
||
|
|
||
| HEALTHCHECK --interval=5s --timeout=20s CMD ps -ef | grep apache2 | grep -v grep || exit 1 | ||
|
Contributor
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. Yeah. I also think the changes here are nonsense. Will test and remove. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| (boinccmd --project 127.0.0.1/fitcrack/ detach || true) && | ||
|
Contributor
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/ xwagne10@vutbr.cz fitcrack dukek | grep -oP 'account key: \K\w+') && | ||
| boinccmd --project_attach 127.0.0.1/fitcrack/ $KEY | ||
|
Contributor
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. I too have zero idea what the changes here are supposed to mean. |
| 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 | ||
|
Contributor
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 | ||
|
|
||
|
Contributor
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. Yeah. I also think the changes here are nonsense. Will test and remove. |
| 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); | ||
| } | ||
| } | ||
| } |
|
Contributor
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. I suppose I agree with David's points and will implement them. |
| 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; | ||
|
Contributor
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 { | ||
|
Contributor
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 | ||
|
Contributor
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. I suppose the same points pertaining to the last file "AttackAssoc.h" also apply here. Will keep in mind. |
| 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.
Yeah. I also think the changes here are nonsense. Will test and remove.