Hi everybody Welcome to Part 8 of the Linux command my mini course.
Now in this video similar to the last video where we talked about base64 we're gonna be talking about
hex now again as well as base64 there's gonna be a whole nother video dedicated in a different module
to teach you all about what hex is how it works think of hex as a represent.
It's similar to basically for the fact that it represents binary and an ASCII format.
Now just know that hex does is a little bit more used around working with exploits and working with
memory etc. because most debugger is when viewing things are normally done in hex and making modifying
a file at the binary level is normally done again through a hex editor.
We'll go over hex a little bit later but I just want to kind of show you the similar use cases for hex
conversion to ASCII and back that we did for base64.
Now to access a hex converter there's already one built in called X X D.
Now what we're gonna do is we do something similar so if we echoed in nation into x x d dash P We're
gonna get our R hex code.
Now the dash P is for a principal format because if we did it without it we would get the raw like on
the first on the first zero through nine bytes.
We get the raw hex code and then the actual value and then from 10 bytes on there's the line so we don't
necessarily want this value.
We just want the raw text and now you could just copy this and remove the spaces but for ease of printing
we just use the dash P which gives us our R hectoring altogether.
Now if we go this texturing
into x x d dash R for reverse and then for printing as well we then get our resignation so we can convert
back and forth again if we move the dash P just reverse it does nothing.
So that's fine it requires a dash P Mario.
So now you have a ready mission.
Now we can do something similar to what we did before.
So let's do a quick go.
So we've gotten nothing in this file or this folder I believe we're on the desktop.
P.W. is print working directory so the current directory that you're sitting in so perfect.
Let's go ahead and cat been Alice into x x d dash P and the mole.
Go ahead and throw them to less new hex.
Now I've forgotten cat LSA new.
We could see if we got our hex right now.
We can do like we did before as Python execs D dash our dash P to reverse it and then put that into
LSA new the standard file itself.
Perfect.
So now we can see we have less new.
So if we change mod to make it executable analysis no.
And then we run Alice and you start running something local is top forward slash and then Alice and
then whatever the commanders.
So if we did this we do indeed get our same input.
So this is again another way where you can copy data to and from a machine or execute certain commands
that you don't want on the command line.
We'll do it let's do a quick still a quick look here.
Let's do sorry guys off the fly.
Let us do.
OK so we'll do echo.
Let's just see you name Dash.
Which will go over to second pipe that into 16
dash P pipe that into a file called CMT.
Right.
Just so you know you name dash a just provides the information about the system such as the kernel version
and.
So if you do a cat for command hex we get our hex code.
Now let's say we wanted to run a command based on that.
So if we did Cat CMT hacks I've done x x d.
So again this is hiding the command from let's say command history as an example doesn't hide from things
that are kernel level which actually see the commands and this calls being ran.
However this is a good way to stop something like Splunk logging from just grabbing the bash history
for the local user.
So that's our dash P.
Again we'll just confirm.
Perfect.
And what we do is we pipe that into that
area.
So now we can see we can run commands without actually having to say the full command.
Now this kind of works similar to do this.
This is the next version.
That's right.
Is one day one more to kind of show you guys a little bit more of a useful example.
Right.
So if we do Cat ATC pass w which has the password file to go ahead and do that and more on the same
command misspell
UTC.
Now this is using a shadow file.
So this X right here would normally be a password hash which I'm not going to show you on the string
on the video.
However just know that that would show you a quick way to get to that easy password which is a commonplace
that the logs are looking for.
So some logs might be looking for the word pass WD in general across anything.
So this is a good way to bypass that.
And again we can do the same thing with the base 60 for.