Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Turkeii committed Aug 19, 2021
0 parents commit 361c992
Show file tree
Hide file tree
Showing 646 changed files with 130,945 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
100 changes: 100 additions & 0 deletions Da Drip Source 1.16.201/DaDrip/Command/CommandMgr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#include "CommandMgr.h"

CommandMgr::CommandMgr(GameData* gm) {
this->gameData = gm;
}

CommandMgr::~CommandMgr() {
for (int i = 0; i < commandList.size(); i++) {
delete commandList[i];
commandList[i] = nullptr;
}
}

void CommandMgr::initCommands() {
logF("Initializing commands");

commandList.push_back(new EjectCommand());
commandList.push_back(new TeleportCommand());
commandList.push_back(new BindCommand());
commandList.push_back(new RelativeTeleportCommand());
commandList.push_back(new ToggleCommand());
commandList.push_back(new PlayerTeleportCommand());
commandList.push_back(new GameModeCommand());
commandList.push_back(new FriendListCommand());
commandList.push_back(new UnbindCommand());
commandList.push_back(new EnchantCommand());
commandList.push_back(new HelpCommand());
commandList.push_back(new ModulesCommand());
commandList.push_back(new PanicCommand());
commandList.push_back(new HideCommand());
commandList.push_back(new GiveCommand());
commandList.push_back(new BruhCommand());
commandList.push_back(new ServerCommand());
commandList.push_back(new setoffhandCommand());
commandList.push_back(new CoordsCommand());
commandList.push_back(new SayCommand());
commandList.push_back(new SpammerCommand());
commandList.push_back(new DupeCommand());
commandList.push_back(new DamageCommand());
commandList.push_back(new ConfigCommand());
commandList.push_back(new SetprefixCommand());
commandList.push_back(new NbtCommand());
commandList.push_back(new WaypointCommand());
commandList.push_back(new TopCommand());

commandList.push_back(new CommandBlockExploitCommand());
commandList.push_back(new NameSpoofCommand());
commandList.push_back(new ExecuteCommand());
commandList.push_back(new ScriptCommand());
commandList.push_back(new PathCommand());

#ifdef _DEBUG
commandList.push_back(new TestCommand());
#endif
}

void CommandMgr::disable() {
}

std::vector<IMCCommand*>* CommandMgr::getCommandList() {
return &commandList;
}

void CommandMgr::execute(char* message) {
if (message != nullptr) {
std::vector<std::string> args;
std::string msgStr = message + 1;
size_t pos = msgStr.find(" "), initialPos = 0;
while (pos != std::string::npos) {
args.push_back(msgStr.substr(initialPos, pos - initialPos));
initialPos = pos + 1;

pos = msgStr.find(" ", initialPos);
}
args.push_back(msgStr.substr(initialPos, std::min(pos, msgStr.size()) - initialPos + 1));

std::string cmd = args[0];
std::transform(cmd.begin(), cmd.end(), cmd.begin(), ::tolower);

for (auto it = this->commandList.begin(); it != this->commandList.end(); ++it) {
IMCCommand* c = *it;
auto* aliases = c->getAliasList();
for (auto it = aliases->begin(); it != aliases->end(); ++it) {
if (*it == cmd) {
try {
if (!c->execute(&args))
g_Data.getClientInstance()->getGuiData()->displayClientMessageF("%s%sUsage: %s%c%s %s", RED, BOLD, RESET, cmdMgr->prefix, c->getCommand(), c->getUsage(cmd.c_str()));
} catch (...) {
g_Data.getClientInstance()->getGuiData()->displayClientMessageF("%s%sUsage: %s%c%s %s", RED, BOLD, RESET, cmdMgr->prefix, c->getCommand(), c->getUsage(cmd.c_str()));
}
return;
}
}
}

g_Data.getClientInstance()->getGuiData()->displayClientMessageF("[%sDa Drip%s] %sCommand '%s' could not be found!", GOLD, WHITE, RED, cmd.c_str());
}
}

CommandMgr* cmdMgr = new CommandMgr(&g_Data);
66 changes: 66 additions & 0 deletions Da Drip Source 1.16.201/DaDrip/Command/CommandMgr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#pragma once

