Skip to content

Commit

Permalink
Merge pull request #2 from MathematicianGoat/patch-1
Browse files Browse the repository at this point in the history
Update wh1tem0cha.py
  • Loading branch information
CYB3RMX authored Feb 22, 2024
2 parents e87d9b1 + 2c0b5b9 commit cf6b489
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/wh1tem0cha/wh1tem0cha.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,18 @@ def dump_segment(self, segment_name):
self._fhandler.seek(int(target_segment_info["offset"], 16)-0x8) # locate segment start
return self._fhandler.read(int(target_segment_info["filesize"], 16))

def dump_section(self, section_name):
"""
Description: This method is for dumping section data
Usage: wm.dump_section(section_name="__TEXT")
"""
# We need section info first
target_section_info = self.section_info(section_name=section_name)

# Seek target offset and read sizeof(section)
self._fhandler.seek(int(target_section_info["offset"], 16))
return self._fhandler.read(int(target_section_info["size"], 16))

def get_strings(self):
"""
Description: This method is for dumping string values
Expand Down Expand Up @@ -655,4 +667,4 @@ def get_binary_info(self):
self._binary_info["sha256"] = hash_val
return self._binary_info
else:
raise Exception("There is no pattern about MACH-O!!")
raise Exception("There is no pattern about MACH-O!!")

0 comments on commit cf6b489

Please sign in to comment.