Skip to content

Instantly share code, notes, and snippets.

@nosoop
Last active October 24, 2020 04:35
Show Gist options
  • Save nosoop/5dedc578288619e22d57e61b7ce83c21 to your computer and use it in GitHub Desktop.
Save nosoop/5dedc578288619e22d57e61b7ce83c21 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
"""
Finds the location of the given string and patches the first character to the null terminator,
preventing the message from being displayed in the server console.
This can be executed while the server is running.
"""
import mmap
with open('steamclient.so', 'rb+') as bin:
mbin = mmap.mmap(bin.fileno(), length = 0, access = mmap.ACCESS_WRITE)
offset = mbin.find("RecordSteamInterfaceCreation (PID %d): %s / %s".encode('ascii'))
if offset == -1:
print('Failed to patch string.')
else:
mbin.seek(offset)
mbin.write_byte(0)
mbin.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment