Advertisement
OriHackingTutorials

openURL

Dec 8th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.02 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <Windows.h>
  5. void getPstools();
  6. void CheckForTool();
  7.  
  8. using namespace std;
  9. BOOL IsCurrentUserLocalAdministrator(){}
  10. int main(int argc, char *argv[])
  11. {
  12.     if (!IsCurrentUserLocalAdministrator()) {
  13.         cout << "You MUST run this program as administrator in order for it to work.\n";
  14.         exit(0);
  15.     }
  16.     if (argc < 2) {
  17.         cout << "\nUsage: openurl [IP] [username] [password] [URL] [number Of Tabs] <additional options>\n";
  18.         cout << "additional options: \n";
  19.         cout << " -i        ..... open in incogniton\n";
  20.         cout << " -d <time> ..... set the delay time before opening the url (in milliseconds)\n";
  21.         cout << " Run this program with the argument -install to install the required tools.\n";
  22.         exit(0);
  23.     }
  24.  
  25.     if (string(argv[1]) == "install" || string(argv[1]) == "-i" || string(argv[1]) == "-I" || string(argv[1]) == "-install") {
  26.         CheckForTool();
  27.     }
  28.     if (string(argv[1]) == "/?" || string(argv[1]) == "help" || string(argv[1]) == "?") {
  29.  
  30.         cout << "\nUsage: openurl [IP] [username] [password] [URL] [number Of Tabs] <additional options>\n";
  31.         cout << "additional options: \n";
  32.         cout << " -i ............ Open in incogniton\n";
  33.         cout << " -d <time> ..... Set the delay time before opening the url (in milliseconds)\n";
  34.         cout << " --invisible ... Make the URL invisible to the user while opened.\n\n";
  35.         cout << " Run this program with the argument -install to install the required tools.\n";
  36.         exit(0);
  37.     }
  38.     if (argc < 6) {
  39.         cout << "\nUsage: openurl [IP] [username] [password] [URL] [number Of Tabs] <additional options>\n";
  40.         cout << "additional options: \n";
  41.         cout << " -i ..... open in incogniton\n";
  42.         cout << " -d <time> ..... set the delay time before opening the url (in milliseconds)\n";
  43.         cout << " Run this program with the argument -install to install the required tools.\n";
  44.         exit(0);
  45.     }
  46.  
  47.     string IP = argv[1];
  48.     string username = argv[2];
  49.     string password = argv[3];
  50.     string URL = argv[4];
  51.    
  52.     unsigned short int iNumOfTabs = std::stoi(string(argv[5]));
  53.     if (iNumOfTabs > 3000 || iNumOfTabs == 0)
  54.         iNumOfTabs = 1;
  55.  
  56.     unsigned short int delayBefore = 1;
  57.    
  58.     string IncognitoAnswer = " ";
  59.     bool bInvisible = false;
  60.  
  61.     for (int c = 0; c < argc; c++) {
  62.         if (string(argv[c]) == "-i" || string(argv[c]) == "-I")
  63.             IncognitoAnswer = " -incognito";
  64.         if (string(argv[c]) == "-d" || string(argv[c]) == "-D")
  65.             delayBefore = std::stoi(string(argv[c + 1]));
  66.         if (string(argv[c]) == "--invisible" || string(argv[c]) == "-invisible")
  67.             bInvisible = true;
  68.     }
  69.     if (bInvisible) {
  70.         Sleep(delayBefore);
  71.         for (int c = 0; c < iNumOfTabs; c++) {
  72.             system(("psexec -s \\\\" + IP + " -u " + username + " -p " + password + " cmd.exe /c start chrome " + URL + IncognitoAnswer).c_str());
  73.         }
  74.        
  75.     }
  76.     else {
  77.         Sleep(delayBefore);
  78.         for (int c = 0; c < iNumOfTabs; c++) {
  79.             system(("psexec -i -d \\\\" + IP + " -u " + username + " -p " + password + " cmd.exe /c start chrome " + URL + IncognitoAnswer).c_str());
  80.         }
  81.     }
  82. }
  83.  
  84. void CheckForTool() {
  85.     string autoDownload;
  86.     // check if the user has psexec installed
  87.     system("start C:\\windows\\system32\\psexec");
  88.     std::cout << "\n\n\n\n";
  89.     std::cout << "          OH! did an error just accure?\n";
  90.     std::cout << "          if the screen above says something like: \n\n\n";
  91.     std::cout << "          The system cannot find the file C:\\windows\\system32\\psexec.\n\n\n";
  92.     std::cout << "          you can either download the required tools manually, or i can do it for you.\n";
  93.     std::cout << "          if you want me to auto-download it for you, type ";
  94.     std::cout << "yes and press ENTER.";
  95.     std::cout << " or type ";
  96.     std::cout << "NO and press ENTER" << std::endl;
  97.     std::cout << "          OR! if you already have PSTOOLS installed or i have already downloaded it for you, say ";
  98.     std::cout << "HaveIt\n\n\n";
  99.     std::cout << "          ";
  100.    
  101.     cin >> autoDownload;
  102.     if (autoDownload == "yes" || autoDownload == "y" || autoDownload == "YES" || autoDownload == "Y") {
  103.        
  104.         getPstools();
  105.     }
  106.     else if (autoDownload == "HaveIt" || autoDownload == "haveit" || autoDownload == "ihaveit") {
  107.         exit(0);
  108.     }
  109.     else if (autoDownload == "N" || autoDownload == "n" || autoDownload == "no" || autoDownload == "NO") {
  110.        
  111.         std::cout << "\n\n      OK. then please go to: \n";
  112.        
  113.         std::cout << "\n\n";
  114.         std::cout << "          https://docs.microsoft.com/en-us/sysinternals/downloads/pstools \n\n";
  115.        
  116.         std::cout << "          and download PsTools.\n";
  117.         std::cout << "          Then, move ALL of the files in the .ZIP folder to C:\\windows\\system32 \n";
  118.         std::cout << "          Have you done that? GREAT! now you can proceed.\n\n\n\n";
  119.         exit(0);
  120.     }
  121.     else {
  122.         exit(0);
  123.     }
  124. }
  125. void getPstools() {
  126.     system("cd C:\\windows\\system32 && curl https://download.sysinternals.com/files/PSTools.zip > pstools.zip && tar -xf pstools.zip");
  127.     std::cout << "\n\n";
  128.     std::cout << "             I am done downloading and everything. i will now redirect you.\n";
  129.     std::cout << "             And also, make SURE to type HaveIt.\n\n\n\n";
  130.     exit(0);
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement