-1

I have a so. library which I know the "C" interface but I don't have access to the source code only the disassembled code which is hard to understand at least for me. I know the input parameters (including the expected ranges of the parameters) and I get the corresponding result of the formula. I wrote a small program to test every combination of the input parameters and record the results.

For example I recorded these pairs (all possible combinations are over 430.000):

param1;param2;result
26.4;63.6;50.490
32.0;107.7;48.552
70.2;65.4;21.277
79.1;71.4;14.923
18.8;48.0;55.703
65.4;19.9;24.704
58.9;85.6;29.345
48.0;50.6;37.128
17.3;19.7;56.732
72.6;40.1;19.564
59.2;42.1;29.131
43.1;33.7;40.627
47.2;52.1;37.699
33.6;55.2;47.410
31.7;49.3;48.766
22.5;19.4;53.165
33.7;66.0;47.338
49.2;82.4;36.271
31.3;91.3;49.052
42.2;43.2;41.269
65.3;92.8;24.776
13.2;24.5;59.545
13.6;57.0;59.270
59.5;48.6;28.917
61.3;27.1;27.632

I already tried to train a neural network + back propagation with k=5 sigmoid activation neuron and 1 hidden layer with a learn factor of gamma=0.1 and 10000 steps but I get only poor results. It is possible to train a neural network to generate nearly the same results (for example with an error of ~0.001) as the so. library function? Is my neural network wrong? Is there a better method?

Any idea or help is welcome!

edit:

thanks @Rok Tavčar I added an image of the data points as a 3d plot. enter image description here It looks like two linear 2d surfaces but at some point it jumps a bit. I guess I can divide it as two linear functions. Now, I need to figure out how I do a 2d linear regression. If somebody could give me hint that would be grateful.

Nevertheless, the .so library has more complex functions, which dimensional is higher (up to 6). So I can't plot it anymore. I need a more general approach but I will also give it a try to understand the disassembled arm code as @0xC0000022L suggested.

  • 1
    Hi and welcome to RE.SE. The questions you ask are off-topic and what you don't ask is up to anyone's guess. What's wrong with trying to learn to understand the disassembly? Any specific questions regarding that would be perfectly on-topic here. – 0xC0000022L Aug 20 '18 at 20:34
2

No, you cannot use neural network (NN) to solve problems like this (you probably could, but it would be way to complex). If you already used NN you know that they can get output only if they see it in training set. For example in this case you would need to train NN on all possible outcomes. Another problem or how NN works is that they to set linear borders in each dimension of input data and try to find best match on which side of border is correct result. This is mostly usefull when output is discrete not continous.

What you could do beside disassembly is use SMT solver, but you will still need to know something about function you are trying to reverse.

Another out a box idea is that with so low possible combinations you can easily (Unless your function is slow) draw graph of (almost) all combinations and try to guess function.

1

thanks @all Finally, I was able to understand the disassembled code.

The function is as follow (I used IDA free for that):

static double test_function(double xmm0) {
    double xmm1 = 100.0;
    xmm1 = xmm1 - xmm0;
    xmm1 = xmm1 * 0.7;

    if (xmm1 < 50) {
        xmm1 = xmm1 * 1.02;
    } else {
        xmm1 = xmm1 * 0.98;
    }

   return xmm1;
}

My first reverse engineered snippet from a disassembled code. Yay! :)

I will try to reverse engineer a more complex function. Maybe I need your help again.

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.