a guest Mar 21st, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for start_offset, len, _, buff in rtfobj.rtf_iter_objects(rtf_file_path):
  2.         temp = NamedTemporaryFile(delete=False)
  3.         temp.write(buff)
  4.         temp.flush()
  5.         f = OleFileIO(
  6.         streams = [x for x in f.listdir() if 'Package' in x or 'CONTENTS' in x]
  7.         stream_buffers = [f.openstream(stream).getvalue() for stream in streams]
  8.         for stream in stream_buffers:
  9.             with open("embedded_file", "wb") as f:
  10.                 f.write(stream)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand