Might come back.
In the last video we have suddenly reversed, engineered and more complex function.
And now we want to insert real values.
Afterwards, we adjust our Java code and we will execute this function with these values and we will
figure out if we have reverse engineered this function correctly.
I didn't prepare this in this way, so I'm also super excited if this works out.
So let's have a look.
Okay, here we have our code.
This is a more clean version of the code we have reverse engineered in the last video.
It's the same code, but it's a little bit more clean.
I try to improve my writing style that it does not get that messy in the future.
Okay.
All right.
So we also have chosen some certain values for those registers.
I mean, we also or we just can influence these parameters.
All other values will be calculated by itself.
So let's see, we've got P one, which is one, P two is three, three and P three is seven.
We are now going to emulate this function and execute this with these three values and then we will
figure out the return value over here.
And afterwards we execute this function in our Android app and see if these values are equal.
If this is the case, then congratulations.
We have reverse engineered our first more complex Mali application.
I haven't prepared this, so I'm also a little bit excited on how good this goes right now.
Let's have a look.
Okay, so we zero is at this point zero that's okay for us we want is at this .23.
All right now we've got be three and V three is V three as now p one plus p two, one plus 33, one
plus 33.
Okay, this means we've got 34.
All right, so let's see.
We've got now B three and B three is 34 multiplied by multiplied with seven.
All right.
This might take a while.
I will see you in a few seconds.
Oh, never mind.
So do not care about this one.
Okay, so I have calculated with three and B three is 238 was not that hard, to be honest.
All right.
Next, we've got three, three, and this one is now 238 minus one.
Let's see.
Yes, we can do this.
237.
All right, then we've got this one over here.
Let's see p one, which is one, but it seems to simply get overwritten at this case.
Okay.
So we are not using this one over here and then we've got B three divided by P two.
So we overwrite P one over here with 200.
No, what's b33.
237.
That's correct.
Divided by 33.
All right.
So give me just a second.
I will do this again really quickly, just in my mind, and then we will come back.
All right.
Okay.
For this case, I had to use the calculator, but yeah.
So we have we could have done this on our own, but it's a little bit faster.
So what do we have?
We've got seven, 18, 18, 18, whatever.
Okay.
So P one is.
Oops.
The front seven comma 18, 18, 18.
And I guess to I guess we.
Yeah.
It's not we shouldn't that be accurate on this one.
All right then we've got be zero zero was zero.
We haven't used V zero so far.
So we are reusing v3v0 at this moment and this means we zero is now v3v3 is still 237 oh well, I know
there has this point where something goes wrong.
Let's see how 207 X what with this value, how good this goes.
All right.
This needs to be done in our terminal because, yeah, this will be a little bit messy.
Otherwise, let's have a look.
So let's take this value over here.
Python three.
Yes.
That's a list.
Nothing we want to have.
All right.
We have to use the dot.
237.
What with this one?
Yes.
This is not working because we are using an integer and a floating number.
I assume that this does not work.
Let's see.
I would assume yes, the CPU or the program will execute this statement.
It will cut off those floating point numbers.
So yeah, at this point we cannot use floating point, but in Excel.
I was pretty curious about this.
But yeah, maybe if we have two floating point numbers then we can get the better the bit representation
and we can do the math.
But in this case, if we have int and float, then those floating point numbers will be cut off.
And this is our result.
234.
Mm hmm.
Okay.
So 7.18, 18, 18, too.
But in this case, this will be cut off anyway.
So pretty good that we haven't been that accurate on this one before.
So it doesn't really matter at this point.
Okay.
Now our V0 is 234.
And this may be also the return value over here in the form of double.
That's it.
Our function will return 234.
All right.
So we will have a look into this in a moment.
But for now, I want to show you something, because I struggled at a point a little bit.
And at this point, was this one over here.
Why?
Because we've got P1 equals something and P1 is a parameter and we have a value in our parameter, the
value one.
So this confused me for a second, but by looking at this code I realized, okay, p one is now being
assigned a new value.
This means the value one will be overwritten at this point.
So we are not using the value one in this register anymore.
Further in this code we can see p one has been used over here.
There we have this value one.
So let's do it this way.
And afterwards we are also using it here.
But here we are overwriting it with this value b three divided by p two.
So we do not have a statement.
Something like this one equals B three divided by p two because this one doesn't matter.
At this point.
We are reassigning this variable or this register over here so we get a new value into this and this
value in this value will be overwritten.
All right.
Simply just stick to the code as it is, and then you you cannot make a mistake.
I mean.
Yeah, okay.
This is a really dumb message because you have to know what you're doing there and you also have to
know what this instruction means.
But if you overthink these functions and you bring on your own intentions and what this instruction
does, then we will make mistakes.
Therefore, simply just stick to the instruction as they are in each line.
And then, yeah, we cannot make a mistake.
Okay, so let's look this value up and otherwise I have to rerecord this video and find the error which
is in there.
I really hope it is correct.
So let's see.
We've got the return value 234.
Let's have a look.
Okay, here we are now the ubuntu vm back again.
We can see the math calculation over here.
So let's open Android studio towards Android.
Studio pen bash, studio dot, O.S..
All right.
So the key has been finished loaded.
Let's have a look in the player code.
And this is now super exciting.
I will overlay our code with this one over here that we can see what our reverse engineering approach
looks like and how the real code looks like.
All right, there we go.
This was the function and this is what the original code is looks like.
Let's have a look at our code.
All right.
Looks pretty good so far.
The only difference might be regarding to the brackets and this multiplication factor.
This is done in one line.
But I mean, our CPU instruction also splits this up or the assembly code also splits us up into several
instructions.
Therefore, pretty nice.
Pretty good chop.
All right.
Let's execute this code and then we will know if our manual reverse engineering approach was as successful
as our code analysis.
Let's have a look.
I'm also pretty excited if I have to rerecord this video and yeah, if we have made an error, of course
I will let you know about this.
So let's see.
We've got our player object.
All So, yeah, we can simply use player at power, and then we have to insert those parameters.
One, three, three, seven.
All right?
And we need to print this value out.
So we are using system out once again print line.
Player Smiley power equals oops this way.
And we and we need this bracket at the end.
Let's make our connection to the virtual machine, our orbital device.
Connect that.
Now let's run our application.
So we're going to run run app and please make sure that we are using the remote configuration within
IT configurations.
We can go into remote this one over here and t we have to enter the IP address of our system and we
also need to need to change the port to five, five, five, five.
The default port in this conflict is 5005, but this one is the default ADB port.
Okay, after doing this, we can click run and run app.
We can also open our ADB locked output and yeah, there we go.
Okay, one slight mistake.
I will be absolutely honest to you.
We are returning in double value.
Therefore, we are not returning 234.
We are returning 234.0, I guess.
Okay.
To be honest, this was my mistake.
Okay, so I take the blame for this one.
We have to make sure that regarding to the return values, we are also as accurate as possible, I guess,
or I'm pretty sure this doesn't make a difference.
Or it might be so regarding to type confusion or things like this.
So for example, if we have an INT and we rely on this that we are having the number 234, but in real
time we've got the number 234 zero, which is double.
Then we cannot mix them up together later on in our code.
So as already mentioned, I take the blame on me.
This was my error.
I'm super happy that I do not have to rerecord this video right now.
And yeah, I'm even more happy that we have successfully reverse engineered a more complex function
based in Somali.
So yeah, we didn't look up or even didn't look up the code once this one over here.
And if you take a look at this, this is a pretty amazing chop.
We are at the beginning of this chapter and we have reverse engineered this function.
So you can really be proud of yourself.
And yeah, this is a good point to move on with a little quiz.
I mean, this quiz will be now maybe a little bit too easy for you.
But nevertheless, we do this quiz and afterwards we patch our space ping application.
We can now already enable some nice features.
And yeah, I'm super excited to do this afterwards.
But first, let's have a look at the quiz.
All right.
I see you there.