WEBVTT

00:01.080 --> 00:04.480
Okay, now the program is almost completed.

00:04.480 --> 00:04.880
Okay.

00:05.440 --> 00:10.880
We have gone up to here and let me see the terminal here.

00:10.880 --> 00:16.400
You see, while we are executing our program, first it is showing us the result for ifconfig and then

00:16.400 --> 00:19.080
it is printing me the current Mac address.

00:19.400 --> 00:21.840
So it is not what we want okay.

00:21.880 --> 00:22.440
So let's go.

00:22.440 --> 00:23.720
What is the c.

00:23.720 --> 00:25.080
What is the the next step.

00:25.080 --> 00:31.160
It is checking if mac in ifconfig is what the user requested or not.

00:31.800 --> 00:34.480
Okay I will do that in the next lecture.

00:34.480 --> 00:38.520
But here I am going to handle this okay.

00:38.560 --> 00:43.480
As you see this, all are is responsible for getting the current Mac address.

00:43.640 --> 00:47.960
So I'm going to move this into a new function okay I'm going to cut this.

00:48.480 --> 00:51.080
And let's create a new function here.

00:51.080 --> 00:58.200
Let's say get current Mac address.

00:58.200 --> 01:04.920
And you know that it is asking or for interface getting the interface.

01:04.920 --> 01:05.640
So let's.

01:07.880 --> 01:08.920
Hit tab here.

01:10.810 --> 01:12.370
and here.

01:13.010 --> 01:16.170
One thing that we don't need to use is options.

01:16.690 --> 01:23.490
And options here is out of this function, as it's almost in the other area, and we are not able to

01:23.530 --> 01:24.890
access it from here.

01:24.890 --> 01:27.130
So I need to remove that option from here.

01:27.810 --> 01:37.930
There we go and print if config result I don't need to print the result for if config and then.

01:40.210 --> 01:43.730
The thing I need here into the if statement.

01:43.730 --> 01:49.370
As you see here, we are printing this Mac address search result.

01:49.410 --> 01:52.090
It is better to return this okay.

01:52.090 --> 01:57.450
While we we use something in function it is better to return.

01:57.490 --> 01:57.890
Okay.

01:57.930 --> 02:03.850
So now it is returning the Mac address search result and later we can get it here.

02:03.850 --> 02:07.570
And then we will be able to use it okay.

02:09.050 --> 02:11.010
So good.

02:11.530 --> 02:16.050
Now let's come right here I'm going to use that here okay.

02:16.090 --> 02:16.850
It is.

02:16.850 --> 02:19.300
Just get the current Mac address.

02:19.340 --> 02:19.740
Okay.

02:19.980 --> 02:23.860
So let's use that get current Mac address.

02:23.860 --> 02:31.540
Here I am going to give the interface okay options dot interface.

02:31.860 --> 02:32.300
Okay.

02:32.620 --> 02:36.420
So now we have it I am going to store this into a variable.

02:37.020 --> 02:39.220
Let's name this variable.

02:41.660 --> 02:45.180
Current Mac okay.

02:45.180 --> 02:51.020
Now that we have this current Mac here I am going to print the current Mac address.

02:51.020 --> 02:55.540
So here what it is trying to change to get the current Mac address.

02:55.540 --> 02:58.740
So if it is able to get it we will be able to print it here.

02:58.940 --> 03:01.300
If it is not able to get the current Mac address.

03:01.300 --> 03:04.980
So it will print this one, but not Mac address.

03:04.980 --> 03:07.180
So here I am going to print

03:09.100 --> 03:11.820
um current.

03:13.940 --> 03:21.620
Mac address is equal to concatenate this with current Mac.

03:21.660 --> 03:24.780
Okay, maybe this current Mac is not a string.

03:24.780 --> 03:30.430
So if it is not a string, you need to change it to str, which is string.

03:30.470 --> 03:30.830
Okay.

03:33.550 --> 03:36.950
Now I'm going to save this and let's go back here.

03:37.310 --> 03:43.990
Right now I'm trying to change this for eth0 or access it for eth0 and trying to change it.

03:43.990 --> 03:49.310
You see it is giving me the current Mac address is equal to something like this.

03:49.310 --> 03:54.670
And what if I try to access it for low.

03:56.870 --> 04:03.110
And you see that could not read the Mac address and current Mac current Mac is equal to Nat.

04:03.150 --> 04:04.350
So perfect.

04:04.510 --> 04:09.270
Now we are able to have a better look of the error message.

04:09.710 --> 04:11.910
Instead of having a lot of thing.

04:11.910 --> 04:13.830
Here we have only two messages.

04:13.870 --> 04:19.830
Current Mac address is equal to current Mac address, and the current Mac address is equal to none.

04:19.830 --> 04:20.270
Okay.

04:20.870 --> 04:21.990
So perfect.

04:22.190 --> 04:30.870
Let's go and see how we can do the next part which is which is to check if Mac in if config is what

04:30.870 --> 04:32.310
the user requested.

04:32.350 --> 04:33.870
So let's go and see that.
