68 lines
2.1 KiB
C
68 lines
2.1 KiB
C
|
|
#include <iostream>
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#include <fstream>
|
|
#include <filesystem>
|
|
|
|
namespace fs = std::filesystem;
|
|
// cd /home/cradle2careertxxyz/websites/www12/portal/dashboard/system/scripts;g++ -std=c++20 wrapper.c -o afs; chown root afs; chmod u=rwx,go=xr,+s afs
|
|
// find /opt/afsserver -type f -print0 | xargs -0 dos2unix
|
|
|
|
// g++ -std=c++20 wrapper.c -o afs; chown root afs; chmod u=rwx,go=xr,+s afs
|
|
// g++ -std=c++20 wrapper.c -o afs1; chown cradle2careertxxyz.apache afs1; chmod u=rwx,go=xr,+s afs1
|
|
int main (int argc, char *argv[])
|
|
{
|
|
|
|
// setuid(0);
|
|
// std::cout << "Current path is " << fs::current_path() << '\n'; // (1)
|
|
// fs::current_path(fs::temp_directory_path()); // (3)
|
|
// std::cout << "Current path is " << fs::current_path() << '\n';
|
|
|
|
std::string script = "./command1.sh";
|
|
|
|
for(int i=1; i < argc; i++){
|
|
//std::cout << argv[i] << std::endl;
|
|
std::string x = argv[i];
|
|
script = script + " \"" + x + "\"";
|
|
}
|
|
|
|
// chdir("/home/cradle2careertxxyz/websites/www15/portal/dashboard/system/scripts");
|
|
// chdir("/home/cradle2careertxxyz/websites/www15/portal/dashboard/services/paypal/node/advanced-intergration");
|
|
|
|
// fs::permissions("./commands.sh",
|
|
// fs::perms::owner_all | fs::perms::group_all,
|
|
// fs::perm_options::add);
|
|
|
|
setuid(1500);
|
|
std::system (script.c_str());
|
|
|
|
// /home/cradle2careertxxyz/websites/www15/portal/dashboard/services/paypal/node/advanced-integration/
|
|
std::string x2 = "pwd";
|
|
// std::string x2 = "/root/.nvm/versions/node/v18.16.0/bin/pm2 delete www15";
|
|
// std::string x2 = "touch hello_world.txt";
|
|
// setuid(0);
|
|
// std::system(x2.c_str());
|
|
|
|
|
|
// chown -R apache:apache /root/.nvm/versions/node/v18.16.0/bin/pm2
|
|
|
|
// // Create and open a text file
|
|
// std::ofstream MyFile("filename5.txt");
|
|
// // Write to the file
|
|
// MyFile << "Files can be tricky, but it is fun enough!";
|
|
// // Close the file
|
|
// MyFile.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
// /home/cradle2careertxxyz/websites/www15/portal/dashboard/system/scripts
|
|
|
|
|