#include "../../Memory/GameData.h"
#include "Commands/BindCommand.h"
#include "Commands/BruhCommand.h"
#include "Commands/CoordsCommand.h"
#include "Commands/DamageCommand.h"
#include "Commands/DupeCommand.h"
#include "Commands/EjectCommand.h"
#include "Commands/EnchantCommand.h"
#include "Commands/FriendListCommand.h"
#include "Commands/GameModeCommand.h"
#include "Commands/GiveCommand.h"
#include "Commands/HelpCommand.h"
#include "Commands/HideCommand.h"
#include "Commands/ICommand.h"
#include "Commands/ModulesCommand.h"
#include "Commands/PanicCommand.h"
#include "Commands/PlayerTeleportCommand.h"
#include "Commands/RelativeTeleportCommand.h"
#include "Commands/SayCommand.h"
#include "Commands/ServerCommand.h"
#include "Commands/SpammerCommand.h"
#include "Commands/TeleportCommand.h"
#include "Commands/ToggleCommand.h"
#include "Commands/TopCommand.h"
#include "Commands/UnbindCommand.h"
#include "Commands/setoffhandCommand.h"
#include "Commands/CommandBlockExploitCommand.h"
#include "Commands/ConfigCommand.h"
#include "Commands/NameSpoofCommand.h"
#include "Commands/SetprefixCommand.h"
#include "Commands/NbtCommand.h"
#include "Commands/ExecuteCommand.h"
#include "Commands/WaypointCommand.h"

#include "Commands/ScriptCommand.h"
#include "Commands/PathCommand.h"

#ifdef _DEBUG
#include "Commands/TestCommand.h"
#endif

#include <algorithm>
#include <string>
#include <vector>

class CommandMgr {
private:
GameData* gameData;
std::vector<IMCCommand*> commandList;

public:
CommandMgr(GameData* gm);
~CommandMgr();

char prefix = '.';

void initCommands();
void disable();
std::vector<IMCCommand*>* getCommandList();

void execute(char* message);
};

extern CommandMgr* cmdMgr;
71 changes: 71 additions & 0 deletions Da Drip Source 1.16.201/DaDrip/Config/AccountInformation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include "AccountInformation.h"

#include "../../Utils/Json.hpp"
#include "../../include/WinHttpClient.h"
#include "../../Memory/GameData.h"
#include "../../Utils/Logger.h"

AccountInformation::AccountInformation(std::string authTok, unsigned int serial) : isGuest(false), authToken(authTok), serialNum(serial){};
AccountInformation::AccountInformation() : isGuest(true), authToken("none"){};

bool AccountInformation::verify() {
if (isGuest)
return true;
if (authToken.size() < 10)
return false;
if (didVerify)
return isValid;
didVerify = true;

wchar_t formatString[130]; // Little hack for xor'd url
swprintf_s(formatString, 130, L"%S", XorString("http://www.DaDripbeta.club/api/beta/check?client=%S&serial=%u&edition=%S&compile=%S&stamp=%u"));

wchar_t fullUrl[250];

#ifdef _DEBUG
const char* edition = "dev";
#elif defined(_BETA)
const char* edition = "beta";
#else
const char* edition = "public";
#endif

swprintf_s(fullUrl, 250, formatString, authToken.c_str(), serialNum, edition, XorString(__TIME__), g_Data.networkedData.xorKey);
WinHttpClient client(fullUrl);
client.SetTimeouts(1500, 3000, 2000, 3000);
bool boi = client.SendHttpRequest();
if (!boi) {
logF("Account verification failed, %d", client.GetLastError());
return false;
}

// The response header.
std::wstring status = client.GetResponseStatusCode();
if (status == L"200") {
std::wstring content = client.GetResponseContent();
nlohmann::json data = nlohmann::json::parse(content);

if (data.contains("status") && data["status"].is_string() && data["status"].get<std::string>() == "success") {
logF("Account verified");

// evade and deceive
g_Data.networkedData.localPlayerOffset = data["serverTime"].get<int>();
g_Data.networkedData.dataSet = true;

isValid = true;
return true;
} else
logF("Account is a guest account");
}

return false;
};

AccountInformation AccountInformation::fromToken(std::string authToken, unsigned int serial) {
auto acc = AccountInformation(authToken, serial);
return acc;
}

AccountInformation AccountInformation::asGuest() {
return AccountInformation();
}
23 changes: 23 additions & 0 deletions Da Drip Source 1.16.201/DaDrip/Config/AccountInformation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once


#include <string>

class AccountInformation {
private:
bool isGuest;
bool didVerify = false; // Did check if its verified?
bool isValid = false; // Is it a verified account
std::string name;
std::string authToken;
unsigned int serialNum = 0;

AccountInformation(std::string, unsigned int);
AccountInformation();

public:
bool verify();

static AccountInformation fromToken(std::string authToken, unsigned int serial);
static AccountInformation asGuest();
};
119 changes: 119 additions & 0 deletions Da Drip Source 1.16.201/DaDrip/Config/ConfigManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#include "ConfigManager.h"

#include <windows.storage.h>
#include <wrl.h>

using namespace ABI::Windows::Storage;
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;

std::wstring ConfigManager::GetRoamingFolderPath() {
ComPtr<IApplicationDataStatics> appDataStatics;
auto hr = RoGetActivationFactory(HStringReference(L"Windows.Storage.ApplicationData").Get(), __uuidof(appDataStatics), &appDataStatics);
if (FAILED(hr)) throw std::runtime_error("Failed to retrieve application data statics");

ComPtr<IApplicationData> appData;
hr = appDataStatics->get_Current(&appData);
if (FAILED(hr)) throw std::runtime_error("Failed to retrieve current application data");

ComPtr<IStorageFolder> roamingFolder;
hr = appData->get_RoamingFolder(&roamingFolder);
if (FAILED(hr)) throw std::runtime_error("Failed to retrieve roaming folder");

ComPtr<IStorageItem> folderItem;
hr = roamingFolder.As(&folderItem);
if (FAILED(hr)) throw std::runtime_error("Failed to cast roaming folder to IStorageItem");

HString roamingPathHString;
hr = folderItem->get_Path(roamingPathHString.GetAddressOf());
if (FAILED(hr)) throw std::runtime_error("Failed to retrieve roaming folder path");

uint32_t pathLength;
auto roamingPathCStr = roamingPathHString.GetRawBuffer(&pathLength);
return std::wstring(roamingPathCStr, pathLength);
}

ConfigManager::ConfigManager() {
this->roamingFolder = GetRoamingFolderPath();
}

ConfigManager::~ConfigManager() {
}

void ConfigManager::loadConfig(std::string name, bool create) {

size_t allocSize = name.size() + roamingFolder.size() + 20; // std::wstring::size() can be wierd so lets make sure this actually fits
char* fullPath = new char[allocSize];
sprintf_s(fullPath, allocSize, "%S\\%s.h", roamingFolder.c_str(), name.c_str());

const bool configExists = std::filesystem::exists(fullPath);
if (configExists || create) {
if (name != currentConfig)
saveConfig(); // Save old config

currentConfig = name;
if (configExists) {
std::ifstream confFile(fullPath, std::ifstream::binary);
json conf;
try {
currentConfigObj.clear();
confFile >> currentConfigObj;
} catch (json::parse_error& e) {
logF("Config Load Exception!: %s", e.what());
}
currentConfigObj["from"] = "DaDrip";
}

if (configExists) {
moduleMgr->onLoadConfig(&currentConfigObj);
if (currentConfigObj.contains("prefix")) {
std::string prefix = currentConfigObj["prefix"];
cmdMgr->prefix = prefix.at(0);
}
}

if (create)
saveConfig();

if (g_Data.getLocalPlayer() != nullptr) {
static bool helpedUser = false;
g_Data.getGuiData()->displayClientMessageF("[%sDa Drip%s] %sSuccessfully %s config %s%s%s!", GOLD, WHITE, GREEN, !configExists ? "created" : "loaded", GRAY, name.c_str(), GREEN);
if (!helpedUser && name != "default") {
helpedUser = true;
g_Data.getGuiData()->displayClientMessageF("[%sDa Drip%s] %sEnter \"%s%cconfig load default%s\" to load your old config!", GOLD, WHITE, YELLOW, WHITE, cmdMgr->prefix, YELLOW);
}
}
} else {
if (g_Data.getLocalPlayer() != nullptr)
g_Data.getGuiData()->displayClientMessageF("[%sDa Drip%s] %sCould not load config %s%s%s!", GOLD, WHITE, RED, GRAY, name.c_str(), RED);
}

delete[] fullPath;
}

void ConfigManager::saveConfig() {
logF("Saving config %s", currentConfig.c_str());
size_t allocSize = currentConfig.size() + roamingFolder.size() + 20; // std::wstring::size() can be wierd so lets make sure this actually fits
char* fullPath = new char[allocSize];
sprintf_s(fullPath, allocSize, "%S\\%s.h", roamingFolder.c_str(), currentConfig.c_str());

moduleMgr->onSaveConfig(&currentConfigObj);

std::string prefix;
prefix.push_back(cmdMgr->prefix);
currentConfigObj["prefix"] = prefix;

std::ofstream o(fullPath, std::ifstream::binary);
o << std::setw(4) << currentConfigObj << std::endl;
o.flush();
o.close();

delete[] fullPath;
}

void ConfigManager::init() {
logF("Initializing config");
loadConfig(currentConfig, true);
}

ConfigManager* configMgr = new ConfigManager();
Loading

0 comments on commit 361c992

Please sign in to comment.