ciscn 2020 Misc the_best_ctf_game

Start

娱乐局
Winhex打开发现flag
ciscn 2020 Misc the_best_ctf_game_第1张图片

exp.cpp:

#include 
#include 

int main() {
    LPCTSTR lpFileName = TEXT("D://flag");

    HANDLE hFile = CreateFile(lpFileName,
        FILE_GENERIC_READ,
        0,
        NULL,
        OPEN_EXISTING,
        FILE_ATTRIBUTE_NORMAL,
        NULL);

    if (INVALID_HANDLE_VALUE == hFile) {
        return GetLastError();
    }

    DWORD dwSize = GetFileSize(hFile, NULL);
    PBYTE pData = (PBYTE)LocalAlloc(LPTR, dwSize);

    if (ReadFile(hFile, pData, dwSize, &dwSize, NULL) == FALSE) {
        return GetLastError();
    }

    CloseHandle(hFile);

    DWORD startAddress = 0x3c0;
    DWORD offset = 0x28;

    printf("flag: ");

    for (int i = 0; i < 41; i++) {
        printf("%c", pData[startAddress + offset * i]);
    }
    printf("%c\n", pData[startAddress + offset * 40 + 1]);

	system("pause");
	return 0;
}

ps: 纯粹学习一下c

End

你可能感兴趣的:(CTF,国赛,Reverse)