Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _PASSPATTERN_H
- #define _PASSPATTERN_H
- #include <unordered_map>
- #include <algorithm>
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <string>
- /*
- * A simple program that will take a list of plaintext passwords and print out a list of patterns. Fun for analyzing
- * the most common patterns for which you should generate rainbowtables in order to crack the most amount of common
- * passwords.
- */
- class PassPattern {
- private:
- // Private struct and comparator for holding and sorting patterns/counts respectively.
- // Figured they'd be slightly faster than std::pair...
- struct pattern;
- struct patternSorter;
- public:
- PassPattern() = default; // default constructor
- PassPattern(const std::string&); // accept file as a string ref parameter
- std::vector<pattern> parse(); // actually parse the data and return a sorted vector of pattern structs
- std::string filename(); // gets the fname variable
- void write( // writes the data to a text file
- const std::string&,
- const std::vector<pattern> &,
- char
- );
- private:
- inline char getCharType(char); // retrieve a character type
- inline void setCharType(const std::string&, char); // set each item in a string to a respective char in the charmap
- inline bool exists(const std::string&); // checks if a file exists or not...
- std::vector <pattern> patterns; // vector of pattern strings and their number of occurances
- std::unordered_map<char, char> charmap; // map of characters... each printable character maps to another
- std::string fname{}; // file name
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment