Skip to content

pwndbg使用步骤 #33

@lfeng14

Description

@lfeng14
#include <iostream>
#include <cstring>

class Config {
public:
    char name[16];
    Config() { std::strcpy(name, "SystemConfig"); }
};

class Secret {
public:
    int key;
    Secret() { key = 0x12345678; }
    virtual void shadow() {} // 增加虚函数,方便通过虚表识别类
};

int main() {
    Config* c = new Config();
    Secret* s = new Secret();
    
    std::cout << "Config at: " << (void*)c << std::endl;
    std::cout << "Secret at: " << (void*)s << std::endl;

    // 这里设个断点
    return 0; 
}


编译:g++ -g heap_test.cpp -o heap_test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions