forked from F8LEFT/SoFixer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObElfReader.h
48 lines (34 loc) · 1.25 KB
/
ObElfReader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//===------------------------------------------------------------*- C++ -*-===//
//
// Created by F8LEFT on 2021/1/5.
//===----------------------------------------------------------------------===//
// ElfReader for Obfuscated so file
//===----------------------------------------------------------------------===//
#ifndef SOFIXER_OBELFREADER_H
#define SOFIXER_OBELFREADER_H
#include "ElfReader.h"
class ElfRebuilder;
class ObElfReader: public ElfReader {
public:
~ObElfReader() override;
// the phdr informaiton in dumped so may be incorrect,
// try to fix it
void FixDumpSoPhdr();
bool Load() override;
bool LoadDynamicSectionFromBaseSource();
void setDumpSoBaseAddr(Elf_Addr base) { dump_so_base_ = base; }
void setBaseSoName(const char* name) {
baseso_ = name;
}
// void GetDynamicSection(Elf_Dyn** dynamic, size_t* dynamic_count, Elf_Word* dynamic_flags) override;
bool haveDynamicSectionInLoadableSegment();
private:
void ApplyDynamicSection();
Elf_Addr dump_so_base_ = 0;
const char* baseso_ = nullptr;
void* dynamic_sections_ = nullptr;
size_t dynamic_count_ = 0;
Elf_Word dynamic_flags_ = 0;
friend class ElfRebuilder;
};
#endif //SOFIXER_OBELFREADER_H