In this video, what we'll be doing is, uh, we'll be generating a binary file.
And in the binary file, which we have the Elf file, we'll be trying to change one character and see
whether it will work or not.
Like instead of having elf, I'll say a elf.
Will it work?
Let's try out.
So I have this machine file.
I'll now not do step by step compilation.
I'll just compile and I'll say, now I have this file which is an executable file, and then it is working
as expected.
Now I cannot do a cat, I know I can do hexdump.
Uh hexdump.
Hyphen c.
User space.
And we should be able to see this.
Uh, we need to check whether we are.
Able to see.
So you can see a lot of content somewhere.
You are seeing L, F and D, right.
This is what, uh, we have in our code.
So we have in DPS what we have in our code.
Now I want to change this.
Uh, l e I think this is in the Ascii.
So if you see e, it should be four, five, 616 into 464 plus 569 is E and then L is for C and F is
46.
And then if you see 4545 is like E.
So they are using uh Ascii.
Uh, this machine code has uh, I mean characters are represented in Ascii format, so everything should
be ones and zeros.
Right.
So now what we have to do first.
First we have.
We cannot directly open using VI.
Right.
If I open this user space in VI, I will not be able to understand what it is because this is not in
a text format, it is in a binary format, or it is a, uh, elf, right?
Just binary ones and zeros.
So there is a tool known as x x d x x d is a performs a hex dump, or you can do a reverse of that.
If you have a hex dump you can generate a actual elf.
Uh, right.
It creates a hex dump of a given file, or it also converts a hex tum back to an original binary form.
So we will be using hex g hyphen g bytes.
So how many bytes you want every, uh, separate the output of every hyphen g bytes.
So let's see what we'll do.
Now.
It says x d f and g one and user space.
So it is printing this uh in a.
Same like a hex dump.
Only right now.
We'll.
Uh, now convert this into a plain output.
Okay.
So what we'll do now, we'll write this to a plain file so we can easily edit using VI.
So I am now writing the hexdump output of this into a plain file.
I'll open this one.
Now I will search for uh, 4545, which is E right.
4545 is E, and our 45, uh, is 45 is E, and then for C is L, and then for six is F.
So I'll change 45 to uh, let's say I want to change it to a.
Right.
So A is like 65 which is 41, 64 are 64 plus one is 65.
So I'll save this one.
Now I need to convert.
I cannot run this one.
If I say file on this hexdump plain.
This is an Ascii convert text.
It is converted into a plain text.
Now I need to convert back into the actual binary format and I can do it do again using Xxt which has
a reverse mode as well.
So 60 hyphen p.
Hyphen r give this as an input and create me an elf file so it will create an Elf file.
Now if I say file uh hexdump dot elf.
It is having a Lf file now.
Right.
And let's see the permissions whether it has given directly the CSS mode.
No, no it has not given the permissions like when you do a make.
So we have to create this give this permissions.
Now when I run this one now it is printing whatever change we have done from our uh plain one character
change which we've done in the binary.
So yeah.
So what we have done in this video is we try to see whether, if we can make any changes in the binary,
instead of writing the full C code and compiling if I have a binary and if I want to change a character,
can I do it?
So and I think it is possible using elf and we have verified as well.