Welcome back.
In this lesson we are going to patch the file to show the right message no matter what the username is.
I hope you have tried this on your own.
So now let's see how I solve it.
So if you run this now and you key in the wrong username, it will tell you wrong.
So we have to search for this string,
"wrong."
We already done that.
So we can just go over there straight away.
So let's reload this and click run.
So we are already at the main here.
So we graph it now.
And then we're going to run until it asks for the username.
So let's prove this to the right.
And let's run it.
And it's asking for, for the username.
So let's key in the wrong username, "cracker."
And now it has
paused at this breakpoint.
So let's step over until it comes to the jump.
All right.
So now we know that if it goes to the left, it's going to be bad news.
If we click on this we see that it is taking, it is taking the jump.
That means it's going to go to C95, which is here.
Now a simple way to, to, to cause it to show the good message is to make it go to the right.
So before we patch anything, we can test our hypothesis first.
We can double-click this to toggle the zero flag.
So now we click on this again.
You see that the jump is not taken, which means that it's going to go to the right.
So let's step over now.
And it goes to the right.
And it's going to now make this call.
And the parameter for this call contains the string "right,"
as you can see.
And the function that is going to call a "cout."
That means it's going to print out this message "right" to the screen.
Let's step over this and see that happening.
And there you go.
So our hypothesis is correct.
All we need to do is reverse this jump.
So, so now how do we reverse this jump?
There are two ways to solve this.
You can convert this JE to a JNE, jump not equal.
So JNE means it goes to the right.
And an easier way, a simpler way would be to simply NOP it.
NOP it means that this instruction never takes place.
It will just go to the right, so it will not jump to the left.
So either one should solve the problem.
So we try the easiest way.
Maybe we just put a NOP here, so we can put a comment here.
NOP this.
Refresh.
And then we go to assembler.
And then over here we can just right-click and binary, fill NOPs.
Click okay.
Now we can just, uh, patch the file.
And click patch file.
Click on it and give it a new name with the dash two at the back.
Click okay and let's test it directly.
This is correct.
This is a patched file.
And you see, no matter what you enter, it is always the right message showing up.
Try again.
And there you go.
So this is how we can solve this crackme
by patching the file.
That's all for this video.
Thank you for watching.