Advertisement
samuelgp10

Minigame C++ security game.

Sep 25th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.27 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3.  
  4. /*
  5.        S1O Pro.
  6.        
  7.       ._____________.      ______.      .___________.
  8.       |             |     /      |      | ._______. |
  9.       |    .________|    /       |      | |       | |
  10.       |    |________.   /_ /|    |      | |       | |
  11.       |             |       |    |      | |       | |    
  12.       |________.    |       |    |      | |       | |
  13.       .________|    |       |    |      | |       | |
  14.       |             |   .___|    |___.  | |_______| |
  15.       |_____________|   |____________|  |___________|
  16.      
  17.      
  18. */
  19.  
  20. using namespace std;
  21.  
  22. float Version = 1.52;
  23. string PasswordLetters;
  24. string KeyR;
  25. string PersonName;
  26. int timesused = 0;
  27. int MCODE = 0 ;
  28.    
  29. void wait(int seconds)
  30. {
  31.     time_t start, current;
  32.  
  33.     time(&start);
  34.  
  35.     do
  36.     {
  37.         time(&current);
  38.     }
  39.     while ((current - start) < seconds);
  40. }
  41.  
  42. int SetUpSet(string pass, string k)
  43. {
  44.    
  45.     if ((pass == PasswordLetters))
  46.         {
  47.          if (k == KeyR)
  48.          {
  49.             return true;
  50.          };
  51.         }else return false;
  52.        
  53. };
  54.  
  55. int EditK(string pass, string k, string Name)
  56. {
  57.   PasswordLetters = pass;
  58.   KeyR = k;
  59.   PersonName = Name;
  60.  
  61.   cout << "\n \n Password/Key/Name have been saved." << endl;
  62.   //cout << "\n \nKey: " << Key << "\n Pass: " << PasswordLetters << endl;
  63. };
  64.  
  65. int MCconver(string mc)
  66. {
  67.   int convert = stoi(mc);
  68.   int z = 0;
  69.   if(convert%3 != 0){
  70.     z = convert%3;
  71.     if ((convert*z+z*z++*z--^7) == MCODE){
  72.       return true;
  73.     };
  74.   }else{
  75.     return false;
  76.   };
  77. };
  78.  
  79. string CreateMC(string ps2)
  80. {
  81.   /*int val1 = (rand()%10);
  82.   int val2 = (rand()%10);
  83.   int val3 = (rand()%10);
  84.   int val4 = (ps2.length());
  85.   int val5 = (rand()%2001);
  86.   int val6 = (val1^2+val2);
  87.   int val7 = (val2^2+val3);
  88.   int val8 = (rand()%10);
  89.   int krse = (rand()%30303);
  90.   string valI = to_string(val1);
  91.   string valII = to_string(val2);
  92.   string valIII = to_string(val3);
  93.   string valIV = to_string(val4);
  94.   string valV = to_string(val5);
  95.   string valVI = to_string(val6);
  96.   string valVII = to_string(val7);
  97.   string valVIII = to_string(val8);
  98.   string kles = to_string(krse);*/
  99.   bool trfs = true;
  100.   int y = 0;
  101.   int z = 0;
  102. for (int k = 0; k < 15;k++){
  103. cout << "\n[Generating MCode]\n";
  104. wait(0.5);
  105. int x = rand()%100;
  106. int r = rand()%50;
  107. int g = rand()%999;
  108. string vx = to_string(x);
  109. string vr = to_string(r);
  110. string vg = to_string(g);
  111. string vs = vx+vr+vg;
  112. int rt = stoi(vs);
  113.     int i = rt;
  114.     if (i%2 == 0){
  115.       rt = i++;
  116.       trfs = false;
  117.     }else{
  118.       if(1%3 == 0){
  119.       trfs = false;
  120.       }else{
  121.         z = (i%3);
  122.         y = rt;
  123.         break;
  124.       };
  125.     };
  126. };
  127. if (trfs == false){
  128.   cout << "\n [Error]: Please try again.\n";
  129.   trfs = true;
  130. };
  131.   string valI = to_string(y);
  132.   string crs = valI;//+valII+valIII+valIV+valV+valVI+valVII+valVIII+kles;
  133.   //int vals = stoi(crs);
  134.   //cout <<"\n MC: " << y << "*" << z << "+" << z << "*" << z++;
  135.   MCODE = (y*z+z*z++*z--^7);
  136.   return crs;
  137. }
  138.  
  139. string CreateKY(string ps2)
  140. {
  141.   //KEYCREATER
  142.  
  143.   int val1 = (rand()%10);
  144.   int val2 = (rand()%10);
  145.   int val3 = (rand()%10);
  146.   int val4 = (ps2.length());
  147.   int val5 = (rand()%200);
  148.   int val6 = (val1^2+val2);
  149.   int val7 = (val2^2+val3);
  150.   int val8 = (val3^2+val4);
  151.   string valI = to_string(val1);
  152.   string valII = to_string(val2);
  153.   string valIII = to_string(val3);
  154.   string valIV = to_string(val4);
  155.   string valV = to_string(val5);
  156.   string valVI = to_string(val6);
  157.   string valVII = to_string(val7);
  158.   string valVIII = to_string(val8);
  159.   string crs = valI+valII+valIII+valIV+valV+valVI+valVII+valVIII+"0x-"+ps2;
  160.   return crs;
  161. };
  162. int kmpcheck(string check)
  163. {
  164.   if(check == PasswordLetters){
  165.     return true;
  166.   }else if(check == KeyR){
  167.     return true;
  168.   }else if(MCconver(check) == true){
  169.     return true;
  170.   }else return false;;
  171. };
  172. //------------------------------------------------------------------------------
  173. string cmd = "[!gcmd]: Commands\n[!ghelp]: Use if hacked\n[!gname]: New Name\n[!gpass]: New Password(MustProvide SCode/MCode)\n[!gkey]: New Key\n[!ginfo]: Information\n[!menu]: Everything else\n";
  174.  
  175. int mainmenu(string pw, string key, string name)
  176. {
  177.   string userimpute;
  178.   bool MCodeEnabled = false;
  179.   cout << "\n \n Menu: \n";
  180.   cout << "\n [Type in '!gcmd' for commands]\n";;
  181.   cout << "\n [Type in '!gname' for a new name]\n";
  182.   cout << "\n [Type in '!gpass' for a new password(Must provide Pass or SCode(Key)+MCode)]\n";
  183.   cout << "\n [Type in '!gkey' for a new key(Must provide password)]\n";
  184.   cout << "\n [Type in '!gmc' for a MCode]\n";
  185.   cout << "\n [Type in '!ginfo' for information]\n";
  186.   cout << "\n [Type in '!menu' for menu]\n";
  187.   cout << "\n [Type in '!lhax' for hacker list]\n";
  188.   cout << "\n [Type in '!haxg' for minigame]\n";
  189.   cout << "\n [Type in '!term' for terminating your accout]\n";
  190.   cout << "\n [Type in '!ghelp' if hacked]\n";
  191.   cout << "\n [Type in '!add' for menu for adding iteams]\n";
  192.   cout << "\n [We do not store the MCode's so it's recommended to keep it in a safe place]\n";
  193.   while(true){
  194.     cin >> userimpute;
  195.     if(userimpute == "!gcmd"){
  196.       cout << "\n \nCMDs:\n "+cmd;
  197.     }else if(userimpute == "!gname"){
  198.      
  199.       cout << "Enter a new name: ";
  200.       cin >> userimpute;
  201.       name = userimpute;
  202.       EditK(pw,key,name);
  203.       cout << "\n You new name is now: "+userimpute+" [Changed]" << endl;
  204.     }else if(userimpute == "!gpass"){
  205.       cout << "\nEnter your current password/Key/MCode: ";
  206.       cin >> userimpute;
  207.         if (kmpcheck(userimpute) == true){
  208.           cout << "\nEnter a new password: ";
  209.           cin >> userimpute;
  210.           string pw2 = userimpute;
  211.           cout << "\nRe-enter your new password: ";
  212.           cin >> userimpute;
  213.           if (userimpute == pw2){
  214.           pw = userimpute;
  215.           EditK(pw,key,name);
  216.           cout << "[Changed]";
  217.           }else cout << "Wrong password!";;
  218.          
  219.         };
  220.    
  221.     }else if(userimpute == "!gkey"){
  222.       cout << "\nEnter Password/Key/MCode: ";
  223.       cin >> userimpute;
  224.         if(kmpcheck(userimpute) == true){
  225.         string kr3 = CreateKY(name);
  226.         string oldkey = key;
  227.         key = kr3;
  228.         cout << "\nYour new key is: " << kr3;
  229.         cout << "\n Enter Key: ";
  230.         cin >> userimpute;
  231.           if(userimpute == key){
  232.             cout << "\n[Approved]\n[Changed]";
  233.             EditK(pw,key,name);
  234.           }else {key = oldkey; cout << "\n[Error]";EditK(pw,key,name);};
  235.         }else cout << "\n[Inncorrect] Password/Key/MCode";;
  236.     }else if(userimpute == "!ginfo")
  237.     {
  238.       cout << "\nPlease enter: (Name(first))+Password/Key/MCode\n";
  239.       cin >> userimpute;
  240.         if(userimpute == name){
  241.           cout << "\n Please enter: Name+(Password/Key/MCode)\n";
  242.           cin >> userimpute;
  243.       if(kmpcheck(userimpute) == true){
  244.       cout << "\nSystem Version:[" << Version << "]";
  245.       cout << "\n Name: " <<name;
  246.       cout << "\n Password: " << pw;
  247.       cout << "\n Key: " << key;
  248.       cout << "\n MC Value: " << MCODE;
  249.       cout << "\n [SYSTEM]";
  250.       cout << "\n [Creator]: Samuel M.G.P(S1O Pro)";
  251.       cout << "\n [Exit] = 0\n";
  252.       };
  253.         };
  254.     }else if(userimpute == "!gmc"){
  255.       cout << "\nEnter Password/Key/MCode: ";
  256.       cin >> userimpute;
  257.       if(kmpcheck(userimpute) == true)
  258.         if(timesused < 1){
  259.          
  260.       cout << "\nGenerating code...\n";
  261.       string code = CreateMC(pw);
  262.       cout << "\n Your MCode is: "+code;
  263.       cout << "\n Enter your MCode: \n";
  264.       cin >> userimpute;
  265.         if(MCconver(userimpute) == true){
  266.           cout << "\n[Set]\n";
  267.         }else {
  268.           cout << "[Error]";
  269.           MCODE = 0;
  270.         };
  271.        
  272.       };
  273.      
  274.     };
  275.    
  276.   };
  277.  
  278. };
  279. //------------------------------------------------------------------------------
  280. int main()
  281. {
  282.     /*string myUser;
  283.     string myPass;*/
  284.     string MyName;
  285.     string MyPass;
  286.     string MyPass2;
  287.     string YN;
  288.     string Text;
  289.     string Key;
  290.     string EnterCode;
  291.     int PasswordCODE;
  292.  
  293.     cout << "This is a password simulator.\n";
  294.    
  295.     cout << "Enter a username:\n";
  296.    
  297.     cin >> MyName;
  298.    
  299.     cout << "Are you sure you want your username to be: " << MyName << " (y/n) " << endl;
  300.    
  301.     cin >> YN;
  302.     while(YN != "y")
  303.     {
  304.       cout << "Enter a username:\n";
  305.    
  306.       cin >> MyName;
  307.      
  308.       cout << "\n Are you sure you want your username to be: " << MyName << " (y/n) " << endl;
  309.    
  310.       cin >> YN;
  311.     };
  312.     YN = "";
  313.    
  314.     cout << "Now enter a password:\n";
  315.    
  316.     cin >> MyPass;
  317.    
  318.     cout << "Enter it once more:\n";
  319.    
  320.     cin >> MyPass2;
  321.     while(MyPass2 != MyPass)
  322.     {
  323.     cout << "Now enter a password:\n";
  324.    
  325.     cin >> MyPass;
  326.    
  327.     cout << "Enter it once more:\n";
  328.    
  329.     cin >> MyPass2;  
  330.     }
  331.     string Hold;
  332.     string * PT;
  333.     PT = &MyPass;
  334.     Hold = *PT;
  335.     PT = &Hold;
  336.    
  337.     cout << "\nPT: " << *PT << endl;
  338.    
  339.     cout << "\n PS: " << MyPass << " /Len: " << MyPass.length() << endl;
  340.    
  341.     int set3;
  342.     //cout << set3 << endl;
  343.     for (int i = 1; i < 5; i++){
  344.     int set = (rand()%(MyPass.length()));
  345.     int set2 = ((set+rand()%23)*(set+rand()%10)*(MyPass.length()));
  346.     cout << "set \n" << set <<"\n set2\n" << set2 << endl;
  347.     int set4 = ((set2*5+6*10+20+40*rand()%11^2/rand()%9*2*rand()%11+rand()%40023*rand()%11*rand())*rand()^rand()%4);
  348.     cout << "\nS4\n" << set4 << endl;
  349.     //set3 = 0;
  350.     set3 = (-1)*(set4*(MyPass.length())^2*rand()+2^9*rand()%2/(set+1));
  351.     };
  352.    
  353.     cout << "\nS3: " << set3 << endl;
  354.    
  355.     int * Pointer;
  356.     Pointer = &set3;
  357.    
  358.     PasswordCODE = set3;
  359.    
  360.     cout << "\nPSC: " << PasswordCODE << endl;
  361.     string Code = to_string (PasswordCODE);
  362.    
  363.     Code = Code+"0x-"+MyPass;
  364.     cout << "Based on your password this is the sec code we will make you use: "+Code;
  365.    
  366.     cout << "\n Enter your SECcode: ";
  367.    
  368.     cin >> EnterCode;
  369.     while(EnterCode != Code)
  370.     {
  371.       cout << "\n Enter your SECcode: ";  
  372.       cin >> EnterCode;
  373.     };
  374.    
  375.     EditK(MyPass, Code, MyName);
  376.     MyPass = "";
  377.     MyPass2 = "";
  378.     Code = "";
  379.    
  380.     cout << "\n Do you wish to enter MX? ( y/n )";
  381.    
  382.     cin >> YN;
  383.     while(YN != "y")
  384.     {
  385.       cout << "( y/n ) \n";
  386.    
  387.       cin >> YN;  
  388.     };
  389.     YN = "";
  390.    
  391.     cout << "\n Login to enter: \n";
  392.     cout << "Username: ";
  393.     cin >> Text;
  394.     while(Text != MyName)
  395.     {
  396.       cout << "Inncorrect username! \n";
  397.       cout << "Username: ";
  398.       cin >> Text;
  399.     };
  400.     Text = "";
  401.    
  402.     cout << "\n Enter your Password: ";
  403.     cin >> MyPass;
  404.     cout << "\n Enter Key: ";
  405.     cin >> Key;
  406.     while(SetUpSet(MyPass, Key) != true)
  407.     {
  408.       cout << "\n Inncorrect password/key! \n";
  409.       cout << "Password: ";
  410.       cin >> MyPass;
  411.       cout << "\n Enter Key: ";
  412.       cin >> Key;
  413.     };
  414.    
  415.     cout << "\nWillFINDKEYS";
  416.     Key = "";
  417.     MyPass = "";
  418.     string Key2 = "0";
  419.    
  420.     cout << "\nFound KEY!\n";
  421.     cout << "Finding Pass\n";
  422.    
  423.     string * p;
  424.     p = &Hold;
  425.     string FoundKy;
  426.     FoundKy = to_string(*Pointer);
  427.     string ky = FoundKy+"0x-"+*p;
  428.     cout << "Key: " << ky;
  429.     cout << "\nPass: " << *p << " / " << Hold << " :PT: " << *PT;
  430.    
  431.     cout << "\nChanging KEY/Password" << endl;
  432.  
  433.     while(SetUpSet(MyPass, Key) != true)
  434.     {
  435.       cout << "\n Inncorrect password/key! \n";
  436.       cout << "Password: ";
  437.       MyPass = *p;
  438.       cout << "***********/" << *p;
  439.       cout << "\n Enter Key: ";
  440.       Key = ky;
  441.       cout << "000000000000*XRESE/" << ky;
  442.     };
  443.  
  444.        EditK(*p+"rX3", ky+"03hx012", MyName);
  445.        
  446.     string newp = *p+"rX3";
  447.     string newky = ky+"03hx012";  
  448.    
  449.     for(int i = 0;SetUpSet(MyPass, Key)!= true; i++)
  450.     {
  451.       if(i > 4) {cout << "\n You entered the incorrect password/key too many times.\n";break;};
  452.       cout << "\n Inncorrect password/key! ATTEMPTS:[ " << i << " ]\n";
  453.       cout << "Password: ";
  454.       cin >> MyPass;
  455.       cout << "\n Enter Key: ";
  456.       cin >> Key;
  457.       if(Key == "!ghelp")
  458.       {
  459.         //Bypass SetCode
  460.         printf("Exploit Bypass System Active");
  461.         cout << "\nSet a new password: ";
  462.         cin >> MyPass;
  463.         cout << "\nSetting a new key....";
  464.         for (int f = 1; f < 5; f++){
  465.           int set = (rand()%(MyPass.length()));
  466.           int set2 = ((set+rand()%23)*(set+rand()%10)*(MyPass.length()));
  467.           cout << "set \n" << set <<"\n set2\n" << set2 << endl;
  468.           int set4 = ((set2*5+6*10+20+40*rand()%11^2/rand()%9*2*rand()%11+rand()%40023*rand()%11*rand())*rand()^rand()%4);
  469.           cout << "\nS4\n" << set4 << endl;
  470.           set3 = (-1)*(set4*(MyPass.length())^2*rand()+2^9*rand()%2/(set+1))*f;
  471.           };
  472.           PasswordCODE = set3;
  473.           Code = to_string(PasswordCODE)+"0x-"+MyPass;
  474.         cout<< "\n New Key: " << Code << endl;
  475.         EditK(MyPass, Code, MyName);
  476.         //Code = "";
  477.         //MyPass = "";
  478.       };
  479.       if(SetUpSet(MyPass, Key) == true){
  480.         mainmenu(MyPass, Code, MyName);
  481.         Code = "";
  482.         MyPass = "";
  483.       };  
  484.     };
  485.    
  486.    
  487.     return 0;
  488.    
  489.  
  490.    
  491.  
  492. }
  493. //--------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement