Skip to content

Commit 361c992

Browse files
committed
Initial commit
0 parents  commit 361c992

File tree

646 files changed

+130945
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

646 files changed

+130945
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#include "CommandMgr.h"
2+
3+
CommandMgr::CommandMgr(GameData* gm) {
4+
this->gameData = gm;
5+
}
6+
7+
CommandMgr::~CommandMgr() {
8+
for (int i = 0; i < commandList.size(); i++) {
9+
delete commandList[i];
10+
commandList[i] = nullptr;
11+
}
12+
}
13+
14+
void CommandMgr::initCommands() {
15+
logF("Initializing commands");
16+
17+
commandList.push_back(new EjectCommand());
18+
commandList.push_back(new TeleportCommand());
19+
commandList.push_back(new BindCommand());
20+
commandList.push_back(new RelativeTeleportCommand());
21+
commandList.push_back(new ToggleCommand());
22+
commandList.push_back(new PlayerTeleportCommand());
23+
commandList.push_back(new GameModeCommand());
24+
commandList.push_back(new FriendListCommand());
25+
commandList.push_back(new UnbindCommand());
26+
commandList.push_back(new EnchantCommand());
27+
commandList.push_back(new HelpCommand());
28+
commandList.push_back(new ModulesCommand());
29+
commandList.push_back(new PanicCommand());
30+
commandList.push_back(new HideCommand());
31+
commandList.push_back(new GiveCommand());
32+
commandList.push_back(new BruhCommand());
33+
commandList.push_back(new ServerCommand());
34+
commandList.push_back(new setoffhandCommand());
35+
commandList.push_back(new CoordsCommand());
36+
commandList.push_back(new SayCommand());
37+
commandList.push_back(new SpammerCommand());
38+
commandList.push_back(new DupeCommand());
39+
commandList.push_back(new DamageCommand());
40+
commandList.push_back(new ConfigCommand());
41+
commandList.push_back(new SetprefixCommand());
42+
commandList.push_back(new NbtCommand());
43+
commandList.push_back(new WaypointCommand());
44+
commandList.push_back(new TopCommand());
45+
46+
commandList.push_back(new CommandBlockExploitCommand());
47+
commandList.push_back(new NameSpoofCommand());
48+
commandList.push_back(new ExecuteCommand());
49+
commandList.push_back(new ScriptCommand());
50+
commandList.push_back(new PathCommand());
51+
52+
#ifdef _DEBUG
53+
commandList.push_back(new TestCommand());
54+
#endif
55+
}
56+
57+
void CommandMgr::disable() {
58+
}
59+
60+
std::vector<IMCCommand*>* CommandMgr::getCommandList() {
61+
return &commandList;
62+
}
63+
64+
void CommandMgr::execute(char* message) {
65+
if (message != nullptr) {
66+
std::vector<std::string> args;
67+
std::string msgStr = message + 1;
68+
size_t pos = msgStr.find(" "), initialPos = 0;
69+
while (pos != std::string::npos) {
70+
args.push_back(msgStr.substr(initialPos, pos - initialPos));
71+
initialPos = pos + 1;
72+
73+
pos = msgStr.find(" ", initialPos);
74+
}
75+
args.push_back(msgStr.substr(initialPos, std::min(pos, msgStr.size()) - initialPos + 1));
76+
77+
std::string cmd = args[0];
78+
std::transform(cmd.begin(), cmd.end(), cmd.begin(), ::tolower);
79+
80+
for (auto it = this->commandList.begin(); it != this->commandList.end(); ++it) {
81+
IMCCommand* c = *it;
82+
auto* aliases = c->getAliasList();
83+
for (auto it = aliases->begin(); it != aliases->end(); ++it) {
84+
if (*it == cmd) {
85+
try {
86+
if (!c->execute(&args))
87+
g_Data.getClientInstance()->getGuiData()->displayClientMessageF("%s%sUsage: %s%c%s %s", RED, BOLD, RESET, cmdMgr->prefix, c->getCommand(), c->getUsage(cmd.c_str()));
88+
} catch (...) {
89+
g_Data.getClientInstance()->getGuiData()->displayClientMessageF("%s%sUsage: %s%c%s %s", RED, BOLD, RESET, cmdMgr->prefix, c->getCommand(), c->getUsage(cmd.c_str()));
90+
}
91+
return;
92+
}
93+
}
94+
}
95+
96+
g_Data.getClientInstance()->getGuiData()->displayClientMessageF("[%sDa Drip%s] %sCommand '%s' could not be found!", GOLD, WHITE, RED, cmd.c_str());
97+
}
98+
}
99+
100+
CommandMgr* cmdMgr = new CommandMgr(&g_Data);
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#pragma once
2+
3+
#include "../../Memory/GameData.h"
4+
#include "Commands/BindCommand.h"
5+
#include "Commands/BruhCommand.h"
6+
#include "Commands/CoordsCommand.h"
7+
#include "Commands/DamageCommand.h"
8+
#include "Commands/DupeCommand.h"
9+
#include "Commands/EjectCommand.h"
10+
#include "Commands/EnchantCommand.h"
11+
#include "Commands/FriendListCommand.h"
12+
#include "Commands/GameModeCommand.h"
13+
#include "Commands/GiveCommand.h"
14+
#include "Commands/HelpCommand.h"
15+
#include "Commands/HideCommand.h"
16+
#include "Commands/ICommand.h"
17+
#include "Commands/ModulesCommand.h"
18+
#include "Commands/PanicCommand.h"
19+
#include "Commands/PlayerTeleportCommand.h"
20+
#include "Commands/RelativeTeleportCommand.h"
21+
#include "Commands/SayCommand.h"
22+
#include "Commands/ServerCommand.h"
23+
#include "Commands/SpammerCommand.h"
24+
#include "Commands/TeleportCommand.h"
25+
#include "Commands/ToggleCommand.h"
26+
#include "Commands/TopCommand.h"
27+
#include "Commands/UnbindCommand.h"
28+
#include "Commands/setoffhandCommand.h"
29+
#include "Commands/CommandBlockExploitCommand.h"
30+
#include "Commands/ConfigCommand.h"
31+
#include "Commands/NameSpoofCommand.h"
32+
#include "Commands/SetprefixCommand.h"
33+
#include "Commands/NbtCommand.h"
34+
#include "Commands/ExecuteCommand.h"
35+
#include "Commands/WaypointCommand.h"
36+
37+
#include "Commands/ScriptCommand.h"
38+
#include "Commands/PathCommand.h"
39+
40+
#ifdef _DEBUG
41+
#include "Commands/TestCommand.h"
42+
#endif
43+
44+
#include <algorithm>
45+
#include <string>
46+
#include <vector>
47+
48+
class CommandMgr {
49+
private:
50+
GameData* gameData;
51+
std::vector<IMCCommand*> commandList;
52+
53+
public:
54+
CommandMgr(GameData* gm);
55+
~CommandMgr();
56+
57+
char prefix = '.';
58+
59+
void initCommands();
60+
void disable();
61+
std::vector<IMCCommand*>* getCommandList();
62+
63+
void execute(char* message);
64+
};
65+
66+
extern CommandMgr* cmdMgr;
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#include "AccountInformation.h"
2+
3+
#include "../../Utils/Json.hpp"
4+
#include "../../include/WinHttpClient.h"
5+
#include "../../Memory/GameData.h"
6+
#include "../../Utils/Logger.h"
7+
8+
AccountInformation::AccountInformation(std::string authTok, unsigned int serial) : isGuest(false), authToken(authTok), serialNum(serial){};
9+
AccountInformation::AccountInformation() : isGuest(true), authToken("none"){};
10+
11+
bool AccountInformation::verify() {
12+
if (isGuest)
13+
return true;
14+
if (authToken.size() < 10)
15+
return false;
16+
if (didVerify)
17+
return isValid;
18+
didVerify = true;
19+
20+
wchar_t formatString[130]; // Little hack for xor'd url
21+
swprintf_s(formatString, 130, L"%S", XorString("http://www.DaDripbeta.club/api/beta/check?client=%S&serial=%u&edition=%S&compile=%S&stamp=%u"));
22+
23+
wchar_t fullUrl[250];
24+
25+
#ifdef _DEBUG
26+
const char* edition = "dev";
27+
#elif defined(_BETA)
28+
const char* edition = "beta";
29+
#else
30+
const char* edition = "public";
31+
#endif
32+
33+
swprintf_s(fullUrl, 250, formatString, authToken.c_str(), serialNum, edition, XorString(__TIME__), g_Data.networkedData.xorKey);
34+
WinHttpClient client(fullUrl);
35+
client.SetTimeouts(1500, 3000, 2000, 3000);
36+
bool boi = client.SendHttpRequest();
37+
if (!boi) {
38+
logF("Account verification failed, %d", client.GetLastError());
39+
return false;
40+
}
41+
42+
// The response header.
43+
std::wstring status = client.GetResponseStatusCode();
44+
if (status == L"200") {
45+
std::wstring content = client.GetResponseContent();
46+
nlohmann::json data = nlohmann::json::parse(content);
47+
48+
if (data.contains("status") && data["status"].is_string() && data["status"].get<std::string>() == "success") {
49+
logF("Account verified");
50+
51+
// evade and deceive
52+
g_Data.networkedData.localPlayerOffset = data["serverTime"].get<int>();
53+
g_Data.networkedData.dataSet = true;
54+
55+
isValid = true;
56+
return true;
57+
} else
58+
logF("Account is a guest account");
59+
}
60+
61+
return false;
62+
};
63+
64+
AccountInformation AccountInformation::fromToken(std::string authToken, unsigned int serial) {
65+
auto acc = AccountInformation(authToken, serial);
66+
return acc;
67+
}
68+
69+
AccountInformation AccountInformation::asGuest() {
70+
return AccountInformation();
71+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma once
2+
3+
4+
#include <string>
5+
6+
class AccountInformation {
7+
private:
8+
bool isGuest;
9+
bool didVerify = false; // Did check if its verified?
10+
bool isValid = false; // Is it a verified account
11+
std::string name;
12+
std::string authToken;
13+
unsigned int serialNum = 0;
14+
15+
AccountInformation(std::string, unsigned int);
16+
AccountInformation();
17+
18+
public:
19+
bool verify();
20+
21+
static AccountInformation fromToken(std::string authToken, unsigned int serial);
22+
static AccountInformation asGuest();
23+
};
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#include "ConfigManager.h"
2+
3+
#include <windows.storage.h>
4+
#include <wrl.h>
5+
6+
using namespace ABI::Windows::Storage;
7+
using namespace Microsoft::WRL;
8+
using namespace Microsoft::WRL::Wrappers;
9+
10+
std::wstring ConfigManager::GetRoamingFolderPath() {
11+
ComPtr<IApplicationDataStatics> appDataStatics;
12+
auto hr = RoGetActivationFactory(HStringReference(L"Windows.Storage.ApplicationData").Get(), __uuidof(appDataStatics), &appDataStatics);
13+
if (FAILED(hr)) throw std::runtime_error("Failed to retrieve application data statics");
14+
15+
ComPtr<IApplicationData> appData;
16+
hr = appDataStatics->get_Current(&appData);
17+
if (FAILED(hr)) throw std::runtime_error("Failed to retrieve current application data");
18+
19+
ComPtr<IStorageFolder> roamingFolder;
20+
hr = appData->get_RoamingFolder(&roamingFolder);
21+
if (FAILED(hr)) throw std::runtime_error("Failed to retrieve roaming folder");
22+
23+
ComPtr<IStorageItem> folderItem;
24+
hr = roamingFolder.As(&folderItem);
25+
if (FAILED(hr)) throw std::runtime_error("Failed to cast roaming folder to IStorageItem");
26+
27+
HString roamingPathHString;
28+
hr = folderItem->get_Path(roamingPathHString.GetAddressOf());
29+
if (FAILED(hr)) throw std::runtime_error("Failed to retrieve roaming folder path");
30+
31+
uint32_t pathLength;
32+
auto roamingPathCStr = roamingPathHString.GetRawBuffer(&pathLength);
33+
return std::wstring(roamingPathCStr, pathLength);
34+
}
35+
36+
ConfigManager::ConfigManager() {
37+
this->roamingFolder = GetRoamingFolderPath();
38+
}
39+
40+
ConfigManager::~ConfigManager() {
41+
}
42+
43+
void ConfigManager::loadConfig(std::string name, bool create) {
44+
45+
size_t allocSize = name.size() + roamingFolder.size() + 20; // std::wstring::size() can be wierd so lets make sure this actually fits
46+
char* fullPath = new char[allocSize];
47+
sprintf_s(fullPath, allocSize, "%S\\%s.h", roamingFolder.c_str(), name.c_str());
48+
49+
const bool configExists = std::filesystem::exists(fullPath);
50+
if (configExists || create) {
51+
if (name != currentConfig)
52+
saveConfig(); // Save old config
53+
54+
currentConfig = name;
55+
if (configExists) {
56+
std::ifstream confFile(fullPath, std::ifstream::binary);
57+
json conf;
58+
try {
59+
currentConfigObj.clear();
60+
confFile >> currentConfigObj;
61+
} catch (json::parse_error& e) {
62+
logF("Config Load Exception!: %s", e.what());
63+
}
64+
currentConfigObj["from"] = "DaDrip";
65+
}
66+
67+
if (configExists) {
68+
moduleMgr->onLoadConfig(&currentConfigObj);
69+
if (currentConfigObj.contains("prefix")) {
70+
std::string prefix = currentConfigObj["prefix"];
71+
cmdMgr->prefix = prefix.at(0);
72+
}
73+
}
74+
75+
if (create)
76+
saveConfig();
77+
78+
if (g_Data.getLocalPlayer() != nullptr) {
79+
static bool helpedUser = false;
80+
g_Data.getGuiData()->displayClientMessageF("[%sDa Drip%s] %sSuccessfully %s config %s%s%s!", GOLD, WHITE, GREEN, !configExists ? "created" : "loaded", GRAY, name.c_str(), GREEN);
81+
if (!helpedUser && name != "default") {
82+
helpedUser = true;
83+
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);
84+
}
85+
}
86+
} else {
87+
if (g_Data.getLocalPlayer() != nullptr)
88+
g_Data.getGuiData()->displayClientMessageF("[%sDa Drip%s] %sCould not load config %s%s%s!", GOLD, WHITE, RED, GRAY, name.c_str(), RED);
89+
}
90+
91+
delete[] fullPath;
92+
}
93+
94+
void ConfigManager::saveConfig() {
95+
logF("Saving config %s", currentConfig.c_str());
96+
size_t allocSize = currentConfig.size() + roamingFolder.size() + 20; // std::wstring::size() can be wierd so lets make sure this actually fits
97+
char* fullPath = new char[allocSize];
98+
sprintf_s(fullPath, allocSize, "%S\\%s.h", roamingFolder.c_str(), currentConfig.c_str());
99+
100+
moduleMgr->onSaveConfig(&currentConfigObj);
101+
102+
std::string prefix;
103+
prefix.push_back(cmdMgr->prefix);
104+
currentConfigObj["prefix"] = prefix;
105+
106+
std::ofstream o(fullPath, std::ifstream::binary);
107+
o << std::setw(4) << currentConfigObj << std::endl;
108+
o.flush();
109+
o.close();
110+
111+
delete[] fullPath;
112+
}
113+
114+
void ConfigManager::init() {
115+
logF("Initializing config");
116+
loadConfig(currentConfig, true);
117+
}
118+
119+
ConfigManager* configMgr = new ConfigManager();

0 commit comments

Comments
 (0)