Advertisement
Guest User

hxd decode text.py

a guest
May 2nd, 2019
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import os
  2.  
  3. def is_ascii(s):
  4. return all(ord(c) < 128 for c in s)
  5.  
  6. def main():
  7. #remove file if exist
  8. filename = 'mem.txt'
  9. if os.path.exists(filename):
  10. os.remove('mem.txt')
  11.  
  12. #ignore x90 and other read errors
  13. file = open('mem.dump','r',encoding='utf-8', errors='ignore' )
  14.  
  15. myLines=file.readlines()
  16. str = "".join(myLines)
  17.  
  18. with open('mem.txt','w') as f:
  19. for word in str.split("\x00\x00\x00"):
  20. if is_ascii(word) and len(word)>5:
  21. f.write(word.replace("\x00","")+"\n")
  22. file.close()
  23.  
  24. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement