So in the previous lecture we just saw how we can just change the macro.
This is from the two techniques.
So one was using the application that comes prepackaged with discoloured Linux.
That is the Mac tender.
And the next one was our one idea that is this a config.
So what we just did here was we just submitted our w land Zero which was the interface to this MAC addresses
by changing his argument to that field.
What we want to just include so you can see completely over here.
We just things from that ordinal MAC addresses to this MAC address is what we just assigned over here.
So let's make use of this technique in this end upcoming Lichter to make our complete to maximize our
application.
So before that first of all we have to this talk about some of the modules that we are going to use
in this lecture.
So before that we have to install the items so in order to install the item on the machine open your
Firefox.
Let me just remove this one and you can simply say something like download by Dom and you'll get this
link.
I have already downloaded it.
OK OK.
I'll just go to this link which is the advance link you will see that it has the platform here.
That is Windows Mac OS X or Linux based on your platform this click on Linux and you have to download
this community Virgin place on this download it will just give you this link and you have to for us
unzip it.
So basically this will be zip file and you have to first extract this.
So after extracting you will get the folder that sort look like something maybe this so that Susan B.
This this folder.
So let me go to the next stop and after extracting I got.
Despite some community folder I get into it and basically after going into the bin so there is a bin
and I just open the terminal right over here because I want to just navigate to this directory.
After that you have to displace the assets and that despite some folders so you have to open despite
some application which should be done with despite time.
You can also use the tab in order for the auto completion does press into now and after this pressing
enter you will just open despite some application.
So after you open that bytes you will have to first create the new project the script the new project
press on that new project and it will just get these python file or basically you'll just get this project
first and in order to create the python file you have to go to the new end on this python but we have
done this in the windows in the previous couple of Lexis before.
So there shouldn't be any problem for you.
So now first of all what I gonna do is first of all I have to see a regular expression import me a regular
expression we need dads or you know what is the use of the regular expression that is finding sorting
or matching the patterns from the string or the sequence of characters.
So next the module will be very important module.
So if we just remember in the previous lecture what we did was we just sat on this command we just sat
on these couple of command that is making down or basically this making the interface down and running
this command and again running this command so that that you can see here we had running a three commands
in these selector basically in order to sense the magnet risks.
So we did first this command and again this combining again this command.
So what you can see here is we are just running a bunch of a command in the terminal.
So what we can normally do now is we have to run this command or basically we have to make this command
from any module so that it will be executed at once.
So that is our main purpose.
So in order to just sit on these type of command in this command line interface which we normally call
the terminal.
So there is module and I want you to see that module that is very important module in Python that is
some process module.
It is very much important module in this is a platform independent that means you can run this in the
Linux or Windows or in Linux are basically in the Mac also.
So this is a process module.
So we have to import this sub process module real quick.
So let me just go back to the page some again and I'll just say import me sub process.
So this is the way to import any module to your project and this is inbuilt process.
So that means you don't need to install these packages manually.
So get back here again.
Let me just go again here and let me just open on the Firefox and you can see that we have this whole
process module and there are a bunch of a meter.
We are not going to directly show you what this method is in a minute but we'll see you see one by one.
If we just get that matter use in our lecture.
So before that I want to show you this method are basically not this method.
I want to show you this method check outward mid-term because now we're going to use this output meter
so you can see the documentation right away here saying that this command basically run with the argument.
So arguments here can be your network interface which is a bunch of network interface which is but basically
it is zero.
Yellow are the Lanzarote.
So this will be your argument.
So which one you want two things.
So if you want to change the MAC addresses of video zero you have to enter this one if you want double
N0 you have to change this one so that is your arguments.
So basically what it is saying is it will run the combined with argument and return is output.
It's a by this that means it will just return as a string.
OK.
That is useful.
So let's go back to our bite some analysts do some coding.
So first of all in this lecture we are not going to quickly turns the MAC addresses of the Muslim.
But before that I want to show you how we can execute the command like this command.
So if I this go again here and what if I want to do something like I have config and if I hit into this
will just forget get us.
So if I see something like I have config and only the W line zero this is the information that we get
because we have this running this command in the terminal.
So we want to do the same as this but with the bytes I'm now.
So we want to run this whole command and get the MAC addresses from despite in court in this lecture
and in the next lecture will just sense this MAC addresses to something that is entered by the user
on maybe costume or maybe we can also assign the random numbers are to that MAC addresses.
So first of all we have imported the two modules which are important modules so next these allows us
to make output.
So now we have to make use of this process module just give a period in order to make the method the
use of that process which is the module and I have already shown you before that I am going to use these
take output method which is right here and let's go back to the PI some again and I'll just say sic
output
so this is the method I am going to use and basically this will run with the arguments so I'm not going
to use arguments yet but I'll just make a list.
So in this list I'm going to run or basically I'm going to type a command.
So if you just remember the command was I have config.
And after that I'll just give you space and I want to.
Okay.
Basically I have to this put this addition operator after this double court and I have to this join
this sweet w land zero because I want the MAC addresses of this double line zero.
So after that I want this cell.
Be true.
So this cell is basically your command line interface.
So we have created these take output method to uses.
So that means we have run this command now in the cell and now we are getting the output.
So from this output I want to only sorts the macro risk so because if we see here if we just run these
output you are going to get these ones of information but we don't want this because in this selected
coming later we're only interested in this third part which is the MAC addresses.
So we are going to extract this and you know what is the way to get the information from that string.
It is obviously with the regular expression because we are going to search we're going to Mars.
So we have to now say that got into MAC address so the current MAC address should be SaaS from this
regular expression and I'm going to use the source method and you know why.
Because this is going to give a global Zeus if I just say mass it is not going to work because that
will do the local sorts.
I want a global search.
So now you know how to do this right.
The pattern.
So you know how to write the pattern that is with this r and double chord.
After that I want any or that D.
Okay let me show you this pad.
No I haven't talked about this pattern before.
So this is saying that SLAs W can be any character.
So this is for any character that can be desert that can be number so mega.
This also can be the number and can be that easy.
So that means we'll have these okay.
Let me this really type faster.
So set S Ws less W and again colon.
This gives you the example and you'll just get understand what I'm doing doing here.
So again colon let me say less w maybe we are typing the five time.
So last time now.
So you could see that we have now these six times so this one two three four five six.
If I go back let me just copy our mac addresses and also you what is happening there.
So let's go back to the python.
Let me just go down and let me just pasted here.
So let me just comment this out again
so you could see what we're doing here is this.
W.W. means any character.
So this w w represents these two digit.
There is Colin in between them in this recall and so we are just sorting for the MAC addresses in that
whole line of these output of this command.
So outrageous parse the pattern and you know the next argument to the source is going to be the string
where do you want to source.
So in this case we don't have any sentence.
Rather we have the output because we want to source in the output of this command.
So I'm just searching that in this output and disclosing here.
So this output can be in the form of any of these integer or maybe the boolean so instead of just having
the either let's make this type cluster to the string for removing any error if we just came to any.
So we just did something like this get the macro raises now from that come on we just sit in the command
and we just gotta make it raises so let's bring that maker is now.
So you can clearly see now what is this did we just stand this command in the cell.
We just get that macro raises with this pattern we just printed the macro dresses.
So let me just run real quick now run this Max Enzo.
He'll get output right here.
So this is your mac addresses so you can also see if this is true or not by just going over here and
you could clearly see this are the MAC addresses that we just sends back here here.
So is this semantics to make a python code which will just give the current mac addresses by running
these command on this cell and getting the output and we source for the MAC address and get the mortgages.
So in the next lecture we'll see how this some mac addresses can be manipulated and how we can just
jeans with the help of some of the techniques and some of the modules.
So in the next lecture we'll see how does this change this MAC addresses.
So that will be interesting lecture soon the next one.