Skip to content

Instantly share code, notes, and snippets.

@vegarringdal
Last active March 25, 2017 21:37
Show Gist options
  • Select an option

  • Save vegarringdal/8796134f9ab8db17e8113ef035d3e506 to your computer and use it in GitHub Desktop.

Select an option

Save vegarringdal/8796134f9ab8db17e8113ef035d3e506 to your computer and use it in GitHub Desktop.
code odd arve test 1
#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