GetModuleBase OSX C++

Discussion in 'Source Code' started by suMan, Aug 31, 2014.

  1. suMan

    suMan Member

    Jul 23, 2013
    Likes Received:
    hey leute.
    hab dies schon auf unknownchegats gepostet,
    aber dachte mir ich share es auch hier.
    Ne easy methods um module bases zu fetchen ( OSX C++ )
    Beispiel Counter strike source:

    function exec ( auf  stack overflow  gefunden):
    string exec(char* cmd) {
        FILE* pipe = popen(cmd, "r");
        if (!pipe) return "ERROR";
        char buffer[128];
        std::string result = "";
        while(!feof(pipe)) {
            if(fgets(buffer, 128, pipe) != NULL)
                result += buffer;
        return result;
    unsigned long GetBaseAdress(string input,char* dylib){
        string data  = input.substr(input.find(dylib), input.length());
        string baseadress = data.substr(data.find_first_of("0x"),data.find_first_of(" ("));
        baseadress = baseadress.substr(0,baseadress.find_first_of(" "));
        return strtoul(baseadress.c_str(),NULL,0);
        string data = exec(" symbols hl2_osx -noSymbols -noSources -noDemangling 
        -fullSourcePath -arch i386 -w");
        this->uClientBase = GetBaseAdress(data, "/client.dylib");
        this->uEngineBase = GetBaseAdress(data, "/engine.dylib");
        printf("%-10s [0x%.8x]\n","Client.dylib", this->uClientBase);
        printf("%-10s [0x%.8x]\n","Engine.dylib", this->uEngineBase);
    ich hoffe das hilft jemanden. lg suman

    runtime screenshot:
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.