Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* credits to austin for these two functions */
- int sw_ReadFile(const std::string& path, std::string& out, unsigned char binary) {
- std::ios::openmode mode = std::ios::in;
- if (binary)
- mode |= std::ios::binary;
- std::ifstream file(path, mode);
- if (file.is_open()) {
- std::stringstream buffer;
- buffer << file.rdbuf();
- out = buffer.str();
- file.close();
- return 1;
- }
- file.close();
- return 0;
- }
- void get_file(const char* dllName, const char* fileName, char* buffer, int bfSize) {
- GetModuleFileName(GetModuleHandle(dllName), buffer, bfSize);
- if (strlen(fileName) + strlen(buffer) < MAX_PATH) {
- char* pathEnd = strrchr(buffer, '\\');
- strcpy(pathEnd + 1, fileName);
- }
- else {
- *buffer = 0;
- }
- }
- void GetFilesInDirectory(std::vector<std::string>& out, const std::string& directory, unsigned char includePath) // thx stackoverflow
- {
- HANDLE dir;
- WIN32_FIND_DATA file_data;
- if ((dir = FindFirstFile((directory + "/*").c_str(), &file_data)) == INVALID_HANDLE_VALUE)
- return; /* No files found */
- do {
- const std::string file_name = file_data.cFileName;
- const std::string full_file_name = directory + "/" + file_name;
- const bool is_directory = (file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
- if (file_name[0] == '.')
- continue;
- if (is_directory)
- continue;
- out.push_back(includePath ? full_file_name : file_name);
- } while (FindNextFile(dir, &file_data));
- FindClose(dir);
- }
- void GetFile(const char* dllName, const char* fileName, char* buffer, int bfSize) {
- GetModuleFileName(GetModuleHandle(dllName), buffer, bfSize);
- if (strlen(fileName) + strlen(buffer) < MAX_PATH) {
- char* pathEnd = strrchr(buffer, '\\');
- strcpy(pathEnd + 1, fileName);
- }
- else {
- *buffer = 0;
- }
- }
- int ReadFile(const std::string& path, std::string& out, unsigned char binary) {
- std::ios::openmode mode = std::ios::in;
- if (binary)
- mode |= std::ios::binary;
- std::ifstream file(path, mode);
- if (file.is_open()) {
- std::stringstream buffer;
- buffer << file.rdbuf();
- out = buffer.str();
- file.close();
- return 1;
- }
- file.close();
- return 0;
- }
- int WriteFile(const std::string& path, std::string data, unsigned char binary) {
- std::ios::openmode mode = std::ios::out;
- if (binary)
- mode |= std::ios::binary;
- std::ofstream file(path, mode);
- if (file.is_open()) {
- file << data;
- file.close();
- return 1;
- }
- file.close();
- return 0;
- }
- int gethpath(lua_State* r_lua_State) {
- char path[MAX_PATH];
- GetFile("HaxonByteCode.dll", "", path, MAX_PATH);
- lua_pushstring(r_lua_State, path);
- return 1;
- }
- void modifyrbx()
- {
- //sloppey's findwindowa bypass
- DWORD old;
- VirtualProtect((LPVOID)& FindWindowA, 1, PAGE_EXECUTE_READWRITE, &old);
- *(char*)& FindWindowA = 0x90;
- VirtualProtect((LPVOID)& FindWindowA, 1, old, &old);
- SetWindowTextA(FindWindowA(NULL, "Roblox"), "Exploited with Haxon!");
- }
- int readfile(lua_State* L) {
- string _path = (string)lua_tostring(L, 1);
- gethpath(L);
- // TODO FIX
- string ok = (string)lua_tostring(L, -1);
- char pls1[100]; // array to hold the result.
- strcpy(pls1, ok.c_str()); // copy string one into the result.
- strcat(pls1, "workspace\\");
- char path[100]; // array to hold the result.
- strcpy(path, pls1); // copy string one into the result.
- strcat(path, _path.c_str());
- string _checkFile(path);
- string filecontents;
- if (!ReadFile(path, filecontents, 0)) {
- lua_pushnil(L);
- printf("Failed to read file. (%x\n)", filecontents);
- return 1;
- }
- lua_pushstring(L, filecontents.c_str());
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement