PYTHON   40

vnote decode py

Guest on 24th August 2022 05:10:25 AM

  1. #!/usr/bin/python
  2.  
  3. '''
  4. crude script to decode VNOTE *.vnt files produced by Android's stock Memo app.
  5. this code is public domain.
  6. '''
  7.  
  8. import sys
  9. import re
  10.  
  11. filename = sys.argv[1]
  12. f = open(filename,"r")
  13.  
  14. note_text = ''
  15. for line in f:
  16.         blocks = line.split("=")
  17.         for block in blocks:
  18.                 if re.search('^[0-9A-F][0-9A-F]\s*$',block):
  19.                         note_text += chr(eval('0x'+block))
  20.         if re.search('^DCREATED:',line):
  21.                 date = line[9:]
  22.                 creation_date = '%s-%s-%s %s:%s' % (date[0:4],date[4:6],date[6:8],date[9:11],date[11:13])
  23.         if re.search('^LAST-MODIFIED:',line):
  24.                 date = line[14:]
  25.                 modified_date = '%s-%s-%s %s:%s' % (date[0:4],date[4:6],date[6:8],date[9:11],date[11:13])
  26.  
  27. print "\n==========================="
  28. print "Created: "+creation_date
  29. print "Modified: "+modified_date
  30. print "==========================="
  31. print note_text
  32. print "===========================\n"

Raw Paste


Login or Register to edit or fork this paste. It's free.