srounet / Pymem

A python library for windows, providing the needed functions to start working on your own with memory editing.
MIT License
307 stars 44 forks source link

Wrong example output in documentation of the pattern API #79

Closed airvzxf closed 2 years ago

airvzxf commented 2 years ago

Describe the bug If I open the documentation on the web or using PyCharm, the example of it is strange because it converts the \x00 to null characters in the visualization.

>>> pm = pymem.Pymem("Notepad.exe")
# Here the "." means that the byte can be any byte; a "wildcard"
# also note that this pattern may be outdated
>>> character_count_pattern = b"."     ...                           b"....d"
>>> module = pymem.process.module_from_name(pm.process_handle, "Notepad.exe")
>>> character_count_address = pymem.pattern.pattern_scan_module(pm.process_handle, module, character_count_pattern)

Your Environment

  1. Python 3.10.2
  2. Windows 10 - 64 bits
  3. pymem version 1.8.5

Expected behavior Shows the example code ready for copy & paste.

>>> pm = pymem.Pymem("Notepad.exe")
# Here the "." means that the byte can be any byte; a "wildcard"
# also note that this pattern may be outdated
>>> character_count_pattern = b".\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00" \
                              b"\x00\x00\x00\x00\x00\x00..\x00\x00..\x00\x00\x64\x04"
>>> module = pymem.process.module_from_name(pm.process_handle, "Notepad.exe")
>>> character_count_address = pymem.pattern.pattern_scan_module(pm.process_handle, module, character_count_pattern)

Traceback N/A

Additional context It should be better to have an example for scan_pattern_page since it is the same behavior, but it needs more time to research the check that both are similar functions.