spacepaste

  1.  
  2. ## need to read from 2 separate lists simultaneously within a for loop, so that line 1 from file 1 is used with line 1 from file 2, then line 2 from file 1 is used with line 2 from file 2 etc. through the incrementation. Current code causes each line to be used several times before stepping onto the next line. The intention is to extract defined file lengths of data from specific offset locations.
  3. g = open("images\\truesignatures.log", "r") # reads header position file
  4. header_pos = g.readlines()
  5. h = open("images\\wpfilesize.log", "r") # reads in the list of file sizes for application in carve interation
  6. filesize_len = h.readlines()
  7. while header_pos:
  8. count = 0
  9. for header, carved in [(header,carved) for header in header_pos for carved in filesize_len]:
  10. f.seek(int(header))
  11. out_block = f.read(int(carved))
  12. count = count + 1
  13. outfile = open('wpdocs\\file' + str(count) + '.wp', 'wb')
  14. outfile.write("%s" % (out_block))
  15.