Okay so now we have a program that we can use to scan our ping the address that we already defined here.
The next thing we want to do is we want to scan a number of ports so our current program just scans
port number 80 which is here.
But what we want to do is we want to scan a number of ports so to do this what we can do is that we
can turn it over from one to a hundred and then each time we change the number of port for example which
port we are using.
So let's clear the for loop here.
And then we define a variable called a which will have a value of one initially and then we will increment
this value over each iteration and then let's say we want to scan HUNDRED PORTS AND THE POST condition
would be that we will rotate our engagement and then we really put this whole thing inside the loop.
Now if you write just i.e. here you can see that there will be an error because this thing which is
a is an integer but this thing this whole thing is a string so you cannot count getting it any integer
onto a string.
So there are various ways you can work around it either you can use this thing to convert it into an
integer let's remove this port here and work with it.
And if I run it
you will see that it works perfectly.
But there was a slight problem that I will explain later.
The next thing you want to do is we can use the s brand def function.
So what you can do is you can use it t dot s plaintiff.
So what this function will do is if you go to the documentation it says that Esperanto formats gardening
to a format specify it and date and that is a long string.
So what do you want to do is we want to define a format here.
So our first thing should be IP and then we need to provide this start operator.
And the last thing we will define is a percent the operator.
So this person B will do place I.
And then it will turn the whole thing into this address.
So this I will be placed here.
And this whole thing will become a string and return to this address variable.
And then if there is a connection match what we can do is we can say a connection established and then
we can define the port number which would be let's call it print f instead of print land and then we
can say 4 percent v.
Which would be the value of this port
and then we can give out i.e. because this is the port number that we are working with.
So if there is a connection from some port it will print out its value here.
So if you run this again you will see the regard to connection from port number 22.
So there is some issue here.
So this is a formatting issue.
You can see that we got connection from two ports so port number 22 and port number 80.
So these two ports are open and we got a connection from these ports in next election will try to build
up a concurrent program that will do this process in a more faster way.
Okay.
So there is this thing bursts and 422 and then there is an error which is extra string and we try to
move this in the next lecture.