Skip to content

Commit

Permalink
Handling Uninitialized Targets
Browse files Browse the repository at this point in the history
  • Loading branch information
pinwhell committed Apr 9, 2023
1 parent b50290b commit 8f2ece7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 64 deletions.
8 changes: 7 additions & 1 deletion OffsetHunter/DumpTargetGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@

bool DumpTargetGroup::InitAllTargets()
{
std::unordered_set<SingleDumpTarget*> toRemove;

for (auto& kv : mTargets)
{
kv.first->Init();
if (kv.first->Init() == false)
toRemove.insert(kv.first);
}

for (SingleDumpTarget* r : toRemove)
RemoveTarget(r);

return true;
}

Expand Down
6 changes: 3 additions & 3 deletions OffsetHunter/Test/DummyOffsetMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ struct OffMgr {
#if defined(ARM64)
struct BinArm64A {
uintptr_t name1 = 0x8; // Should be 0x8
uintptr_t name2 = 0x8; // Should be 0x8
uintptr_t name3 = 0x8; // Should be 0x8
uintptr_t name2 = 0x8; // Should be 0x8
} mBinArm64A;
struct BinArm64B {
uintptr_t name1 = 0x8; // Should be 0x8
Expand All @@ -49,8 +49,8 @@ struct OffMgr {
#if defined(ARM64)
struct BinArm64A {
uintptr_t name1; // Should be 0x8
uintptr_t name2; // Should be 0x8
uintptr_t name3; // Should be 0x8
uintptr_t name2; // Should be 0x8
} mBinArm64A;
struct BinArm64B {
uintptr_t name1; // Should be 0x8
Expand All @@ -71,8 +71,8 @@ struct OffMgr {

#if defined(ARM64)
mBinArm64A.name1 = obj["1353524362"].asUInt() ^ 2105391926; // Should be 0x8
mBinArm64A.name2 = obj["2417577301"].asUInt() ^ 4261248991; // Should be 0x8
mBinArm64A.name3 = obj["3612997897"].asUInt() ^ 3609688011; // Should be 0x8
mBinArm64A.name2 = obj["2417577301"].asUInt() ^ 4261248991; // Should be 0x8
mBinArm64B.name1 = obj["2913580123"].asUInt() ^ 257130281; // Should be 0x8
mBinArm64B.name2 = obj["315769873"].asUInt() ^ 4134368048; // Should be 0x8
mBinArm64B.name3 = obj["4130067440"].asUInt() ^ 4287559064; // Should be 0x8
Expand Down
1 change: 1 addition & 0 deletions OffsetHunter/Test/OffMgr_obf_book.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
58 changes: 0 additions & 58 deletions OffsetHunter/Test/OffsetMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,67 +5,9 @@

struct OffMgr {
#if defined(STATIC_OFFS)
#if defined(ARM64)
struct BinArm64A {
uintptr_t name1 = 0x0; // Should be 0x4
uintptr_t name3 = 0x4; // Should be 0x4
} mBinArm64A;
struct BinArm64B {
uintptr_t name1 = 0x0; // Should be 0x4
uintptr_t name3 = 0x4; // Should be 0x4
} mBinArm64B;
#endif

#if defined(ARM32)
struct BinArm32A {
uintptr_t name1 = 0x0; // Should be 0x4
uintptr_t name3 = 0x4; // Should be 0x4
} mBinArm32A;
struct BinArm32B {
uintptr_t name1 = 0x0; // Should be 0x4
uintptr_t name3 = 0x4; // Should be 0x4
} mBinArm32B;
#endif

#else

#if defined(ARM64)
struct BinArm64A {
uintptr_t name1; // Should be 0x4
uintptr_t name3; // Should be 0x4
} mBinArm64A;
struct BinArm64B {
uintptr_t name1; // Should be 0x4
uintptr_t name3; // Should be 0x4
} mBinArm64B;
#endif

#if defined(ARM32)
struct BinArm32A {
uintptr_t name1; // Should be 0x4
uintptr_t name3; // Should be 0x4
} mBinArm32A;
struct BinArm32B {
uintptr_t name1; // Should be 0x4
uintptr_t name3; // Should be 0x4
} mBinArm32B;
#endif

void Set(const Json::Value& obj) {
#if defined(ARM64)
mBinArm64A.name1 = obj["462494170"].asUInt(); // Should be 0x4
mBinArm64A.name3 = obj["-812899064"].asUInt(); // Should be 0x4
mBinArm64B.name1 = obj["-7551171"].asUInt(); // Should be 0x4
mBinArm64B.name3 = obj["1267842063"].asUInt(); // Should be 0x4
#endif

#if defined(ARM32)
mBinArm32A.name1 = obj["500368777"].asUInt(); // Should be 0x4
mBinArm32A.name3 = obj["1775762011"].asUInt(); // Should be 0x4
mBinArm32B.name1 = obj["538329334"].asUInt(); // Should be 0x4
mBinArm32B.name3 = obj["-737063900"].asUInt(); // Should be 0x4
#endif

}
#endif

Expand Down
2 changes: 1 addition & 1 deletion OffsetHunter/Test/offsets_ARM32.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"133037476":2608821928,"1558618447":2130704117,"1613443683":1985833986,"2135897944":1610241865,"3426461397":2142748459,"4125678665":3214868451}
null
2 changes: 1 addition & 1 deletion OffsetHunter/Test/offsets_ARM64.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"1353524362":2105391934,"2417577301":4261248983,"2913580123":257130273,"315769873":4134368056,"3612997897":3609688003,"4130067440":4287559056}
null

0 comments on commit 8f2ece7

Please sign in to comment.