Okay, so welcome everybody
First -- To this tutorial
and second -- Today we're gonna go ahead
and see how we can filter out all sorts of characters.
For example, people tend to use exclamation marks in their passwords
or asterisks
or, I don't know, a symbol for a British pound
or, I don't know, something else.
Whatever
They tend to use these symbols in their passwords.
Although not a lot of people tend to do this.
Most people tend just type in some sort of a name or word from the dictionary
and a few numbers, unless the service on the other side
is actually forcing them to use lower or upper case characters, etc
Now we need to deal with these things
and how shall we deal with them?
Well, think of it this way --
What do you have to press on the keyboard to get an exclamation mark?
Depending on what sort of keyboard do you use
I suppose...
I think this is actually pretty universal
So for an exclamation mark , it's shift 1
and then you get an exclamation mark
and we need to make a statement, which would recognize the state to the shift key
and if the shift key is pressed and if the value is the ascii value of 1 the keyboard
then please do not type in 1
Rather instead, please type in an exclamation mark.
So let's go about solving this problem.
Now there's going to be quite a good deal of these things
Perhaps an "if" statement is not the most efficient one here.
Rather instead we will combine the if and switch statements
in order to get a better efficiency.
So let's go ahead and type in "else"
and then ENTER
Open up these curly brackets
Let's go ahead and do this.
Write a switch statement
as I have shown you previously.
So just key here
and there we go
So let's deal with these cases one by one.
"case"
So, just give me a moment...
So this case will feature when the value of the key is basically the ascii value of 1
and let's take a look at the ASCII table for 1
"ASCII table"
So which one is it for 1?
For 1, it's actually 49
Probably shouldn't been on 0
Doesn't really matter
We can add it
I just wanna show you a demonstration.
So it's 49
Where is it?
49 it is
Okay, so case 49 shall go like this.
"if"
We need to create the overrides.
So "if (Get)"...
Oh forget about this
I'm just gonna go ahead and copy/paste it
because I'm terrible at writing these things down.
So all we want is the state of the shift key.
The hex value is 10
(ex10) symbolizes that it is a hexadecimal number
and you would write them in here
Like this
This is the hex value for it anyway.
If this is true, I would like you to do this -
write << "!" ;
and just go ahead...
Well, we can either close the file or not here.
I'll probably make this a little bit prettier, but for the time being
I just wanna do a demonstration of how this works.
So let's press CTRL F11
Okay, there's one keylogger running in the background.
Let's go ahead and end the task.
Let's run it one more time.
Okay, so it is running.
Let's go ahead and type in some exclamation marks.
HEYthere
Open up our log file
and there we go.
So it's says...
Okay, this is from my previous statements...
Okay, so this is the the current one.
So exclamation marks
and HEYthere at the end.
Anyway, we're gonna go ahead and select this file and cleanse it.
Purify it
So I don't have any more of these distractions
and now, from this point on
we just need to keep on building on this switch statement.
So we're gonna have a lot of cases
and this will allow us to customize our key logger
towards a keyboard that we would like
or you know, generally.
So even if somebody has keys configured differently
it does affect you
but it does not affect you to that extent.
I mean, how many different variations can you have
with, let's say the Shift 1?
Two, at max
So you have two possibilities
and it has to be one of the two
even though somebody has a different keyboard layout, perhaps.
It's not an exclamation mark.
Maybe it's a tilde key, or something of a kind
That's what I see on my keyboard, anyway.
That is a possibility
So just take a look at your keyboards.
I mean literally just pick it up, take a look, and see the numbers from 0 to 1
Well, actually the way they're laid out in the upper portion so the keyboard
it's from 1 to 0
It goes like this -- 1 2 3 4 5 6 7 8 9, and then you have a 0
and you take a look at these numbers
and then you take a look at these keys, these physical keys
and see what's drawn on them, and look --
There aren't that many possibilities
I see three things that are drawn on each one of them
One of those three things is a number
and the other one is a standard thing, which you would use with Shift
and the other one is some other symbol that can be used as well
that's kind of configured, but rarely anybody uses that.
They usually use other portions of their keyboards for those symbols
which we are going to deal with here.
So anyway, in the follow-up tutorial
I perhaps won't be doing as much talking
as I will do the writing out of this long switch statement.
There are two portions of this switch statement --
One is for a these special characters
well, if you want to call them special characters
and the other one is for our keyboard
is for, let's say Tab
and we need to incorporate Caps Lock somewhere around here as well
and if you want to
what we want to be written up when we press Shift
We don't want anything to be written out
or when you press Ctrl or Alt, and so forth and so forth
but in any case, this is the approach that I'm going to take.
It's not the prettiest of approaches
but it's the one that's the simplest understand.
So look, we have case checking
which we need to upgrade
We will do that in the follow-up tutorial, most likely
with the Caps Lock as well
and down here, we have the else statement
which just translates into a switch statement
in such a way we have interconnected this entire condition check
and then in the switch statement
we're gonna have a good amount of cases
which will be custom to deal with particular keys
to get proper output when you press a certain key.
So Shift 1
we wanted to give an exclamation mark.
Shift 2 -- We wanted to give a quotation mark.
Shift 3...well, I have no idea what Shift 3 is.
Okay, so it's British pound
and Shift 4, it's a dollar sign
and Shift 5, it's a percentage sign
a caret sign and percent sign
and so on and so forth.
So this is what we shall do in the the next tutorial.
Anyway, I bid you all farewell and I hope to see you there.