Welcome to this lecture.
So in the previous lecture We just implemented this method tends Mach metal.
So this was basically by Inter from the user so user will input the macro.
This is two things and based on that will just change the macro dresses.
And we also saw the current MAC addresses.
But now what we want is instead of just input from the user we want to include both of these so there
can be also random Max ins so user do not need to do anything they will simply choose Dobson either
two things manually or randomly so let's see how this can be done.
So first of all let me just define a process which will this generate the random MAC address.
So this will just send entered the random MAC address this matter.
So I have an idea that we Kansas intended the random MAC addresses by just combining two type or here.
So generally the MAC addresses is assigned by the Cisco in a deal.
So first of all we're just making the list of a number that our mac addresses are basically started
which are basically the devices MAC address start with.
So it normally starts with these three characters.
So let me show you here and the next one would be 96 and these are lasers so you cannot deny this number.
This is the Cisco legitimate or genuine numbers.
So we see stars our back addresses.
So a next one would be Dylan.
So I'll also make this deal.
Starting addresses and first one is obviously 0 0 again the next one will be 14 and the next one would
be let me say twenty two.
So this will be the starting MAC address.
So next thing what we want is we'll just take anything from this Cisco or Dell and this will be three
characters.
So first a three beers.
No not only the character so if you see this first three will be the pillars of either this quarter
deal and after this we'll just make this three no more so basically these three pillars three last year
on a random selection.
So let's go down here and let's say that MAC address will be that twice.
So this season will matter which she's going to give us the choice between either Cisco or either Dell.
So we have made a choice over here which will just see that the first beer are basically the first beer
will be from Cisco and Dell defined the hardware this quarter Dell.
And the last three beer will be generated randomly so less gender that random last three beers.
So I'll just say for I in RINs and it is three because we do want to basically the loop to execute three
times so because we just won the three beers last three beers.
So let's go over here again.
So in this range what we're gonna do is we are going to make one beer at a time.
So I'll just add choice.
And again here I want to convert with these string so basically we want to brand.
So if you have heard about this end into we haven't imported that module first.
So I have to import and I'm just not interested in importing only a random module I just don't do something
like random because if we do that random you have to call from Random again.
So instead of doing that I'll just say from random import me choice and I also want to import the next
thing and that is your brand.
And so now we have imported both of these submitter from this random module and you can take the documentation
of working of this or the ending basically gives you one in disarray at a time based on these numbers
that we inserted in between here.
So it should be the reins inside this band disease.
So I want the number from 0 to 9 so it can be any one number from 0 to 9.
It will be random obviously choice will are basically descending into will generate also a random number.
So next year I want is going to be again from this choice.
Let's see.
We have to again do the same thing.
That is again 1 one.
Okay.
1 what I'm doing.
So it is should we random.
And here I want again zero to nine again in the next statement will be very important statement because
I want to add both of these over here.
So I'll just say one plus two.
And here I have to first of all make these string.
So let me just add this first and this convert this to a string.
So let me this type goes to war here.
Now we have added this one into which will be just getting us a three piers so you can see what we just
did for each spear.
This loop will run and it'll generate this first number from this one.
And the second no more from these two and we just added We're here to make one complete here.
And this loop will run three times that means we'll just get three three pairs of the number which will
be random basically because this is it ending.
So the next thing is very important.
And now the next thing will be to append to this MAC addresses that we just created over here.
So you could see this will be MAC address and I won this MAC address basically have to happen because
this the list and I want to append let me say these three.
So this should be three.
That should be appended to MAC addresses.
But if you remember till now we're also making these all of the numbers.
But without this column in between them.
So we don't we we made successfully this number which will be random but they don't have this macro.
They are basically disqualified in between this number.
So now we have to make this colon in between them.
So in order to make that you have to remember about the join method it was very very very important
method.
I have just told you that before and that is going to be here return and let me this concatenated we
join join matter and let me add MAC address to what we just did here.
Basically let me just open my ideally and let me show you what is happening over here.
So you find us say something like Let me this join and let me just call this joint matter okay.
Join method in maybe the eatery was so let me say a b c d is my eatery eatable if I hit enter you could
see that this colon was inserted in between them so it was not inserted at the beginning it was not
inserted in the middle.
This is what we just need because we want this joint.
Basically this colon to be inserted in between these number.
So this is inserted in between these number inside these MAC addresses and we just return that MAC addresses
from these random Mac.
So with this now call this macro disease so instead of just making here that is to call manually lists
make one conditional flow right here.
So what I'm going to do here is I'll just take if maybe maybe print some masses first print masses is
like inter
one for Manuel syncing of Mac Grace and two for
random mac address.
So this will be messages that will be the over here.
But we now need the input because we want to have this one hour to input it by the user so that can
be done.
Let me say input and okay.
This is just the imp and all this input.
Now that is the number.
So we'll have the number.
But just remember this will be a string because input will just to get a string.
So after we just get the imperialistic if imp is equal call 1.
So you could see I'm not writing this one because this will be the NDA and the input that is given by
this input method will be in the form of the string.
That means I'll just put one.
Now will make the flow control in order to see if the user one the random macro address or the macro
address that is imputed by the user.
So if the input is one what we're gonna do is we simply see the menu changing for this.
So that means we have to now call this a max insert since Mac with this interface and the new Mac.
So as I say since Mac for me that with this interface and basically we have to parse the new Mac.
So next thing is okay if Dane put the one then only will just get the input.
So that makes sense.
So let me just grab this and let me just scoot over here and now with the settings the Mac and the swing
either the school over here.
So the next thing what we want is to take the input for two or basically to say Elif input is again
the next digit.
That will be to in this case.
And if it is the case then we have to first call that Mac random and the say random will be the Mac
and I'll just call this a Mac random and uprisings call this Mac random.
So we just made this file over here saying that if input is one then we'll just sit in the Mac.
If input is true then that means there should be the random so before that let me just print that random
Mac too because I want to see what the random is basically what the Mac was said and we'll see the Mac
that is set from these random basically the random Mac method.
So now next thing what you need to do is you can see we have any other robot here that these because
we have to set this seed inside the method.
So I'll just make this inside the method because we have called the method over here.
If you see so I'll just put this inside the main method that is our main method.
Let me just paste it down here.
You could see we have resolved that either now.
So it's time to now call these men metal so you could see I have kept this interface outside of these
men because we have to also get this interface input from the user so as to just get the interface.
And because in both of the case you can see in the teens Mac.
Basically with the random and basically the MAC address that is input it from the user manually they
both need the interface.
So I've just decided to just input the interface before and that will be with this option that is in
part by the user.
So next thing what you need to do is you have to now call this the main method which has this program.
So the main program our is in this main matter so let's call this main method over here.
So now what I'm going to do is we are going to use this convention over here if.
Name it call Main.
And if you see what this does is inside here I'm going to call this main method.
So in this is very important statement right here.
What this does is basically to say that this is Faisal variable which is name first and second thing
it is going to execute every code that is over here.
And it has the main method that means it is going to call this man method and this main method will
call some of these a method which is the Mac contains a Mac again with this random Mac emitter.
So this is our complete program.
So let's see how this works.
So okay we are getting some error.
Let's see what is the either or both.
So let me just remove this one.
Let's run this real quick and see what it is that you're about.
So it is saying sins Mack he's having the problem.
Well it is having a problem OK.
What.
What we just did that is to define men.
So let's remove these men.
OK so now we have rectified this problem let's see how this goes.
So let me just sit on our since all it is saying what do you need.
So I'll just say there one for the manual tending of the MAC address or two for the random MAC address.
So I wonder then the MAC address obscene.
So I'll just say too.
So I just need the random MAC address.
Let me just press two over here.
Let me hit enter then it will say enter your network interface my network interface is w Len zero I
want to turn this one.
And you could see now we have tens to this new mac address you can take it by going over here and let's
create the new window a new terminal open the new terminal I have config to see over here and this is
our new mac address you could clearly see over here and this is done by using this program.
So we completed our Mac sensor program in the selector we saw how to make our random MAC address and
the MAC address that can be also used from the input which is given by the user.
So we saw how to make a use of these sub process.
So this was the important module to work with because this will just execute your chord in the cell
with this call method.
And the difference between this call method and you could see in this tech output this is going to run
in a line basically so this is important because this will care about the sequence and this does not
care about the sequence.
This boat will just run the arguments based on what is just passed inside this pattern.
This is any to execute in this cell which we have just given is true.
So we made the use of this process which was important module to learn about here.
We just made this random module two the three make the random MAC address over here.
So this will be the for dyslexia.
We just made a complete maxims in this lecture.
So this was interesting six and so soon the next one.