1

I have some measured data comes from a various types of sensors. The sensors are connected to a data-logger in order to store measurement data. After measurement, the data transported and stored in a logosense data-logger.

EDIT: For reading the stored measurement data we can use "HYDRAS 3" a software developed by OTT (using RS232 serial connection and OTT hrdrosence protocol). After reading the data this read-file has been obtained. At the same time we have monitored the serial port and the communication between the data-logger and HYDRAS to obtain the following monitor-file.

My question is how can i map these two file and extract the measured data at different measurement times from the monitor-file?(or just understand the file).

It seems that my question is not a cryptography problem, I was wondering how Reverse Engineering can solve my problem. Any starting tips?

P.S. the read-file is just for level sensor and the measured data are in meters. e.g. 3.522 at time 10:00, 3.515 at time 11:00 and both are measured on 11/11/2019

Any help or guidelines will be greatly appreciated. Thank you.

  • Please share the files somewhere accessible and include, in the question, a hexdump of the beginning of the files. – Ian Cook Aug 5 at 13:57
  • @IanCook Sorry for the links. I updated them! – engineer1155 Aug 9 at 3:27
0
  1. it is surprising that HYDRAS 3 does not allow you to export data at least in csv format.

  2. monitor-file is a log file not so interesting

all data you needs are in the read-file I quickly adapted an html file, which I use to extract my data from a text file, to your read-file. It draws a curve of your data. The ERR.05 ERR.10 value are replaced by the value 0.000 If it can help you, here it is:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    
    <head>
        <META content="text/html; charset=ISO-8859-2" http-equiv="content-type">
        <script src="https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.js"></script>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.css" />
        
        <title>extract data from text file</title>
    </head>
    
    <body>
        
        <div id="wrap">
            <div id="header">
                
                <div id="main">
                    
                    <h1>extract data from text file (read-file.txt HYDRAS 3)</h1>
                    <p>Nota: <BR>
                        Adapt to your needs in the function parseFile <BR>
                        <BR>
                    </p>
                    
                    <form name="frmParse" action="">
                        <p>
                            File:
                            <input type="file" name="fileinput" onchange='openFile(event)' />
                        </p>
                        
                        <p>Output:</p>
                        <p>
                            <textarea name="ed_output" rows="10" cols="87" style="width: 700px;"></textarea>
                            <br>
                        </p>
                    </form>
                    
                </div>
                
                <div id="graphdiv2" style="width: 100%; height: 100%;">
                </div>
                
                <script type="text/javascript">
                    <!--
                    
                    document.frmParse.ed_output.value = "";
                    var mytext=[];
                    var csv_data=[];
                    var csv_firstline="time,value\n";
                    String.prototype.beginsWith = function (string) {
                        return(this.indexOf(string) === 0);
                    };
                    
                    function parseFile() {
                        document.frmParse.ed_output.value = "";
                        
                        var index = 0;
                        var newtext=csv_firstline;
                        var v1="";
                        var v2="";
                        var date="";
                        var newArray = [];
                        for (var i = 0; i < mytext.length -1 ; i++ ) {
                            if (mytext[i].includes(" Date:")){ 
                                v1=mytext[i].match(/\d\d\/\d\d\/\d\d\d\d/g);
                                date=(moveLastArrayElementToFirstIndex(v1.toString().split("/"))).join('-') ;// date mm/dd/yyyy become yyyy-mm-dd
                            }
                            if (mytext[i].includes(".")){ 
                                v2=mytext[i].match(/ (.*\..*) /g);
                                if (v2!=null){
                                    var time=mytext[i].match(/\((\d\d:\d\d:\d\d)\)/g).toString().replace(/[()]/g, '');
                                    var txt=date +"T" +time.toString() +"Z," + v2.toString().trim().replace(/(Err.\d\d)/g, '0.000');//Err. value become 0.000
                                    newtext+=txt +"\n";
                                    newArray.push(txt);
                                }
                            }
                            
                        }
                        document.frmParse.ed_output.value = newtext;
                        csv_data=newArray.join("\n");
                        processData();
                    }
                    
                    //graph csv with Dygraph
                    function processData() {
                        g2 = new Dygraph(
                        document.getElementById("graphdiv2"),
                        csv_data,
                        {
                            xlabel: " ",
                            ylabel: " ",
                            title: csv_firstline,
                            showRangeSelector: true,
                            rangeSelectorHeight: 30,
                            rangeSelectorPlotStrokeColor: 'black',
                            rangeSelectorPlotFillColor: 'grey'
                        }
                        );
                    }
                    
                    
                    //Moves last element in an array to the front
                    function moveLastArrayElementToFirstIndex(this_array) {
                        var new_array = new Array();
                        new_array[0] = this_array[this_array.length-1]; //first element is last element    
                        for(var i=1;i<this_array.length;i++) { //subsequent elements start at 1
                            new_array[i] = this_array[i-1];
                        }
                        return new_array;
                    }
                    
                    
                    function readAsText(file) {
                        var reader = new FileReader();
                        reader.onload = function() {
                            mytext = reader.result.split("\n");
                            document.frmParse.ed_output.value = "";
                            parseFile();
                        };
                        reader.readAsText(file);
                    }
                    
                    
                    var openFile = function(event) {
                        document.frmParse.ed_output.value = "";
                        var input = event.target;
                        readAsText(input.files[0]);
                    };
                    
                    function clearFileInput(){
                        document.frmParse.fileinput.value = "";
                    }
                    
                    
                </script>
                
            </body>
        </html>


    
| improve this answer | |
  • thank you for your time sir. what i am trying to accomplish here is to somewhat simulate HYDRAS, and have my own "HYDRAS", so i think i need to understand the monitor-file as my first step, but dont know how to start. any tips? – engineer1155 Aug 19 at 18:23
  • It's clearer now and more ambitious, I've done a little analysis of the monitor-file image file here: i.imgur.com/Xv9sR4P.jpg Oddly, I did not find any documentation on the commands to send type: F0000 Fxxxx of commands followed or not by a parameter Kxxxxx of the variables returned by the device K6010 contains the number of bytes of data that will follow 48 bytes = 24 words (1 by hour) can be split – Gordon Freeman Aug 20 at 15:07
  • Thank you! Thats a big help. I'll try this on other sensors and settings and hope to achieve the desired result. – engineer1155 Aug 20 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.