Last active
March 25, 2017 21:37
-
-
Save vegarringdal/8796134f9ab8db17e8113ef035d3e506 to your computer and use it in GitHub Desktop.
code odd arve test 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| #include <cstdlib> | |
| #include <ctime> | |
| using namespace std; | |
| // amaazing | |
| static const char alphanum[] = | |
| "0123456789" | |
| //"!@#$%^&*" | |
| "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
| "abcdefghijklmnopqrstuvwxyz"; | |
| std::string brute(const std::string& password) | |
| { | |
| std::string guess(3, ' '); | |
| for (char c : alphanum) for (char d : alphanum) for (char e : alphanum){ | |
| guess[0] = c; | |
| guess[1] = d; | |
| guess[2] = e; | |
| cout << guess << endl; | |
| if (guess == password) | |
| return guess; | |
| } | |
| return ""; | |
| } | |
| int main() | |
| { | |
| //why only 3? | |
| cout << "Enter 3 charater to bruteforce > " << flush; | |
| string value; | |
| cin >> value; | |
| std::string password = value; | |
| std::string answer = brute(password); | |
| if (answer != "") | |
| std::cout << "Password is " << answer << endl; | |
| else | |
| std::cout << "No answer found" << endl; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment