Okay, now it is time to come and create the send email function or part.
Okay, so this is the main part.
Okay.
The main function or the constructor.
And here you see we have the time here hardcoded.
It is better to ask that from or add that as an argument.
Okay.
So if you want to add that as argument you need to add it here.
And later on you can add it here while you're calling the class and creating the object for the class.
Okay.
So here I'm going to use let's name it time interval.
Interval.
Okay.
And here after you added that here you self dot time interval.
Time interval is equal to time And so on.
Okay.
So.
Or if you don't want to add time interval you can just add time interval is equal to time interval okay.
And now in here in instead of having that number right there you can use self dot interval.
Okay.
So let's use self dot interval.
Perfect.
And now here because in main function right here we have an argument okay which is time interval.
Now we need to pass that time here okay which was six.
And if you want you can add more time for example 100 and 20s.
Just two minutes okay.
And by the way let me collapse this and also this and also this one and this dot function.
Okay.
So here Under this report function, I need to create another function or method that is going to be
sending an email method.
Okay.
So.
Let's create that method here.
Define a method I'm going to name this send mail or send email or something like that.
So here it is going to have an email.
Okay.
We need to provide an email.
And also we need to provide a password.
You need to provide a message.
Okay.
So that while we are using we are creating any function or any method here we need to use self or you
need to provide a self keyword at the beginning.
Okay.
So here you need to create a server variable.
It is equal to.
Server is equal to Smtplib.
Lib smtp lib dot um smtp here.
Right.
This one okay.
smtp.gmail.com and then provide the port which is 587.
Okay.
And also we need to import the SMTP here.
Import s m.
SMTP smtp lib.
Okay now let's use server.
Dot start TLS which is a function and also server dot Login is also a function.
Here we need to provide the email that we provided and also we need to pass the password.
Okay.
So now you are logged in while you were logged in you need to send okay.
Server dot send mail.
That is here.
And in here you need to use email and also email.
And then the message that you provided.
Okay.
And finally server dot quit.
Okay.
Now it is almost completed.
Okay.
Now into this report here.
You see we are printing the self dot log.
Now instead of printing the self dot Log you need to.
Use or call this send mail method.
Okay so here let's call that.
So we use self dot send mail.
And here we have some argument or something like okay argument or attribute here that needs to be added
into the main function.
So okay into the main function.
Again just like the other one.
We need to provide two things okay.
One of them is going to be email.
The other one is going to be password.
You may ask how about or what about messages.
The message come from here because we are going to just add the log as message okay.
So here we use self dot email is equal to email Self dot message.
Come on.
Message is equal to.
Message.
Not really.
What am I doing?
I don't know, but password.
Is equal to password.
So.
And now while we are calling the method here we need to use self dot as self dot email, solve the password
and self dot log.
That is all.
Okay so let's use self dot email.
Self dot password.
And finally self dot log.
Here we were adding printing the log.
Now instead of doing this We are doing this.
Okay, now I saved this.
Okay.
And also I import Smtplib here.
Now it is time to add each of those each of those arguments right here.
Okay.
So the first one is going to be.
Password.
Okay.
As you see here.
No the first one is going to be the email.
The second one is going to be password.
So here you need to provide your email.
For example my email is going to be.
The gmail.com and also the password for your email here okay.
Anything.
For example this one you need to provide your real password here okay.
Okay.
Now I have these.
Put this to six seconds.
And also I have the email I have a password.
This one this is a password I'll show you how you can generate an app password on your from your Google
account.
Okay, so you need to open your Google account, for example your browser.
Okay.
Hit this icon here, which is your photo.
Okay.
Hit manage Google.
Manage your account.
And then come here select security and scroll down here.
You see we have a password here.
If you don't have it you may have it right here.
Okay.
If you need to enable two step verification then you see the app password here something like this.
If you don't see that search here okay.
App password.
And that is here.
Hit that okay.
And after a while it will maybe ask you to enter your password.
And after that you will be redirected into this web page.
From here select email for example and then select your.
computer.
Mine is windows computer.
Maybe your Windows Phone or Mac or BlackBerry or even other.
Okay, so I use windows computer and then I hit generate.
So this is a password that is generated.
Now I can use it for.
I copy this.
Okay.
And then I can use this.
Let me use Ctrl C and then I hit okay.
Now that is created here.
Okay.
And here it will show if it is used or not.
So this two is used but this one is not used yet.
Let's come back here.
And now instead of this one I will use the other one that I just generated.
Okay.
So I save this.
Now let's come back here I want to execute this.
And let's say hello and hit enter.
So now I'm going to go back to my Gmail.
That is here.
Let's.
See.
We have hello and E.
Okay.
And also uh here for example I want to go to uh any view.
For example I want to go to facebook.com.
Now while I enter facebook.com this may capture that okay.
See?
Still not.
We don't have it yet.
Now you see.
Uh, Facebook.
Okay.
just.com.
We have just received this.
Also, if you want, you can do one more thing here.
For example, let me come right in Right in here.
And I want to add these at least 22nd.
Okay.
I will save this.
And I came back here.
I use Ctrl C to interrupt this.
I use clear.
I re-execute this and now the program is running.
Okay.
So you right now looks like we don't have internet connection.
For example I'm trying to go to Python.
Go to facebook.com I hit enter.
Okay.
Now if you provide anything like username and password something like that, you will receive that right
here.
Okay.
See we have facebook.com and then we have the the keyword okay.
Enter that is pressed.
And also you can give that time to be more than this that we have it here.
Okay.
Me?
I give it 22nd.
You can give it at least half of an hour.
Okay.
After each half of an hour, it will capture all the keywords, all the keys that is pressed, and you
can reset it.
Okay.
So for me, right now, it is in here.
Everything looks like it is.
Uh, all other thing is filtered here.
But let me if I find something like login page or something like that.
Uh, okay.
I don't have it here or anything.
Okay.
So here you learned a lot of thing.
Okay.
You created your key logger, which is working perfectly.
Now, if you want, you can remove this password.
Let me show you how you can remove it.
okay for before removing that I will.
I need to stop this program.
Let's use Ctrl X or Ctrl C okay, now it is stopped.
Or also here while we are starting the program, before doing anything I could do.
Like I can send an email and I can add like the program started and then it will do the rest of things.
So okay, I forgot to tell you this one.
Now if I refresh this, it will tell me that it is just used, uh, this second.
Now I can remove this.
Okay, I hit delete.
So that is deleted.
And also I delete this one that is also deleted.
Okay.
So thanks for watching and I will see you in the next section.