Skip to content

Commit

Permalink
commits from nscn
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf109909 committed Nov 17, 2024
1 parent c455597 commit 8b1aa5a
Show file tree
Hide file tree
Showing 37 changed files with 5,407 additions and 1,303 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ if(NOT CMAKE_BUILD_TYPE)
)
endif()


# CJK
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
endif()
# Language specs
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 17)
Expand Down
37 changes: 34 additions & 3 deletions primedev/Northstar.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# NorthstarDLL

set(OPENSSL_USE_STATIC_LIBS TRUE)
set(ENV{OPENSSL_ROOT_DIR} "C:/Program Files/OpenSSL-Win64")
set(OPENSSL_MSVC_STATIC_RT TRUE)
find_package(minhook REQUIRED)
find_package(libcurl REQUIRED)
find_package(minizip REQUIRED)
find_package(silver-bun REQUIRED)
find_package(nlohmann-json REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(httplib COMPONENTS OpenSSL)

add_library(
NorthstarDLL SHARED
"resources.rc"
"core/anticheat.cpp"
"core/anticheat.h"

"client/audio.cpp"
"client/audio.h"
"client/chatcommand.cpp"
Expand Down Expand Up @@ -79,6 +87,7 @@ add_library(
"logging/sourceconsole.h"
"masterserver/masterserver.cpp"
"masterserver/masterserver.h"
"masterserver/cabundle.h"
"mods/autodownload/moddownloader.h"
"mods/autodownload/moddownloader.cpp"
"mods/compiled/kb_act.cpp"
Expand All @@ -99,6 +108,7 @@ add_library(
"plugins/plugins.h"
"plugins/pluginmanager.h"
"plugins/pluginmanager.cpp"
"scripts/clantag.cpp"
"scripts/client/clientchathooks.cpp"
"scripts/client/cursorposition.cpp"
"scripts/client/scriptbrowserhooks.cpp"
Expand All @@ -107,6 +117,16 @@ add_library(
"scripts/client/scriptoriginauth.cpp"
"scripts/client/scriptserverbrowser.cpp"
"scripts/client/scriptservertoclientstringcommand.cpp"
"scripts/server/scriptuserinfo.cpp"
"scripts/scriptmasterservermessages.cpp"
"scripts/scriptmasterservermessages.h"
"scripts/scriptgamestate.cpp"
"scripts/scriptsvm.cpp"

"scripts/scriptgamestate.h"
"scripts/scriptgamestate.cpp"
"scripts/scriptmatchmakingevents.h"
"scripts/scriptmatchmakingevents.cpp"
"scripts/server/miscserverfixes.cpp"
"scripts/server/miscserverscript.cpp"
"scripts/server/scriptuserinfo.cpp"
Expand All @@ -120,6 +140,8 @@ add_library(
"server/auth/bansystem.h"
"server/auth/serverauthentication.cpp"
"server/auth/serverauthentication.h"
"server/svm.cpp"
"server/svm.h"
"server/alltalk.cpp"
"server/ai_helper.cpp"
"server/ai_helper.h"
Expand All @@ -130,7 +152,7 @@ add_library(
"server/r2server.h"
"server/serverchathooks.cpp"
"server/serverchathooks.h"
"server/servernethooks.cpp"

"server/serverpresence.cpp"
"server/serverpresence.h"
"shared/exploit_fixes/exploitfixes.cpp"
Expand Down Expand Up @@ -161,6 +183,10 @@ add_library(
"util/version.h"
"util/wininfo.cpp"
"util/wininfo.h"
"util/base64.cpp"
"util/base64.h"
"util/dohworker.cpp"
"util/dohworker.h"
"vscript/languages/squirrel_re/include/squirrel.h"
"vscript/languages/squirrel_re/squirrel/sqarray.h"
"vscript/languages/squirrel_re/squirrel/sqclosure.h"
Expand All @@ -187,7 +213,11 @@ add_library(

target_link_libraries(
NorthstarDLL
PRIVATE minhook
PRIVATE nlohmann_json::nlohmann_json
OpenSSL::SSL
OpenSSL::Crypto
httplib::httplib
minhook
libcurl
minizip
silver-bun
Expand All @@ -212,6 +242,7 @@ target_compile_definitions(
PRIVATE UNICODE
_UNICODE
CURL_STATICLIB

)

set_target_properties(
Expand Down
Binary file added primedev/RCa23572
Binary file not shown.
Binary file added primedev/RCb23572
Binary file not shown.
6 changes: 6 additions & 0 deletions primedev/cmake/Findnlohmann-json.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if(NOT nlohmann-json_FOUND)
check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/nlohmann-json)

add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/nlohmann-json nlohmann-json)
set(nlohmann-json_FOUND 1)
endif()
50 changes: 50 additions & 0 deletions primedev/core/anticheat.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#include "pch.h"
#include "hooks.h"
#include <string>
#include "anticheat.h"
#include <wchar.h>
#include <iostream>
#include <vector>
#include <map>
#include <fstream>
#include <sstream>
#include <filesystem>
#include <Psapi.h>

AUTOHOOK_INIT()

TempReadWrite::TempReadWrite(void* ptr)
{
m_ptr = ptr;
MEMORY_BASIC_INFORMATION mbi;
VirtualQuery(m_ptr, &mbi, sizeof(mbi));
VirtualProtect(mbi.BaseAddress, mbi.RegionSize, PAGE_EXECUTE_READWRITE, &mbi.Protect);
m_origProtection = mbi.Protect;
}

TempReadWrite::~TempReadWrite()
{
MEMORY_BASIC_INFORMATION mbi;
VirtualQuery(m_ptr, &mbi, sizeof(mbi));
VirtualProtect(mbi.BaseAddress, mbi.RegionSize, m_origProtection, &mbi.Protect);
}

void ClientAnticheatSystem::NoFindWindowHack(uintptr_t baseAddress)
{
unsigned seed = time(0);
srand(seed);
char ObfChar[3];
int ObfuscateNum = 100 + rand() % 899;
sprintf(ObfChar, "%d", ObfuscateNum);
std::cout << ObfuscateNum << std::endl;
char* ptr = ((char*)baseAddress + 0x607BD0);
TempReadWrite rw(ptr);
*(ptr + 14) = (char)ObfChar[0];
*(ptr + 16) = (char)ObfChar[1];
*(ptr + 18) = (char)ObfChar[2];
}

ON_DLL_LOAD("engine.dll", ACinit, (CModule module))
{
g_ClientAnticheatSystem.NoFindWindowHack(module.GetModuleBase());
}
23 changes: 23 additions & 0 deletions primedev/core/anticheat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once
#include <fstream>
#include <string>

typedef unsigned long DWORD;

class TempReadWrite
{
private:
DWORD m_origProtection;
void* m_ptr;

public:
TempReadWrite(void* ptr);
~TempReadWrite();
};
class ClientAnticheatSystem
{
public:
void NoFindWindowHack(uintptr_t baseAddress);
};

extern ClientAnticheatSystem g_ClientAnticheatSystem;
2 changes: 2 additions & 0 deletions primedev/engine/hoststate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ static void __fastcall h_CHostState__State_NewGame(CHostState* self)
g_pServerPresence->SetPlaylist(R2::GetCurrentPlaylistName());
g_pServerPresence->SetPort(Cvar_hostport->GetInt());

g_pServerAuthentication->StartPlayerAuthServer();

g_pServerAuthentication->m_bNeedLocalAuthForNewgame = false;
}

Expand Down
32 changes: 32 additions & 0 deletions primedev/masterserver/cabundle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once
static const char cabundle[] = "-----BEGIN CERTIFICATE-----\n"
"MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw\n"
"TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh\n"
"cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4\n"
"WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu\n"
"ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY\n"
"MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc\n"
"h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+\n"
"0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U\n"
"A5/TR5d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