Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // desmain.cpp
- #include <iostream>
- #include <fstream>
- #include <string>
- int main(int argc, char* argv[])
- {
- system(argv[1]);
- std::cout << "Loading " << argv[1] << " into memory..." << std::endl;
- std::ifstream* scrambleList = new std::ifstream(argv[1]);
- std::ofstream* outputList = new std::ofstream(argv[3]);
- std::string scrambleArray[50];
- std::string tempStr;
- std::string tempStr2;
- // Loading all the data from the scrambled list into main.
- for(int i = 0; i < 50; i++)
- {
- *scrambleList >> scrambleArray[i];
- std::cout << "#" << i << ": " << scrambleArray[i] << std::endl;
- if(scrambleList->eof())
- break;
- }
- std::cout << "Loading complete!" << std::endl << std::endl;
- // Parse and read data from and to other programs
- for(int i = 0; scrambleArray[i] != "\0"; i++)
- {
- std::cout << std::endl << "Executing decoders for " << scrambleArray[i] << std::endl;
- tempStr = "deslen ";
- tempStr += scrambleArray[i] + " ";
- tempStr += argv[2];
- tempStr += " ";
- tempStr += "temp";
- system((char*)tempStr.c_str());
- std::ifstream* tempList = new std::ifstream("temp");
- *tempList >> tempStr2;
- tempList->close();
- *outputList << tempStr2 << ",";
- }
- scrambleList->close();
- outputList->close();
- system(argv[3]);
- return 0;
- }
- // deslen.cpp
- #include <iostream>
- #include <fstream>
- bool sizeEqual(std::string a,std::string b)
- {
- int lA = 0;
- for(;; lA++)
- {
- if(a[lA] == '\0')
- break;
- }
- int lB = 0;
- for(;; lB++)
- {
- if(b[lB] == '\0')
- break;
- }
- return (lA == lB);
- }
- int main(int argc, char* argv[])
- {
- std::ofstream* targetList = new std::ofstream(argv[3]);
- std::ifstream* wordList = new std::ifstream(argv[2]);
- std::string fullArray[2048];
- std::string pos1Array[2048];
- std::string pos2Array[2048];
- std::string posT1Array[2048];
- std::string posT2Array[2048];
- int pos = 0;
- int test = 0;
- int pos2 = 0;
- size_t found;
- // Loading all the data from the full list into the array.
- for(int i = 0; i < 2048; i++)
- {
- *wordList >> fullArray[i];
- if(wordList->eof())
- break;
- }
- // Remove lines that do not match the size of the answer
- pos = 0;
- for(int i = 0; fullArray[i] != "\0"; i++)
- {
- if(sizeEqual(fullArray[i], argv[1]))
- {
- pos1Array[pos] = fullArray[i];
- pos2Array[pos] = fullArray[i];
- pos++;
- }
- }
- std::cout << "Calculation round #1 returned " << pos << " combinations." << std::endl;
- // Remove lines that do not contain the right letters
- for(int i = 0; argv[1][i] != '\0'; i++)
- {
- pos = 0;
- for(int x = 0; pos1Array[x] != "\0"; x++)
- {
- found = pos1Array[x].find(argv[1][i]);
- if (found != std::string::npos)
- {
- pos1Array[x][(int)found] = ' ';
- posT1Array[pos] = pos1Array[x];
- posT2Array[pos] = pos2Array[x];
- pos++;
- }
- }
- pos2 = 0;
- for(int x = 0; posT1Array[x] != "\0"; x++)
- {
- pos1Array[x] = posT1Array[x];
- posT1Array[x] = "\0";
- pos2Array[x] = posT2Array[x];
- posT2Array[x] = "\0";
- pos2++;
- }
- pos1Array[pos2+1] = "\0";
- test++;
- }
- std::cout << "Calculation round #2 returned " << pos << " combinations." << std::endl;
- std::cout << test << " calculation rounds where executed." << std::endl;
- *targetList << pos2Array[0];
- wordList->close();
- targetList->close();
- return 0;
- }
- =.> runme.bat <.=
- desmain scramblelist.txt wordlist.txt targetlist.txt
Add Comment
Please, Sign In to add comment