Skip to content

Instantly share code, notes, and snippets.

@therealmik
Created June 8, 2015 06:51
Show Gist options
  • Save therealmik/bfd90016b83af799828e to your computer and use it in GitHub Desktop.
Save therealmik/bfd90016b83af799828e to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import struct
import sys
import operator
dirent = struct.Struct("<II")
def getEntities(fd):
fd.seek(8)
offset, length = dirent.unpack(fd.read(8))
fd.seek(offset)
return fd.read(length)
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: {0:s} <file.bsp>".format(sys.argv[0]))
sys.exit(1)
with open(sys.argv[1], "rb") as fd:
print(str(getEntities(fd), "US-ASCII"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment