Recover Data from HTerm

Last week I had the task to logg XBee data with my laptop using the really great terminal program HTerm. After the crucial data arrived the program hang up and was unresponsive.

The first aid was to make a screenshot, but this recovers only the latest data but not the whole log.

Without closing the unresponsive window I opened the task manager went to applications and searched for HTerm. Then choosed the option showing the process. The next step is to „Create Dump file“ (or „Abbilddatei“).

To regain access to your data you have to search the dump file for your data. In my case I searched for GPS data lines starting with „$GPS“. So I wrote a little python script scanning all lines for this specific string and saving everything in a new log-file.

# -*- coding: utf-8 -*-
"""Recovery of data from HTerm
@author: michael russwurm
"""

from __future__ import print_function

# open dump file
log_file = open("HTerm.dmp",'rb') 
recovered_data = open("recovered_data.log",'w')
for line in log_file:
    line = line.strip()
    if ('$GPS') in line:
        recovered_data.write(line+'\n')
        print (line)
    #else: # for debugging
        #print(line)
log_file.close()
recovered_data.close()
input("Press Enter to exit.")
Advertisements