[c]->[delphi] jak przepisać lub używać?

0

hmmm problem jest trudny, bo mam programik w delphi... używający pewnej biblioteki dll :/ ale jest on dla C. Program służy do odzyskiwania hasła z gry i nie wiem jak zrobić by to w delphi obrobić... Faktycznie, przepisywanie (przerabianie) to trudna sprawa.... Ale już sie motam z tym miesiąc cały - aż mi gały wyleciały - lecz wsadziłem, wszedłem tutaj no i lukam, lukam, lukam...
Ps> bardzo zależy mi na pomocy, załączam kod w C, prosiłbym o jakąs interpretacje tego w delphi by móc z nia dalej pracować...

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <sys/stat.h>
#define VER     "0.1"
#define FIND    "Phrase" "\x01\x50"

typedef int (WINAPI*_steam_dll_pwd)(u_char *phrase, int len, void *boh);
_steam_dll_pwd  steam_dll_pwd;
void std_err(void);

int main(int argc, char *argv[]) {
    FILE        *fd;
    HINSTANCE   hLib;
    struct stat xstat;
    u_int       len;
    u_short     nlen;
    u_char      *buff,
                *p,
                *limit;
    struct {
        u_int   boh1;
        u_char  *pass;
        u_int   boh2;
        u_int   boh3;
        u_int   boh4;
        u_int   passlen;
        u_int   boh5;
        u_int   boh6;
    } steam_pwd;

    setbuf(stdout, NULL);

    fputs("\n"
        "Steam password decoder "VER"\n"
        "\n", stdout);

    if(argc < 2) {
        printf("\n"
            "Usage: %s <ClientRegistry.blob>\n"
            "\n", argv[0]);
        fputs("\n    Press RETURN to exit\n", stdout);
        fgetc(stdin);
        exit(1);
    }

    printf("- load %s in memory\n", argv[1]);
    fd = fopen(argv[1], "rb");
    if(!fd) std_err();

    fstat(fileno(fd), &xstat);
    buff = malloc(xstat.st_size);
    if(!buff) std_err();
    fread(buff, xstat.st_size, 1, fd);
    fclose(fd);

    limit = buff + xstat.st_size - sizeof(FIND);
    for(p = buff; p < limit; p++) {
        if(!memcmp(p, FIND, sizeof(FIND) - 1)) break;
    }

    if(p < limit) {
        p += 30;
        nlen = *(u_short *)p;
        p += 2;
        len = *(u_int *)p;
        p += 4 + nlen;

        printf("\nEncoded:  %.*s\n", len, p);

        fputs("\n- load the local STEAM.DLL file in memory\n", stdout);
        hLib = LoadLibrary("STEAM.DLL");
        if(!hLib) std_err();
        steam_dll_pwd = (_steam_dll_pwd)0x20252397;

        printf("\n"
            "NOTE: now if the tool crashes means the password cannot be recovered since the\n"
            "      ClientRegistry.blob file has not been created on this computer.\n");

        memset(&steam_pwd, 0x00, sizeof(steam_pwd));
        steam_dll_pwd(p, len, &steam_pwd);

        printf("\nPassword: %s\n", steam_pwd.pass);
        FreeLibrary(hLib);

    } else {
        printf("\n"
            "- Password not found.\n");
    }

    free(buff);
    fputs("\n    Press RETURN to exit\n", stdout);
    fgetc(stdin);
    return(0);
}



void std_err(void) {
    perror("\nError");
    fputs("\n    Press RETURN to exit\n", stdout);
    fgetc(stdin);
    exit(1);
}


/*
This is the final part of the algorithm, I'm too lazy to implement
also the creation of the hash required for the decoding

u_char *steam_pwd(u_char *phrase) {
    int     i,
            len;
    static u_char  *pwd;
    u_char  k[16],
            *p,
            al,
            bl;

    len = strlen(phrase) >> 1;
    pwd = malloc(len + sizeof(char *)); // needed for direct sscanf
    p = phrase;
    for(i = 0; i < len; i++, p += 2) sscanf(p, "%02hhX", &pwd[i]);

    memcpy(k, HASH + PRODUCTID, 16);    // NOT implemented

    for(i = 0; i < len; i++) {
        bl = pwd[i];
        al = k[i & 15];
        k[i & 15] = bl;
        pwd[i] = al ^ bl;
    }
    pwd[i] = 0;

    return(pwd + (*pwd & 15) + 3);
}
*/

z góry dziękuję wam za pomoc, pozdrawiam...

0

Hmm ciekawe. Nie wiedziałem że można wyciągnąc hasło ze steamowego bloba. Niestety nie pomoge ci z implementacją tego do delphi bo zbyt słabo znam C. Mam tylko prośbę. Masz może ten kod skompilowany do .exe? Jak tak to poprosze :>

0

widziałem juz jakiś programik do wyciagania hasła z tego pliku. Ale nie wyciagnie hasla z tego pliku wzietego z innego komputera.
na tej stronce jest to do steama
http://aluigi.altervista.org/pwdrec.htm

Steam password decoder 0.1 (steampwd)
experimental tool for decoding the password stored in the local (and ONLY the local) ClientRegistry.blob file (1.0?)

1 użytkowników online, w tym zalogowanych: 0, gości: 1