Welcome all to this tutorial.
Today I will talk about pointers and files.
After that, we will go straight into actually writing the code for a keylogger.
We will begin writing our keylogger.
So you are only two subjects away and one tutorial away
from writing a real keylogger that will actually record keystrokes.
Please keep in mind that initially, I will try to either create it myself
or just find one on the net that is really really really really simple.
I mean the most basic of the basic, so that you can only record keystrokes
and then we will try to expand upon it.
We will keep on adding functions to it and we will see how far we will actually go.
Anyway, let's go ahead and take a look at this.
So one of the things that you will basically know are what pointers are.
Basically days store memory addresses of other the store memory
addresses of other variables that's it no big deal there the way you would use
it the way you would use pointers in the most simple of example in the simplest
possible example later on you'll do more complex examples as we start programming
the keylogger but for the time being i'll just keep it simple would take p.m.
let's let's declare a variable first let's create a variable number let's
sign it a value of
so now we would like to create a pointer that points to dis variable how do we do
that we'll we basically just ok we take a look at this and let's disassemble it
so this is a type in this is an integer it heard variable has a name of number
and it has an assigned value of ten ok
in order to create a pointer that points to it needs to be at the same time so in
and then that Asterix and then we give it a name so we can do whatever we like
pretty much gonna go ahead in the image PTR so isn't point the Dr's pointer and
then afterwards we tell it we actually need to tell it to actually point to
this variable so how do we do that we take in PTR sequels and we need to open
a 10 percent sign and percent sign that's the memory address of P TR this
year ago now let's go ahead and write Dec out co2 instruction CEO and let's go
ahead and output well just separate these two values that we will output the
value of PTR so to your ethically what we want to do is for these two values
when they get out put it we would like them to be the same in this case they
won't you'll see why their ego so is stan is it is supposed to be a cleat
thing here this is things ok so it's one thing to number
hexadecimal number regardless of the fact that it has letters inside zero x
that simply specifies that this is a exit the small number and then you have
hexadecimal numbers are go from go like this
0123456789 and then ABC D
D E F after the last if I am mistaken here price increases chance feel free to
hang me in discussions a way if you will be the memory address of its not
particularly useful to us now it's definitely not useful to us from you
really dis bridge let's put it like that can be it has its uses
if we want to to output value of Nnamdi assign value from them
well simple enough just a bit less tricks here let's go ahead and run it
their ego so 10 and then you have colon colon dead simple as that
no big deal now this is a very basic example as I said later on we will go
through we will go we'll see some other examples of how pointers are used and
hopefully as we as we go through the process of the creation of the keylogger
you will be able to solidify what you have learned thus far and learned a lot
of new things go ahead and delete this ad we don't really need this for the
time being
let's go ahead and deal with files now why do we need files what on earth are
we going to use them for a while if we're going to make a keylogger we will
definitely need to know how to use files because hey if you have a keylogger
buddy system you will be storing those particular files where we'll use toward
the keys so where will you store the keys that are typed in the keyboard well
to file and somebody presses I don't ABCD ABCD will be written to a file
somewhere you see how it stands to reason
we need to know how to actually write to a file using purely C++ and nothing else
this is a very simple process is not very complicated it's very similar to
see out and see and you only need to do up here is that include dream so that we
would be able to do this and let's go ahead and deal with writing to a file
first we need to create an output stream so it open or stream and we'll give it a
name right that seems the most logical thing can write whatever you want here I
don't really care right and then let's go ahead and get petition marks and go
ahead and yeah we need to specify the path if you don't specify the path it
will be in your project folder so they're Projects folder is here simply
if you didn't change anything it should be here you click on local disk C users
creator well obviously for you you will have a different username I'm just gonna
go ahead and click on mine so just go ahead and click on the user name of the
user that you are using at the moment no go ahead and look for work space
go ahead and click on it and look for your project two years so our project is
a keylogger and it will pop you see already have it from my test before but
in the least a decision needed so it will be here just gonna minimized US
anyways let's go ahead and write and specify our file path so they've been
see cooling
backslash backslash is an escape character it used to escape the
quotation marks Sunni type in two backslashes if you want to if you want
to see your beck / in the string that that it's printed out in this sentence
in the statement where quality so see colon slash slash users backslash
backslash again later and this is where I would like to create this file in this
particular folder just see ok we will create a huge need to pay attention you
give it a path and you me to make sure that you can actually right there if you
can't write anything there won't be able to create a file by the way this what we
have written here is the equivalent of this so this is how the system this is
how the south will be for the system because we have entered backslashes of
backslashes here so that the slashes backslashes could be interpreted as such
as I stated backslashes our escape characters so if you need some character
to escape these quotation marks and be interpreted as a commander something of
a kind then you would tape in a backslash let me show you what I mean by
that comment out this line just to make sure there are no Asians here safe I
type in CEO and if I open up quotation marks and if I type in text goes here
he's did you know and if I double backslash year that I type in that
stands for a new line back / and for a new alliance or skipping it and let's go
ahead and that some something else
random text goes here here in case you didn't know
case you did did their ego just go ahead and do this so there are no end else
here and there is justice escape character with its guidance in this
command around here
random text goes here in case you did not know in case you did write something
that we will be using some of this later on as well and do dis
FileStream right and doubt we need to actually write something to that file
well how do we do take a wild guess just type in right
pretty much the same as see out and let's go ahead and take some text here
alright I knew I was forgetting something when I was looking at this we
need to provide the name of the file so our final thought txt a wonderful if
needed I forgot oh well things happen when you program you will encounter more
than one problem but just forgetting things right so what should we put into
this text file
windows in it like all the freedom to read the statement late so much says
anyway you can do this but I did now so see that the quotation marks are here
and then you can just press Enter going to do you live and then add quotation
marks here this is all the same line to the computer you're just doing this for
your self gate so let's go ahead and let's go ahead and compiling renders yes
go ahead
errors but there's a semicolon of course does it in preventing out of the screen
so we need to actually because we didn't tell it out
need to actually go ahead and check and this is the folder is hella see if we
can find that their ego it says our final da txt says we also I like working
in it I like all the freedom that I haven't had as in it as opposed to Linux
field for the space there now gonna do it let's do a test run so you see this
is all one line if item for the space here or here it's just interpreted as
one single I as being together those faces but now I have a stasi up their
ego as opposed to sex oK so that's how you write to a file at the end you
should always close the file
to close the file you don't have a built-in function in just a bit right so
whatever you've typed in whatever you named it whenever you name this file
stream just go ahead and use that thought is no need is a need to Lowes
there we go this will effectively closed the file you can't actually see this
happening but that's something to do if you do this you can save yourself a lot
of trouble a lot of headaches actually later on anyway let's go ahead and
delete this as we no longer need it now let's figure out how we can actually
read from a file so this is what I will just do the basic reading from a file
that big deal later on we will need to do lou combine this with loops
continuous loops if we will need to combine it with infinite loop so that
actually reads through the whole file continuously for the time being I just
put a show you how you can read an individual character from a line from a
file that's it nothing else I would you do this well you would need to tape in
input file with the name of your choice let's give it a path again see users
I'll txt ever go and how do you read from this well you need of first full
year of 2005
variable which store it's raining down below we will take in read greater
denigrated ensign read it in to exploit this will only read the first word into
X it will reach only until the first space capsule and sea salt please help
protects let's go ahead and run this window so that was the first word it
interpreted that
see Windows the first word and then we have a space here later on show you how
you can read the whole file
regardless of its length regardless of how many spaces there are regardless of
the length and so on and so forth some very complicated you need to create a
loop and know how to handle it
we will of course do this because we will need to read from a file and write
to a file as well for our key logger because that will be a place for a
keylogger stores the information that we need to figure out what we want to do
with that information whether we want to send it somewhere or not we will decide
to actually send it somewhere anyway I'm gonna be your farewell here until the
next tutorial in the desert or actually going to start creating our first
keylogger that will be really really really simple really primitive and we'll
see how that works out then from there from that point on we can start adding
some features well anyway goodbye