Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

[INC/CS:GO] Memory Extended [WINAPI/Inject DLL through SourcePawn]


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
The first thing I would like to say - the philosophy of this library is that all manipulations are reproduced without creating and needing additional files on the server.

This library is under development and because of this - WINDOWS ONLY. It was posted to show the capabilities of the library, as well as possible feedback.

Special thanks to Kailo for assistance in training ASM, working with debugger/IDA

This "weapon" was created for convenient work with other .dll, because in SourcePawn functions you can work only with 3 => server/engine/matchmaking_ds
What came of this? - Let's look at its structure =>

PHP Code:

#define Pointer Address
#define nullptr Address_Null
#define PTR(%0) view_as<Pointer>(%0)

OS GetServerOS()
int HexToDec(const char[] hex)
int IsHexSymbol(int ch)

enum struct MemoryEx
{
    
Pointer pAddrBase;
    
OS os;

    
bool bSaveBytes;
    
bool bInit;

    
ModifByte lastModif;
    
ArrayList hModifList;
    
StringMap hModules;

// --------------functions--------------
    
bool Init();

    
OS GetOS();
    
void GetWindowsVersion(intiMajorVerintiMinorVer);

    
void SetAddr(any address);
    
Pointer GetAddr();
    
void Add(any iOffset);

    
void SaveBytes(bool save);
    
bool NeedSave();
    
void RestoreBytes();
    
void ChangeSettings(bool bSave true);

    
Pointer InitModule(const char[] sName);
    
Pointer GetBaseAddress(const char[] sName);
    
int GetModuleSize(const char[] sName);
    
Pointer GetEndModule(const char[] sName);

    
Pointer GetModuleHandle(const char[] name);
    
Pointer GetProcAddress(const char[] sLibrary, const char[] sName);

    
Pointer FindPattern(Pointer baseany size, const int[] patternint iLengthint iOffset 0);

    
int ReadByte(int iOffset 0);
    
void WriteByte(any iByteint iOffset 0,  int flags MemoryEx_NoNeedAdd);

    
int ReadWord(int iOffset 0);
    
void WriteWord(any iWordint iOffset 0,  int flags MemoryEx_NoNeedAdd);

    
int ReadInt (int iOffset 0);
    
void WriteInt(any iNumberint iOffset 0int flags MemoryEx_NoNeedAdd);

    
void WriteData(const int[] dataint iSizeint flags MemoryEx_NoNeedAdd);

    
int ReadString(char[] sStringint iMaxLength);
    
void WriteString(const char[] sStringbool bNull trueint flags MemoryEx_NoNeedAdd);
    
void WriteUnicodeString(const char[] sStringbool bNull trueint flags MemoryEx_NoNeedAdd);

    
Pointer FindString(const char[] sModule, const char[] sString);
    
Pointer FindUnicodeString(const char[] sModule, const char[] sString);
    
Pointer FindValue(const char[] sModuleany iValueint iNextByte 0x2A );




The most interesting feature as for me -> Pointer GetModuleHandle(const char[] name) which calls and returns the result of WINAPI GetModuleHandleW through SourcePawn :)

What an interesting feature GetModuleHandle?


Descriptions of some functions:

MemoryEx::Init

MemoryEx::SaveBytes/MemoryEx::NeedSave/MemoryEx::RestoreBytes



GetModuleHandle/InitModule/GetBaseAddress/GetModuleSize/GetEndModule


Examples of using

1) Inject .dll through SourcePawn [GetProcAddress + call WINAPI LoadLibraryA]

PHP Code:

#include <MemoryEx>
public void OnPluginStart()
{
    
MemoryEx mem;

    if(!
mem.Init()) return;

    
mem.InitModule("kernel32.dll");    
    
Pointer libAddr mem.GetProcAddress("kernel32.dll""LoadLibraryA");

    
StartPrepSDKCall(SDKCall_Static);
    
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Pointer);
    
PrepSDKCall_SetAddress(libAddr);
    
PrepSDKCall_SetReturnInfo(SDKType_PlainOldDataSDKPass_Plain);

    
Handle h EndPrepSDKCall();
    
int baseDLL SDKCall(h"D:/CSS_HOOK.dll");

    
delete h;
    
PrintToServer("libaddr = 0x%X Base Address DLL = 0x%X ",libAddrbaseDLL);


Result


What will my plugin `bypass nobots` look like if I will code it for a given library?

Sometimes in the plugin - it is necessary to update the gamedate. Now we can just find the necessary word and "destroy it"

PHP Code:

#include <MemoryEx>
public void OnPluginStart()
{
    
MemoryEx mem;

    if(
mem.Init())
    {
        
Pointer pStr mem.FindString("server""-nobots");
        
        if(
pStr != nullptr)
        {
            
mem.SetAddr(pStr PTR(0x01)); // bypass `-`
            
for(int y 06y++)    mem.WriteByte(GetRandomInt(0x610x7A), y);
        }
    }


Another way is through MemoryEx::FindPattern

PHP Code:

#include <MemoryEx>

public void OnPluginStart()
{
    static 
int pattern[8] = {0x2D0x6E0x6F0x620x6F0x740x730x00}; // `-nobots`;
    
MemoryEx mem;

    if(
mem.Init())
    {
        
ModuleInfo server;

        
server.base mem.GetBaseAddress("server");
        
server.size mem.GetModuleSize("server");

        
Pointer pStr mem.FindPattern(server.baseserver.sizepatternsizeof(pattern), 0x01); // bypass `-`

        
if(pStr != nullptr)
        {
            
mem.SetAddr(pStr);
            for(
int y 06y++)    mem.WriteByte(GetRandomInt(0x610x7A), y);
        }
    }



Attached Files
File Type: inc MemoryEx.inc (19.8 KB)

Wyświetl pełny artykuł

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
 Udostępnij

×
×
  • Dodaj nową pozycję...