Compare commits
11 Commits
v0.1.11
...
8830d1abdb
| Author | SHA1 | Date | |
|---|---|---|---|
| 8830d1abdb | |||
| 71fe1c6549 | |||
| e70323c86b | |||
| 9f5abefb34 | |||
| f6ac12962d | |||
| 6d176c2020 | |||
| 83c1fba265 | |||
| e46a60f95f | |||
| 6c086b5307 | |||
| 064f1701ee | |||
| df9ad4fc70 |
@@ -74,6 +74,7 @@ jobs:
|
|||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: |
|
run: |
|
||||||
cmake -B build -S . -G Ninja \
|
cmake -B build -S . -G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DCMAKE_SYSTEM_NAME=Windows \
|
-DCMAKE_SYSTEM_NAME=Windows \
|
||||||
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
|
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
|
||||||
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \
|
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \
|
||||||
|
|||||||
@@ -147,6 +147,9 @@ set_target_properties(hex-unlocked PROPERTIES OUTPUT_NAME "${RANDOM_EXE_NAME}")
|
|||||||
# compiler / IDE config
|
# compiler / IDE config
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
target_link_options(hex-unlocked PRIVATE -static -static-libgcc -static-libstdc++)
|
target_link_options(hex-unlocked PRIVATE -static -static-libgcc -static-libstdc++)
|
||||||
|
if(CMAKE_BUILD_TYPE MATCHES "Release|MinSizeRel")
|
||||||
|
target_link_options(hex-unlocked PRIVATE -s)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT hex-unlocked)
|
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT hex-unlocked)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<h1 align="center">
|
<h1 align="center">
|
||||||
|
<img src="img/favicon.ico" height="64">
|
||||||
|
<br/>
|
||||||
<b>Hex: Unlocked</b>
|
<b>Hex: Unlocked</b>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 607 KiB |
Binary file not shown.
@@ -11,6 +11,9 @@ class ConOutSink : public ILogSink
|
|||||||
public:
|
public:
|
||||||
virtual void receiveLog(LogType type, std::string_view loggerName, std::string_view msg) override
|
virtual void receiveLog(LogType type, std::string_view loggerName, std::string_view msg) override
|
||||||
{
|
{
|
||||||
|
#ifndef _DEBUG
|
||||||
|
if (type == LogType::VERBOSE) return;
|
||||||
|
#endif
|
||||||
std::cout << "[" << loggerName << "] " << seallib::getLogTypeColor(type) << "["
|
std::cout << "[" << loggerName << "] " << seallib::getLogTypeColor(type) << "["
|
||||||
<< seallib::getLogTypeName(type) << "]"
|
<< seallib::getLogTypeName(type) << "]"
|
||||||
<< "\x1b[0m " << msg << std::endl;
|
<< "\x1b[0m " << msg << std::endl;
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <seallib/log.h>
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
#include <mutex>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
using namespace seallib;
|
||||||
|
|
||||||
|
class FileSink : public ILogSink
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FileSink(const std::string& filename)
|
||||||
|
{
|
||||||
|
_file.open(utils::getExePath() + filename, std::ios::out | std::ios::app);
|
||||||
|
}
|
||||||
|
|
||||||
|
~FileSink()
|
||||||
|
{
|
||||||
|
if (_file.is_open())
|
||||||
|
_file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void receiveLog(LogType type, std::string_view loggerName, std::string_view msg) override
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(_mutex);
|
||||||
|
if (_file.is_open())
|
||||||
|
{
|
||||||
|
_file << "[" << loggerName << "] ["
|
||||||
|
<< seallib::getLogTypeName(type) << "] "
|
||||||
|
<< msg << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<FileSink> getSharedInstance()
|
||||||
|
{
|
||||||
|
static std::shared_ptr<FileSink> instance = std::make_shared<FileSink>("hex-unlocked.log");
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::ofstream _file;
|
||||||
|
std::mutex _mutex;
|
||||||
|
};
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
#include "tray-icon.h"
|
#include "tray-icon.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "spoofer.h"
|
#include "spoofer.h"
|
||||||
#include "log-sink.h"
|
#include "log-sink-cout.h"
|
||||||
|
#include "log-sink-file.h"
|
||||||
#include "proxy-configurator.h"
|
#include "proxy-configurator.h"
|
||||||
#include "cache-cleaner.h"
|
#include "cache-cleaner.h"
|
||||||
|
|
||||||
@@ -16,11 +17,6 @@
|
|||||||
#include <processthreadsapi.h>
|
#include <processthreadsapi.h>
|
||||||
#include <handleapi.h>
|
#include <handleapi.h>
|
||||||
|
|
||||||
#ifndef CREATE_NO_WINDOW
|
|
||||||
// from: WinBase.h
|
|
||||||
#define CREATE_NO_WINDOW 0x08000000
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool running = true;
|
bool running = true;
|
||||||
TinyMITMProxy* proxy = nullptr;
|
TinyMITMProxy* proxy = nullptr;
|
||||||
ProxyConfigurator* conf = nullptr;
|
ProxyConfigurator* conf = nullptr;
|
||||||
@@ -88,6 +84,7 @@ bool run()
|
|||||||
*/
|
*/
|
||||||
seallib::Logger mainLog("Main");
|
seallib::Logger mainLog("Main");
|
||||||
mainLog.addSink(std::make_shared<ConOutSink>());
|
mainLog.addSink(std::make_shared<ConOutSink>());
|
||||||
|
mainLog.addSink(FileSink::getSharedInstance());
|
||||||
|
|
||||||
mainLog.info("Init");
|
mainLog.info("Init");
|
||||||
|
|
||||||
@@ -141,6 +138,7 @@ bool run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mainLog.info("Proxy running, Ctrl+C to stop. Check system tray for options.");
|
mainLog.info("Proxy running, Ctrl+C to stop. Check system tray for options.");
|
||||||
|
mainLog.info("Go to https://dbd.neru.rip/ for settings.");
|
||||||
while (running)
|
while (running)
|
||||||
{
|
{
|
||||||
tray.processMessages();
|
tray.processMessages();
|
||||||
@@ -166,6 +164,7 @@ bool run()
|
|||||||
int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nShowCmd*/)
|
int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nShowCmd*/)
|
||||||
{
|
{
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
|
SetConsoleTitleA(utils::randomizeString(32).c_str());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ansi seequences
|
ansi seequences
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#include "proxy-configurator.h"
|
#include "proxy-configurator.h"
|
||||||
|
|
||||||
#include "win-platform.h"
|
#include "win-platform.h"
|
||||||
#include "log-sink.h"
|
#include "log-sink-cout.h"
|
||||||
|
#include "log-sink-file.h"
|
||||||
|
|
||||||
#include <minwinbase.h>
|
#include <minwinbase.h>
|
||||||
#include <wininet.h>
|
#include <wininet.h>
|
||||||
@@ -13,6 +14,7 @@ ProxyConfigurator::ProxyConfigurator()
|
|||||||
{
|
{
|
||||||
_log = new seallib::Logger("ProxyConfigurator");
|
_log = new seallib::Logger("ProxyConfigurator");
|
||||||
_log->addSink(std::make_shared<ConOutSink>());
|
_log->addSink(std::make_shared<ConOutSink>());
|
||||||
|
_log->addSink(FileSink::getSharedInstance());
|
||||||
|
|
||||||
_log->verbose("ProxyConfigurator instantiated");
|
_log->verbose("ProxyConfigurator instantiated");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "spoofer.h"
|
#include "spoofer.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "log-sink.h"
|
#include "log-sink-cout.h"
|
||||||
|
#include "log-sink-file.h"
|
||||||
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -35,18 +36,19 @@ Spoofer::Spoofer()
|
|||||||
{
|
{
|
||||||
_log = new seallib::Logger("Spoofer");
|
_log = new seallib::Logger("Spoofer");
|
||||||
_log->addSink(std::make_shared<ConOutSink>());
|
_log->addSink(std::make_shared<ConOutSink>());
|
||||||
|
_log->addSink(FileSink::getSharedInstance());
|
||||||
|
|
||||||
_log->info("Spoofer init");
|
_log->verbose("Spoofer init");
|
||||||
|
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
|
||||||
_log->info("Starting WebSocket server");
|
_log->verbose("Starting WebSocket server");
|
||||||
initServer();
|
initServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
Spoofer::~Spoofer()
|
Spoofer::~Spoofer()
|
||||||
{
|
{
|
||||||
_log->info("Stopping WebSocket server");
|
_log->verbose("Stopping WebSocket server");
|
||||||
stopServer();
|
stopServer();
|
||||||
|
|
||||||
delete _log;
|
delete _log;
|
||||||
@@ -133,6 +135,7 @@ void Spoofer::saveConfig()
|
|||||||
std::string buffer;
|
std::string buffer;
|
||||||
auto errCtx = glz::write_file_json(conf, configPath, buffer);
|
auto errCtx = glz::write_file_json(conf, configPath, buffer);
|
||||||
if (errCtx.ec != glz::error_code::none) _log->error("Failed to save config to {}", configPath);
|
if (errCtx.ec != glz::error_code::none) _log->error("Failed to save config to {}", configPath);
|
||||||
|
_log->verbose("Saved config @ config.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -175,7 +178,7 @@ void Spoofer::wsMessageCallback(std::shared_ptr<ix::ConnectionState> /*connectio
|
|||||||
{
|
{
|
||||||
case ix::WebSocketMessageType::Open:
|
case ix::WebSocketMessageType::Open:
|
||||||
{
|
{
|
||||||
_log->verbose("Websocket connection open, URI: {}", msg->openInfo.uri);
|
_log->verbose("WebSocket connection open, URI: {}", msg->openInfo.uri);
|
||||||
WSMessages::Init initMsg;
|
WSMessages::Init initMsg;
|
||||||
initMsg.profile.camperItems = _camperItems;
|
initMsg.profile.camperItems = _camperItems;
|
||||||
initMsg.profile.camperAddons = _camperAddons;
|
initMsg.profile.camperAddons = _camperAddons;
|
||||||
@@ -203,7 +206,7 @@ void Spoofer::wsMessageCallback(std::shared_ptr<ix::ConnectionState> /*connectio
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ix::WebSocketMessageType::Close:
|
case ix::WebSocketMessageType::Close:
|
||||||
_log->verbose("Websocket connection close");
|
_log->verbose("WebSocket connection close");
|
||||||
break;
|
break;
|
||||||
case ix::WebSocketMessageType::Message:
|
case ix::WebSocketMessageType::Message:
|
||||||
{
|
{
|
||||||
@@ -211,7 +214,7 @@ void Spoofer::wsMessageCallback(std::shared_ptr<ix::ConnectionState> /*connectio
|
|||||||
auto err = glz::read_json(req, msg->str);
|
auto err = glz::read_json(req, msg->str);
|
||||||
if (err.ec != glz::error_code::none)
|
if (err.ec != glz::error_code::none)
|
||||||
{
|
{
|
||||||
_log->error("Failed to parse websocket message");
|
_log->error("Failed to parse WebSocket message");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (req.action)
|
switch (req.action)
|
||||||
@@ -330,13 +333,15 @@ void Spoofer::modifyCharacterInventory(glz::generic& js)
|
|||||||
appendPerks(_slasherPerks);
|
appendPerks(_slasherPerks);
|
||||||
}
|
}
|
||||||
appendItems(_globalOfferings);
|
appendItems(_globalOfferings);
|
||||||
|
|
||||||
|
_log->verbose("Modified inventory for character {}", js["characterName"].get_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spoofer::modifyCharacterData(glz::generic& js)
|
void Spoofer::modifyCharacterData(glz::generic& js)
|
||||||
{
|
{
|
||||||
if (!js.contains("characterName") || !js["characterName"].is_string())
|
if (!js.contains("characterName") || !js["characterName"].is_string())
|
||||||
{
|
{
|
||||||
_log->verbose("attempted to modify invalid char");
|
_log->warning("Attempted to modify invalid character");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,6 +376,8 @@ void Spoofer::modifyCharacterData(glz::generic& js)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_spoofItems || _spoofPerks) modifyCharacterInventory(js);
|
if (_spoofItems || _spoofPerks) modifyCharacterInventory(js);
|
||||||
|
|
||||||
|
_log->verbose("Modified data for character {}", js["characterName"].get_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spoofer::generateBloodweb(glz::generic& js)
|
void Spoofer::generateBloodweb(glz::generic& js)
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ bool TrayIcon::init()
|
|||||||
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
||||||
nid.uCallbackMessage = WM_TRAYICON;
|
nid.uCallbackMessage = WM_TRAYICON;
|
||||||
|
|
||||||
nid.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
nid.hIcon = LoadIconA(GetModuleHandle(NULL), "IDI_ICON1");
|
||||||
strncpy_s(nid.szTip, "HexUnlocked", sizeof(nid.szTip) - 1);
|
strncpy_s(nid.szTip, "HexUnlocked", sizeof(nid.szTip) - 1);
|
||||||
nid.szTip[sizeof(nid.szTip) - 1] = '\0';
|
nid.szTip[sizeof(nid.szTip) - 1] = '\0';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user