Not that it will take some time and then it will finish education.
If everything goes perfectly it means that it has installed this package properly.
And now if you go to see go and then source I think.
No not here.
So if you go to users test and then go to the go source for that area go parties and then you can see
that if you go to GitHub dot com you will note that there is this one for that which is guarded kingly
fire and then it has Gokey logging in it so it has installed this key to it.
And once you install it you create a new project.
And now I will show you how to use this program.
So in order to use it you have to follow certain conventions.
So let's start with it.
So the first thing you need to do is you need to create a killer object.
So I am going to write kilo that equals two.
And then you need to use this like the ritual you have already downloaded which is going that.
So just write key logger rules kill other dot new you know.
So.
So I downloaded it twice so I think it is exciting too.
Otherwise it will just show one if you downloaded it once.
Okay so once you have it the next step you need to do is you need to start their time.
So to do this just right start time then equals two times.
Now so you whatever kind the time is you start there.
Okay.
Once you have this the next thing you need is the file where you want to stored your key logs.
So I want to store my key logs here but you can store them anyway.
So I am going to create a new file here.
So I'm going to use OS dot open fighting method and then I have to specify the name of the final two.
I'm going to call it key load.
It's you you can call it anything.
And the next option required is which mode.
So I'm going to use the Create and append mode.
So if the file is not present created if it's present just appended.
So there are two modes.
So OS got or those could create R or S O underscore append a
are always the hot or screwed up and then you need to give four missions six execs.
You can read about these permissions in the documentation.
More testing necessary to just give permissions here.
Okay lets you have this you need to distribute on the file object and then and add it if it is not eager
to fight.
Okay once you have it you need to know start key logging.
So what we want to do is you want to get the keys.
So every time for example if you want to get a key you say key and then you call key another dot get
key and this will return the key.
So whenever you press for something this function is called get key and it will get the key and stole
it in the variable called.
Next you have to use this variable so we can check if key is not equal to.
If not a So we have to check if the key has some value or not.
So if the key has some value then we want to what we want to do is we want to read this file into the
program.
So we want to add this key into this file you know that.
So let's go here and then I'm going to use wildcard right string and then I have to write.
He dropped you.
So I want to store this key since it it's in that environment and it requires a string.
I'm going to typecast it to a string.
Okay so now we have an object which will write whatever key we enter into this fight.
So not that this is just for one key and we want to keep a record continuously.
So whenever the user presses a queue you want to store this game to have a program.
Okay
okay.
And then what do you want to do is you want to defer finally that close.
So you want to close the file properly so we don't have any problems.
Okay so the next thing.
Okay let's do it in a loop so that we can get these continuously
so let's put it here so.
Okay.
And then we have to put these thing get in a loop so that we get the keys continuously.
So I'm going to write to file infinite for loop
okay.
So what will happen is that if there is some key and if not is not empty then it will write this key
to this file that we created.
Okay.
So now this process will run automatically but first we want to do is we want to introduce some time
interval here so that this loop does not run indefinitely and it does not overburden those systems.
So what do you want to do is you want to introduce that time asleep here.
So what I'm going to do is I'm just going to introduce a 10 millisecond Sleepyhead so that program sleeps
for 20 milliseconds and then wakes up again.
So I'm going to use 10.
In due time God millisecond.
So now this will come.
This loop will run every 10 milliseconds and it will try to get to use it.
Q Okay so now we have this the next thing we want to do is that this build on rules is designed to run
indefinitely so we don't have any exit condition.
So if we pull gum if we start this program we will be stuck in this program will continue writing and
writing and unless there is some error it will not stop writing.
So what do you want to do is you want to define an exit condition so let's say we do find an exit condition
that if 10 seconds has passed.
While the program is running we can stop the program.
So as you know that we already have over start time we're here.
So when the program starts it starts store the start time of the program.
The next thing we want to do is let's say we want to run this program only for 10 seconds.
So what I can do is I can write duration
equals to
time dot since and then start time at okay.
So what this will do is that it will measure their time duration of this program.
So for example when the program starts whatever time and this will be let's say say at three hours and
perhaps three hours and five minutes and let says U.S. seconds.
And every time this loop runs it starts updating its value of duration.
So whenever for example after frustration it would be 10 three hours five minutes five minutes zero
seconds and then the first value would be 10 milliseconds because this loop wait for 10 seconds.
I'm just giving an example the actual value would be very different.
What we want to say that read If if 10 seconds has passed we want to stop the execution of the program.
So to do this I can say if duration is greater than an asked Time dot seconds.
So it means that if 10 seconds has passed while the program has started we can break the loop.
So whenever 10 seconds pass the program will break and it will go out of the loop and he loves will
be stalled in this file which is given over not to extreme.
So the next lecture children you run this program.