Okay.
In the previous package, we, uh, created our application for changing a mac address, and it is working
perfect.
So now let me collapse this.
Okay, so here we have two function get argument.
And also changing the Mac address.
It is asking to argument.
Okay for interface and new Mac address.
And we are calling those two.
Here we are using it.
Now let me uh create our before creating okay I will do something here.
So here we are going to design an algorithm okay.
For changing the Mac address.
So first thing we ask what is an algorithm okay.
An algorithm is steps of writing a program okay.
We write an application or a program in many steps to solve a problem.
So that is called algorithm.
Now we are going to design an algorithm here to change the Mac address.
So what is the those steps that we want to do.
Okay.
So the first step is to execute and read ifconfig.
Okay.
Execute and read ifconfig.
Okay.
And what is the second part.
Second step it is to read the Mac address from the output as you see here.
Okay.
While we are trying to change the Mac address.
First we use ifconfig okay.
So the first part is to write ifconfig.
And then I like this like here to read the command from output okay.
So this is going to be read Mac address.
Okay.
Read the Mac address.
Okay.
From output.
And we have the next part which is the third part or the third section or the third step.
In here we are going to check if Mac address in ifconfig is what the user requested.
Okay.
Very easy.
So here we just check it.
Okay.
Check if Mac in ifconfig is what is what the user requested.
So this is the third part.
And also the final part is going to be the fourth one.
And here we are going to print an appropriate message.
So let's say.
Appropriate message.
Okay.
So in this four step we are going to write an algorithm here.
Okay.
To do this to get the goal.
The goal is to check if Mac address is changed or not.
Okay.
Very easy.
So here I am going to.
Uh I'm going to use a function called check output.
Okay.
And it is from this subprocess here I'm going to check that okay.
I'm going to use that to check if uh we are executing the ifconfig or not.
Okay.
So let's do that here I'm going to use subprocess dot check.
Output is a function okay.
That belongs to the subprocess.
And here inside this I'm going to give the give the command.
Okay.
So I'm going to use a list.
So it is going to be ifconfig.
Ifconfig ifconfig okay.
And what is the second one.
And you know it is the name of the interface.
Okay.
For example we have LAN zero, we have eta zero.
And a lot of things.
Okay.
But here we are going to use options dot interface.
Okay.
That is here.
And finally we are going to print this okay.
So let's use print.
Print what.
Okay.
Let's first store this into a variable I'm going to name it ifconfig result.
Okay.
Ifconfig underscore result.
It is assigned to this.
And here I'm going to print that.
And also I'm not going to change the Mac address.
Okay.
So let's comment that and save it.
Let's come back here.
I'm going to clear it.
Okay.
And here, right now, I am trying to change the Mac address for eth0.
Okay, now, let's, uh, while I'm hitting enter.
So it must print the result of ifconfig for me.
Okay.
As you see, it is printing the ifconfig for me, and that is eth zero.
That is.
Here.
You see it okay.
And let's see what else do we have.
Where is the Mac address.
That is either here.
Okay.
This is it.
So right now you see we are changing the we're trying to get the output, uh, trying to execute the
writ.
Uh, ifconfig.
Okay.
Execute and read f config.
So this is the first part that we have done it okay.
The second or the next part or the next step is to read Mac address from output.
So let's go and do that in the next video.