Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <stdio.h>
- #include <array>
- using namespace std;
- string exec(const char* cmd) {
- FILE* pipe = popen(cmd, "r");
- if (!pipe) return "ERROR";
- char buffer[128];
- string result = "";
- while(!feof(pipe)) {
- if(fgets(buffer, 128, pipe) != NULL)
- result += buffer;
- }
- pclose(pipe);
- return result;
- }
- string createWord(char letters[], int ziffern[])
- {
- string word = "";
- for(int i=0; i<sizeof(ziffern); i++) { word += letters[ziffern[i]]; }
- return word;
- }
- bool testWord(string word)
- {
- string result = exec(("7za.exe e Brut.zip -p" + word + " -y").c_str());
- if(result[137] == 'D')
- {
- cout << "TRY FOR '" << word << "' - FALSE" << endl;
- return false;
- } else {
- cout << "TRY FOR '" << word << "' - TRUE" << endl;
- return true;
- }
- }
- int main()
- {
- /* --- informationen ---
- * ziffern: 6
- * buchstaben: abcdefghijklmnopqrstuvwxyz12345
- */
- // --- parameter ---
- char letters[] = "abcdefghijklmnopqrstuvwxyz12345";
- int length = 6;
- // --- ausrechnen ---
- int ziffern[length];
- for(int i=0; i<length; i++) { ziffern[i] = 0; }
- int times = 1;
- for(int i=0; i<length; i++) { times *= (sizeof(letters))-1; }
- //int z1 = 0, z2 = 0, z3 = 0, z4 = 0, z5 = 0, z6 = 0;
- // --- vordefinitionen ---
- string word;
- bool stop = false;
- for(int i=0; i<times; i++)
- {
- if(stop == false)
- {
- word = createWord(letters, ziffern);
- if(testWord(word)) { stop = true; }
- else
- {
- ziffern[sizeof(ziffern)-1]++;
- for(int i=sizeof(ziffern); i>0; i--)
- {
- if(ziffern[i] == sizeof(letters))
- {
- ziffern[i] = 0;
- ziffern[i-1]++;
- }
- }
- if(ziffern[0] == sizeof(letters))
- {
- cout << "ERROR: NO PASSWORD FOUND" << endl;
- stop = true;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement