Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <string>
- #include <Windows.h>
- void getPstools();
- void CheckForTool();
- using namespace std;
- BOOL IsCurrentUserLocalAdministrator(){}
- int main(int argc, char *argv[])
- {
- if (!IsCurrentUserLocalAdministrator()) {
- cout << "You MUST run this program as administrator in order for it to work.\n";
- exit(0);
- }
- if (argc < 2) {
- cout << "\nUsage: openurl [IP] [username] [password] [URL] [number Of Tabs] <additional options>\n";
- cout << "additional options: \n";
- cout << " -i ..... open in incogniton\n";
- cout << " -d <time> ..... set the delay time before opening the url (in milliseconds)\n";
- cout << " Run this program with the argument -install to install the required tools.\n";
- exit(0);
- }
- if (string(argv[1]) == "install" || string(argv[1]) == "-i" || string(argv[1]) == "-I" || string(argv[1]) == "-install") {
- CheckForTool();
- }
- if (string(argv[1]) == "/?" || string(argv[1]) == "help" || string(argv[1]) == "?") {
- cout << "\nUsage: openurl [IP] [username] [password] [URL] [number Of Tabs] <additional options>\n";
- cout << "additional options: \n";
- cout << " -i ............ Open in incogniton\n";
- cout << " -d <time> ..... Set the delay time before opening the url (in milliseconds)\n";
- cout << " --invisible ... Make the URL invisible to the user while opened.\n\n";
- cout << " Run this program with the argument -install to install the required tools.\n";
- exit(0);
- }
- if (argc < 6) {
- cout << "\nUsage: openurl [IP] [username] [password] [URL] [number Of Tabs] <additional options>\n";
- cout << "additional options: \n";
- cout << " -i ..... open in incogniton\n";
- cout << " -d <time> ..... set the delay time before opening the url (in milliseconds)\n";
- cout << " Run this program with the argument -install to install the required tools.\n";
- exit(0);
- }
- string IP = argv[1];
- string username = argv[2];
- string password = argv[3];
- string URL = argv[4];
- unsigned short int iNumOfTabs = std::stoi(string(argv[5]));
- if (iNumOfTabs > 3000 || iNumOfTabs == 0)
- iNumOfTabs = 1;
- unsigned short int delayBefore = 1;
- string IncognitoAnswer = " ";
- bool bInvisible = false;
- for (int c = 0; c < argc; c++) {
- if (string(argv[c]) == "-i" || string(argv[c]) == "-I")
- IncognitoAnswer = " -incognito";
- if (string(argv[c]) == "-d" || string(argv[c]) == "-D")
- delayBefore = std::stoi(string(argv[c + 1]));
- if (string(argv[c]) == "--invisible" || string(argv[c]) == "-invisible")
- bInvisible = true;
- }
- if (bInvisible) {
- Sleep(delayBefore);
- for (int c = 0; c < iNumOfTabs; c++) {
- system(("psexec -s \\\\" + IP + " -u " + username + " -p " + password + " cmd.exe /c start chrome " + URL + IncognitoAnswer).c_str());
- }
- }
- else {
- Sleep(delayBefore);
- for (int c = 0; c < iNumOfTabs; c++) {
- system(("psexec -i -d \\\\" + IP + " -u " + username + " -p " + password + " cmd.exe /c start chrome " + URL + IncognitoAnswer).c_str());
- }
- }
- }
- void CheckForTool() {
- string autoDownload;
- // check if the user has psexec installed
- system("start C:\\windows\\system32\\psexec");
- std::cout << "\n\n\n\n";
- std::cout << " OH! did an error just accure?\n";
- std::cout << " if the screen above says something like: \n\n\n";
- std::cout << " The system cannot find the file C:\\windows\\system32\\psexec.\n\n\n";
- std::cout << " you can either download the required tools manually, or i can do it for you.\n";
- std::cout << " if you want me to auto-download it for you, type ";
- std::cout << "yes and press ENTER.";
- std::cout << " or type ";
- std::cout << "NO and press ENTER" << std::endl;
- std::cout << " OR! if you already have PSTOOLS installed or i have already downloaded it for you, say ";
- std::cout << "HaveIt\n\n\n";
- std::cout << " ";
- cin >> autoDownload;
- if (autoDownload == "yes" || autoDownload == "y" || autoDownload == "YES" || autoDownload == "Y") {
- getPstools();
- }
- else if (autoDownload == "HaveIt" || autoDownload == "haveit" || autoDownload == "ihaveit") {
- exit(0);
- }
- else if (autoDownload == "N" || autoDownload == "n" || autoDownload == "no" || autoDownload == "NO") {
- std::cout << "\n\n OK. then please go to: \n";
- std::cout << "\n\n";
- std::cout << " https://docs.microsoft.com/en-us/sysinternals/downloads/pstools \n\n";
- std::cout << " and download PsTools.\n";
- std::cout << " Then, move ALL of the files in the .ZIP folder to C:\\windows\\system32 \n";
- std::cout << " Have you done that? GREAT! now you can proceed.\n\n\n\n";
- exit(0);
- }
- else {
- exit(0);
- }
- }
- void getPstools() {
- system("cd C:\\windows\\system32 && curl https://download.sysinternals.com/files/PSTools.zip > pstools.zip && tar -xf pstools.zip");
- std::cout << "\n\n";
- std::cout << " I am done downloading and everything. i will now redirect you.\n";
- std::cout << " And also, make SURE to type HaveIt.\n\n\n\n";
- exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement